-
在SQL语言基础中,如何从一个表中删除行
资源介绍
从一个表中删去行
*
SQL> DELETE FROM department
2 WHERE dname = 'DEVELOPMENT';
1 row deleted.
SQL> DELETE FROM department;
4 rows deleted.
使用 WHERE 子句以指定哪些行应当被删去.
如果忽略WHERE 子句,那么表中所有的数据.
*
Deleting Rows (continued)
You can delete specific rows by specifying the WHERE clause in the DELETE statement. The slide example deletes the DEVELOPMENT department from the DEPARTMENT table. You can confirm the delete operation by displaying the deleted rows using the SELECT statement.
Example
Remove all employees who started after January 1, 1997.
If you omit the WHERE clause, all rows in the table are deleted. The second example on the slide deletes all the rows from the DEPARTMENT table because no WHERE clause has been specified.
Note: The DEPARTMENT table has the same data as the DEPT table.
SQL> SELECT *
2 FROM department
3 WHERE dname = 'DEVELOPMENT';
no rows selected.
SQL> DELETE FROM emp
2 WHERE hiredate > TO_DATE('01.01.1997', 'DD.MM.YYYY');
1 row deleted.
- 上一篇: 对基于另一个表的行进行更改-SQL语言基础
- 下一篇: 从一个表中移去一行-SQL语言基础