-
在SQL语言基础中,对基于另一表的行执行更改操
资源介绍
对基于另一个表的行进行更改
*
SQL> UPDATE employee
2 SET deptno = (SELECT deptno
3 FROM emp
4 WHERE empno = 7788)
5 WHERE job = (SELECT job
6 FROM emp
7 WHERE empno = 7788);
2 rows updated.
在 UPDATE语句中,使用子查询来进行更改,更改的数据与其它表中的数据有关.
*
Updating Rows Based on Another Table
You can use subqueries in UPDATE statements to update rows in a table. The example on the slide updates the EMPLOYEE table based on the values from the EMP table. It changes the department number of all employees with employee 7788’s job title to employee 7788’s current department number.
- 上一篇: 从另一个表中拷贝行-SQL语言基础
- 下一篇: 从一个表中删去行-SQL语言基础