标签:
1 --使用表达式更新一个单列的值 2 UPDATE employee 3 SET salary = salary*1.1 4 WHERE department_id = 90 5 6 --使用子查询更新一个单列的值 7 UPDATE employee 8 SET salary = ( 9 SELECT employee2.salary 10 FROM employee2 WHERE employee_id = 10 11 ) 12 WHERE employee_id = 90 13 14 --通过WHERE子句中使用子查询确定要更新的数据行来更新单列的值 15 16 17 --通过使用SELECT语句定义表及列的值来更新表 18 UPDATE ( 19 SELECT col1,col2,... 20 FROM table_name1 21 WHERE ...... 22 ) 23 SET col_value = new_col_value 24 25 --通过子查询更新多列 26 UPDATE 27 SET (col1,col2) = ( 28 SELECT col2,col2 FROM table1 29 ) 30 WHERE ...
标签:
原文地址:http://www.cnblogs.com/sherrykid/p/4665262.html