![]() | |
#11
| |||
| |||
|
|
On 2/9/11 2:36 PM, in article d06a4383-dd44-4f4d-b097-c49e4d8c49ef...oglegroups.com, "Captain Paralytic" <paul_lautman (AT) yahoo (DOT) com> wrote: On Feb 9, 5:26*pm, Luuk <L... (AT) invalid (DOT) lan> wrote: The only problem i see in changing tables is, when you do something like this now: SELECT * from tablename; Not as devastating as INSERT INTO tablename VALUES (...) Yikes! I have that in my upload script. It's ok if I name the values, right? But I don't. I just use INSERT INTO files VALUES (...). Still, though, if I added the new field at the end and gave it a default value, won't it still work ok? |
#12
| |||
| |||
|
|
Bint: On 2/9/11 2:36 PM, in article d06a4383-dd44-4f4d-b097-c49e4d8c49ef...oglegroups.com, "Captain Paralytic" <paul_lautman (AT) yahoo (DOT) com> wrote: On Feb 9, 5:26 pm, Luuk <L... (AT) invalid (DOT) lan> wrote: The only problem i see in changing tables is, when you do something like this now: SELECT * from tablename; Not as devastating as INSERT INTO tablename VALUES (...) Yikes! I have that in my upload script. It's ok if I name the values, right? But I don't. I just use INSERT INTO files VALUES (...). Still, though, if I added the new field at the end and gave it a default value, won't it still work ok? May I suggest you change that to: INSERT tablename SET field1 = "..." field2 = 3456 (etc.) That way, missing fields in the query will obtain the default value. Disadvantage: only by means of testing, you will notice whether or not you forgot to add a field if you wanted to. With the VALUES clause, on the other hand, if you forget a field, you will get a MySQL error message. It's up to you which advantage you prefer and which disadvantage you accept. |

#13
| |||
| |||
|
|
On 10-02-11 18:54, Erick T. Barkhuis wrote: Bint: On 2/9/11 2:36 PM, in article d06a4383-dd44-4f4d-b097-c49e4d8c49ef...oglegroups.com, "Captain Paralytic"<paul_lautman (AT) yahoo (DOT) com> wrote: On Feb 9, 5:26 pm, Luuk<L... (AT) invalid (DOT) lan> wrote: The only problem i see in changing tables is, when you do something like this now: SELECT * from tablename; Not as devastating as INSERT INTO tablename VALUES (...) Yikes! I have that in my upload script. It's ok if I name the values, right? But I don't. I just use INSERT INTO files VALUES (...). Still, though, if I added the new field at the end and gave it a default value, won't it still work ok? May I suggest you change that to: INSERT tablename SET field1 = "..." field2 = 3456 (etc.) That way, missing fields in the query will obtain the default value. Disadvantage: only by means of testing, you will notice whether or not you forgot to add a field if you wanted to. With the VALUES clause, on the other hand, if you forget a field, you will get a MySQL error message. It's up to you which advantage you prefer and which disadvantage you accept. same is true for: INSERT INTO tablename(field1, field2) VALUES (.....); i like this syntax more, but that's personal ![]() |
#14
| |||
| |||
|
|
On 10-02-11 18:54, Erick T. Barkhuis wrote: Bint: On 2/9/11 2:36 PM, in article d06a4383-dd44-4f4d-b097-c49e4d8c49ef...oglegroups.com, "Captain Paralytic" <paul_lautman (AT) yahoo (DOT) com> wrote: On Feb 9, 5:26 pm, Luuk <L... (AT) invalid (DOT) lan> wrote: The only problem i see in changing tables is, when you do something like this now: SELECT * from tablename; Not as devastating as INSERT INTO tablename VALUES (...) Yikes! I have that in my upload script. It's ok if I name the values, right? But I don't. I just use INSERT INTO files VALUES (...). Still, though, if I added the new field at the end and gave it a default value, won't it still work ok? May I suggest you change that to: INSERT tablename SET field1 = "..." field2 = 3456 (etc.) That way, missing fields in the query will obtain the default value. Disadvantage: only by means of testing, you will notice whether or not you forgot to add a field if you wanted to. With the VALUES clause, on the other hand, if you forget a field, you will get a MySQL error message. It's up to you which advantage you prefer and which disadvantage you accept. same is true for: INSERT INTO tablename(field1, field2) VALUES (.....); i like this syntax more, but that's personal ![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |