SQL DROP TABLE 和 TRUNCATE TABLE 關鍵字
DROP TABLE
The DROP TABLE
command deletes a table in the database. (DROP TABLE 命令用於刪除資料庫中的表。)
The following SQL deletes the table "Shippers" (以下 SQL 語句刪除 "Shippers" 表)
示例
DROP TABLE Shippers;
Note: Be careful before deleting a table. Deleting a table results in loss of all information stored in the table! (注意:刪除表前請務必小心。刪除表將導致其中儲存的所有資訊丟失!)
TRUNCATE TABLE
TRUNCATE TABLE
命令刪除表中的資料,但不刪除表本身。
以下 SQL 截斷了 "Categories" 表:
示例
TRUNCATE TABLE Categories;