Modification statements in SQL include UPDATE, DELETE and INSERT INTO, which are used to update, delete and insert data in the database. The UPDATE statement updates existing records in the table, the DELETE statement deletes records, and the INSERT INTO statement inserts new records.
Modify statement in SQL
Modify statement is used to update data in the database, and it includes the following commands:
UPDATE statement
The UPDATE statement is used to update existing records in the table. Its format is:
UPDATE <表名> SET <列名> = <新值>, ... WHERE <条件>;
For example, update theemployees
table The salary of the employee named "John Doe" is 10,000:
UPDATE employees SET salary = 10000 WHERE name = "John Doe";
DELETE statement
The DELETE statement is used to delete records from the table. Its format is:
DELETE FROM <表名> WHERE <条件>;
For example, to delete an employee named "John Doe" from theemployees
table:
DELETE FROM employees WHERE name = "John Doe";
INSERT INTO statement
The INSERT INTO statement is used to insert new records into the table. Its format is:
INSERT INTO <表名> (<列名1>, <列名2>, ...) VALUES (<值1>, <值2>, ...);
For example, insert a new employee "Jane Smith" in theemployees
table:
INSERT INTO employees (name, salary) VALUES ("Jane Smith", 8000);
The above is the detailed content of How to write modification statements in sql. For more information, please follow other related articles on the PHP Chinese website!