There are two statements in SQL that modify table data: UPDATE statement: used to update specified row data, the syntax is UPDATE table_name SET column = value WHERE condition;. DELETE statement: used to delete specified rows, the syntax is DELETE FROM table_name WHERE condition;.
SQL statement to modify table data
In SQL, there are two main statements to modify table data:
1. UPDATE statement
Purpose: Update the data of the specified row in the table.
Syntax:
<code class="sql">UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;</code>
Example: Update the salary of the employee named "John Smith" in the table "employees":
<code class="sql">UPDATE employees SET salary = 50000 WHERE name = 'John Smith';</code>
2. DELETE statement
Purpose: Delete the specified row from the table.
Syntax:
<code class="sql">DELETE FROM table_name WHERE condition;</code>
Example: Delete the customer with ID 10 from the table "customers":
<code class="sql">DELETE FROM customers WHERE id = 10;</code>
Note:
The above is the detailed content of Statements to modify table data in sql. For more information, please follow other related articles on the PHP Chinese website!