删除记录
删除记录通过DELETE语句实现,其(单表删除)语法为:
DELETE FROM TABLE [ WHERE WHERE_cONditiON ]
说明:
DELETE语句删除记录,并且返回被删除的行数(记录数);
如果省略WHERE条件,则删除全部记录;
-- 删除db02表中,姓名(name)是我吃西红柿的记录
DELETE FROM db02 WHERE name='我吃西红柿';
SELECT * FROM db02;
-- 删除db02表中,编号(id)是1号的记录
DELETE FROM db02 WHERE id=1;
SELECT * FROM db02;
-- 删除db02表中,全部数据
DELETE FROM db02;
SELECT * FROM db02;