Hi,
I have a table with 10 fields, 3 of them were filled in previous query, now I want to fill the rest fields, Should i use INSERT or UPDATE in my query ?
| SitePoint Sponsor |




Hi,
I have a table with 10 fields, 3 of them were filled in previous query, now I want to fill the rest fields, Should i use INSERT or UPDATE in my query ?



Dude, they don't do the same....
Insert is to inserting new rows.
Update is to update rows that have already been inserted.
You will have to use insert on the remaining rows, and update on the existing.
Think what tripy means is:
Use an update query to fill in the 7 fields in the rows already in the database.
Use an insert query to add new rows (with all fields, some of which could be null).
Find freelance jobs from all the major sites in one place:
on twitter / on the web / twitter rss feed


you could also use INSERT...ON DUPLICATE KEY UPDATE for all 10 entries
Bookmarks