Reputation: 32721
It seems INSERT
and UPDATE
do the same things to me.
Is there any occasions where I should use INSERT
instead of UPDATE
and vice versa?
Upvotes: 38
Views: 75598
Reputation: 1
Insert can be useful to insert new record in BLANK row. While Update can be used to update row which is NOT BLANK.
Upvotes: -1
Reputation: 11
Insert is for putting in a fresh record to the table. while the update enables you to modify the inserted record e.g. modifying data type etc.
Upvotes: 1
Reputation: 344431
In CRUD operations, the INSERT
is the 'C' and the UPDATE
is the 'U'. They are two of the four basic functions of persistent storage. The other two are SELECT
and DELETE
. Without at least these four operations, a typical database system cannot be considered complete.
Use INSERT
to insert a new record.
Use UPDATE
to update an existing record.
Upvotes: 53
Reputation: 1706
Insert is for adding data to the table, update is for updating data that is already in the table.
Upvotes: 4
Reputation: 113964
You cannot UPDATE a row that's not in a table.
You cannot INSERT a row that's already in a table.
Upvotes: 52