萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> mysql教程 >> SQL DELETE 語法,語句及用法

SQL DELETE 語法,語句及用法


DELETE 語句用於刪除表中的行。

DELETE FROM 表名稱 WHERE 列名稱 = 值




LastName
FirstName
Address
City


Gates
Bill
Xuanwumen 10
Beijing


Wilson
Fred
Zhongshan 23
Nanjing




"Fred Wilson" 會被刪除:
DELETE FROM Person WHERE LastName = 'Wilson'




LastName
FirstName
Address
City


Gates
Bill
Xuanwumen 10
Beijing




可以在不刪除表的情況下刪除所有的行。這意味著表的結構、屬性和索引都是完整的:
DELETE FROM table_name
或者:
DELETE * FROM table_name
copyright © 萬盛學電腦網 all rights reserved