What are differences between INSERT and UPDATE in MySQL?

shin picture shin · Jan 4, 2010 · Viewed 57.5k times · Source

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?

Answer

Daniel Vassallo picture Daniel Vassallo · Jan 4, 2010

In CRUD operations, the INSERT is the 'C' and the UPDATEis 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.