-
在SQL语言基础中,如何删除一个表中的一行记录
资源介绍
从一个表中移去一行
*
DEPT
DEPTNO DNAME LOC
------ ---------- --------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
50 DEVELOPMENT DETROIT
60 MIS
...
“…从一个表中删去一行…”
DEPT
DEPTNO DNAME LOC
------ ---------- --------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
60 MIS
...
*
Removing a Row from a Table
The slide graphic removes the DEVELOPMENT department from the DEPT table (assuming that there are no constraints defined on the DEPT table).
Instructor Note
After all the rows have been eliminated with the DELETE statement, only the data structure of the table remains. A more efficient method of emptying a table is with the TRUNCATE statement.
You can use the TRUNCATE statement to quickly remove all rows from a table or cluster. Removing rows with the TRUNCATE statement is faster than removing them with the DELETE statement for the following reasons:
The TRUNCATE statement is a data definition language (DDL) statement and generates no rollback information. It will be covered in a subsequent lesson.
Truncating a table does not fire the DELETE triggers of the table.
If the table is the parent of a referential integrity constraint, you cannot truncate the table. Disable the constraint before issuing the TRUNCATE statement.
- 上一篇: 从一个表中删去行-SQL语言基础
- 下一篇: DELETE语句-SQL语言基础