SQL DELETE語句用于從數據庫表中刪除一行或多行數據。DELETE語句的用法如下:
DELETE FROM 表名;
DELETE FROM 表名 WHERE 條件;
DELETE FROM 表名 WHERE 列名 = 值;
DELETE FROM 表名 WHERE 條件1 AND 條件2;
DELETE FROM 表名 WHERE 條件1 OR 條件2;
DELETE TOP(N) FROM 表名;
DELETE FROM 表名 WHERE 列名 NOT IN (SELECT MIN(列名) FROM 表名 GROUP BY 列名);
注意:在使用DELETE語句時要謹慎操作,因為刪除的數據將無法恢復。在執行DELETE語句之前,建議先備份數據或使用事務進行操作。