DELETE [LOW_PRIORITY] [QUICK] FROM table_name
[WHERE where_definition]
[ORDER BY ...]
[LIMIT rows]DELETE 语句的LIMIT rows 选项是 MySQL 特有的,它告诉服务器在控制权被返回到客户端之前可被删除的最大记录行数目。这可以用来确保一个特定的 DELETE 命令不会占用太长的时间。
[WHERE where_definition]
[ORDER BY ...]
[LIMIT rows]DELETE 语句的LIMIT rows 选项是 MySQL 特有的,它告诉服务器在控制权被返回到客户端之前可被删除的最大记录行数目。这可以用来确保一个特定的 DELETE 命令不会占用太长的时间。
-> id int primary key not null auto_increment,
-> username varchar(15) not null
-> );mysql> insert into test (username) values ('cloudchen');
mysql> insert into test (username) values ('mumac');
mysql> insert into test (username) values ('jordan');
mysql> insert into test (username) values ('michael');
mysql> insert into test (username) values ('michael');
mysql> insert into test (username) values ('michael');
mysql> insert into test (username) values ('michael');
mysql> insert into test (username) values ('michael');mysql> delete from test where username = 'michael' order by id desc limit 2;把username为michael的作后两条记录删掉