TRUNCATE 中文man页面

系统
TRUNCATE 快速地从一个表中删除所有行。它和无条件的 DELETE 有同样的效果,不过因为它不做表扫描,因而快得多。 在大表上最有用。

NAME

TRUNCATE - 清空一个表

SYNOPSIS

TRUNCATE [ TABLE ] name

DESCRIPTION 描述

TRUNCATE 快速地从一个表中删除所有行。它和无条件的 DELETE 有同样的效果,不过因为它不做表扫描,因而快得多。 在大表上最有用。  

PARAMETERS 参数

name

 要清空的表名字(可以有模式修饰)。

NOTES 注意


 如果从其它表有到这个表的外键引用,那么就不能使用 TRUNCATE。 在这种情况下检查有效性要求进行表扫描,而 TRUNCATE 的概念是不做这样的事情。

TRUNCATE 不会运行任何在该表上存在的 ON DELETE 触发器。  

EXAMPLES 例子


 截断表 bigtable∶

TRUNCATE TABLE bigtable;

COMPATIBILITY 兼容性


 SQL 标准里没有 TRUNCATE 。  

#p#

NAME

TRUNCATE - empty a table

SYNOPSIS

TRUNCATE [ TABLE ] name

DESCRIPTION

TRUNCATE quickly removes all rows from a table. It has the same effect as an unqualified DELETE but since it does not actually scan the table it is faster. This is most useful on large tables.  

PARAMETERS

name
The name (optionally schema-qualified) of the table to be truncated.

NOTES

TRUNCATE cannot be used if there are foreign-key references to the table from other tables. Checking validity in such cases would require table scans, and the whole point is not to do one.

TRUNCATE will not run any user-defined ON DELETE triggers that might exist for the table.  

EXAMPLES

Truncate the table bigtable:

TRUNCATE TABLE bigtable;

COMPATIBILITY

There is no TRUNCATE command in the SQL standard.

责任编辑:韩亚珊 来源: CMPP.net
相关推荐

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-11-01 13:46:50

中文mantac

2011-08-25 16:55:26

gets中文man

2011-08-25 15:49:02

freopen中文man

2011-08-25 16:00:56

fflush中文man

2011-08-25 16:08:55

fsetpos中文man

2011-08-25 15:33:18

exit中文man

2011-08-25 10:55:37

services中文man

2011-08-25 09:35:26

units中文man

2011-08-24 13:57:35

DECLARE中文man

2011-08-11 15:28:43

ali中文man

2011-08-23 17:24:11

userdel中文man

2011-08-23 17:33:22

rdev中文man

2011-08-23 18:05:21

ABORT中文man

2011-08-18 19:15:25

group中文man

2011-08-23 10:17:54

bdflush中文man

2011-08-23 10:48:03

exportfs中文man
点赞
收藏

51CTO技术栈公众号