A conditional judgment
In SQL, the conditional judgment uses where, which is equivalent to the IF in the language, basic usage such as:
SELECT column1, Column2, columnn from Table_namewhere [condition]
In addition, SQL supports mathematical operations, logical operations, operations, and so on, which can be placed in the WHERE clause.
Two Update tables
The basic syntax is as follows:
UPDATE table_nameset column1 = value1, Column2 = value2 ...., columnn = valuenwhere [condition];
If the table has the following contents:
ID NAME age ADDRESS SALARY ---------- ---------- ---------- ---------- --- -------1 James Hubei 10000.0 2 June Hubei 2500.0 3 Jack Qianjiang
Use the following statement to update:
Update company Set ADDRESS = ' China ' where ID = 1;
The updated table reads as follows:
ID NAME age ADDRESS SALARY ---------- ---------- ---------- ---------- ----------1 James China 10000.0 2 June Hubei 2500.0 3 Jack 28 Qianjiang