Previous article Taimienphi.vn introduced you to the INSERT statement in SQL, this command is used to add new data rows to a table, in the following article, Taimienphi.vn will introduce you to the UPDATE command. in SQL helps you understand its syntax and usage.
Unlike the INSERT statement in SQL, the UPDATE statement is used to modify existing rows in the table.
Syntax of UPDATE statement in SQL
SET column_name1 = value1,
column_name2 = value2, …
table_name: The table name must be updated.
column_name1, column_name2 .. : columns are changed.
value1, value2 … : is the new value.
Note: In theUPDATE statement structure in SQL, the WHERE clause identifies the affected rows. Without adding the WHERE clause, the column values for all rows will be affected.
Example of UPDATE statement in SQL
To update the employee’s position, the UPDATE query in SQL has the following form:
SET location = ‘Mysore’
WHERE id = 101;
To change the salary of all employees, the query is of the form:
SET luong = luong + (luong * 0.2);
Above Taimienphi.vn just introduced you the UPDATE command in SQL. If you have any questions or questions, please leave your comments in the comment section below the article. Don’t forget to read some articles about CREATE, DELETE, JOINS command in SQL, … on Taimienphi.vn offline.