SQL TRUNCATE TABLE 命令用于从现有表中删除完整数据。
Truncate - 语法
TRUNCATE TABLE 命令的基本语法如下。
TRUNCATE TABLE table_name;
Truncate - 示例
考虑具有以下记录的CUSTOMERS表-
+----+----------+-----+-----------+----------+ | ID | NAME | AGE | ADDRESS | SALARY | +----+----------+-----+-----------+----------+ | 1 | Ramesh | 32 | Ahmedabad | 2000.00 | | 2 | Khilan | 25 | Delhi | 1500.00 | | 3 | kaushik | 23 | Kota | 2000.00 | | 4 | Chaitali | 25 | Mumbai | 6500.00 | | 5 | Hardik | 27 | Bhopal | 8500.00 | | 6 | Komal | 22 | MP | 4500.00 | | 7 | Learnfk | 24 | Indore | 10000.00 | +----+----------+-----+-----------+----------+
以下是Truncate命令的示例。
SQL > TRUNCATE TABLE CUSTOMERS;
现在,CUSTOMERS表被截断,SELECT语句的输出将显示在下面的代码块中-
SQL> SELECT * FROM CUSTOMERS; Empty set (0.00 sec)
参考链接
https://www.learnfk.com/sql/sql-truncate-table.html
标签:+----+----------+-----+-----------+----------+,CUSTOMERS,Truncate,TRUNCATE,无涯,SQ From: https://blog.51cto.com/u_14033984/9270419