How to Update Data using SQL

The UPDATE statement is used to modify the existing records in a table. With an UPDATE statement, you can change a single row in a table, a set of rows that share one or more characteristics, or all the rows in the table.

images/articles/mysql/update-data-using-sql.jpg
UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;

The SET clause specifies which columns will get new values and what those new values will be.

The optional WHERE clause specifies which records should be updated. If you omit the WHERE clause, all records in the table will be updated.