1.4 Sub Query With Update Statement

 The sub query can be used in conjunction with the UPDATE statement. Either single or multiple columns in a table can be updated when using a sub query with the UPDATE statement.

QUERY: - UPDATE table SET column_name = new_value

[WHERE OPERATOR [VALUE] ]

(SELECT COLUMN_NAME FROM TABLE_NAME [WHERE] )


EXAMPLE: - UPDATE CUSTOMERS SET SALARY = SALARY * 0.25

WHERE AGE IN (SELECT AGE FROM CUSTOMERS_BKP

WHERE AGE >= 27)

Last modified: Tuesday, 7 January 2020, 10:21 AM