set field 1 = value where sql statement to modify data In SQL, you can use the UPDATE statement to modify and update the data of one or more tables. The syntax format is: The syntax description is as follows: 722e3d59fd24604761db25f00f9b264f: used to specify the name of the table to be updated. SET clause: used to specify the column name and its column value to be modified in the table. Among them, each specified column value can be an expression or the default value corresponding to the column. If a default value is specified, the column value can be represented by the keyword DEFAULT. WHERE clause: Optional. Used to limit the rows in the table to be modified. If not specified, all rows in the table will be modified. ORDER BY clause: optional. Used to limit the order in which rows in a table are modified. LIMIT clause: Optional. Used to limit the number of rows that are modified. Note: When modifying multiple column values in a row of data, each value in the SET clause can be separated by commas. Example: PHP Chinese website has a large number of free SQL tutorials, everyone is welcome to learn! The above is the detailed content of sql statement to modify data. For more information, please follow other related articles on the PHP Chinese website!sql statement to modify data
UPDATE <表名> SET 字段 1=值 1 [,字段 2=值 2… ] [WHERE 子句 ]
[ORDER BY 子句] [LIMIT 子句]
mysql> UPDATE tb_courses_new
-> SET course_name='DB',course_grade=3.5
-> WHERE course_id=2;
Query OK, 1 row affected (0.13 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> SELECT * FROM tb_courses_new;
+-----------+-------------+--------------+------------------+
| course_id | course_name | course_grade | course_info |
+-----------+-------------+--------------+------------------+
| 1 | Network | 4 | Computer Network |
| 2 | DB | 3.5 | MySQL |
| 3 | Java | 4 | Java EE |
| 4 | System | 4 | Operating System |
+-----------+-------------+--------------+------------------+
4 rows in set (0.00 sec)