The statement used in the SQL language to modify data in a relational table in a database is update, which can be used to modify the values of one or more columns in a selected row in a relational table, using the following format:
Updata < table name >
Set column name = Expression,..., Column name = Expression
[where< search term;]
The search conditions in the WHERE clause are also allowed to contain another SELECT query statement.
Example 10: To the current no quota of sales staff assigned 6000 yuan quota.
Updata Salesreps
SET quota=6000
WHERE QUOTA is NULL
Example 11: A salesperson who accepts a total order over 9000 yuan after January 1, 1999 reports directly to John (number 104).
UPDATE Salesreps
SET manager=104
WHERE 9000< (SELECT SUM (AMOUNT)
From ORDERS WHERE order_date> "01-01-99"
References: SQL language tutorials SQL language basics
Back to the database basics ABC Directory