What are differences between INSERT and UPDATE in MySQL?

62,753

Solution 1

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.

Solution 2

You cannot UPDATE a row that's not in a table.

You cannot INSERT a row that's already in a table.

Solution 3

Insert is for adding data to the table, update is for updating data that is already in the table.

Solution 4

An UPDATE statement can use a WHERE clause but INSERT cannot.

Solution 5

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.

Share:
62,753
shin
Author by

shin

IB Diploma and MYP mathematics teacher who loves coding.

Updated on December 03, 2020

Comments

  • shin
    shin over 3 years

    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?