I had a quick check through the MySQL docs and I noticed for versions > 3.22.10 you can use SQL like:
Which is interesting, but I'm not sure if it is better, and I'm pretty sure it isn't portable. There is a couple of other things that are cool (I never noticed this stuff before!) such as inserting multiple records in 1 statement:INSERT INTO table SET x = 1, y = 2, z = 3;
Of course this is only really handy if you know in advance how many records you want to insert.INSERT INTO table (x,y,z) VALUES (1,2,3), (4,5,6), (7,8,9);
What I forgot to mention is that you should really be using:
if you are doing multiple inserts as this can give you quite a bit of a performance boost.INSERT DELAYED INTO table (x,y,z) VALUES (1,2,3);
gav^
In reply to Re: (jeffa) 2Re: Inserting values into a MySQL database
by gav^
in thread Inserting values into a MySQL database
by TStanley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |