-
使用SQL语言基础知识,根据另一个表来删除行
资源介绍
参照另一个表来删除行
*
SQL> DELETE FROM employee
2 WHERE deptno =
3 (SELECT deptno
4 FROM dept
5 WHERE dname ='SALES');
6 rows deleted.
使用子查询,使得 DELETE 语句能从另一个表中删除某些行.
*
Deleting Rows Based on Another Table
You can use subqueries to delete rows from a table based on values from another table. The example on the slide deletes all the employees who are in department 30. The subquery searches the DEPT table to find the department number for the SALES department. The subquery then feeds the department number to the main query, which deletes rows of data from the EMPLOYEE table based on this department number.
- 上一篇: 参照完整性错误-SQL语言基础
- 下一篇: 参考其它用户的表-SQL语言基础