SQL-DELETE
DELETE语句
DELETE语句用于删除表中的行。
语法:
DELETE FROM table_name WHERE column_name = value
举例
Person:
LastName | FirstName | Address | City |
---|---|---|---|
Gates | Bill | Xuanwumen 10 | Beijing |
Wilson | Fred | Zhongshan 23 | Nanjing |
DELETE FROM Persons WHERE LastName='Wilson'
删除所有行
可以在不删除表的情况下删除所有的行。这意味着表的结构、属性和索引都是完整的:
DELETE FROM table_name
或者
DELETE * FROM table_name