MySQL DELETE 命令用于什么?
MySQL DELETE 命令用于从表中删除一行或多行。它与 WHERE 子句配合使用。
语法
DELETE From Table_name WHERE Condition;
示例
在下面的示例中,我们删除了 id >=100 的表“employee”中的行。
mysql> select * from employee; +------+--------+ | Id | name | +------+--------+ | 100 | Ram | | 200 | Gaurav | | 300 | MOHAN | +------+--------+ 3 rows in set (0.00 sec) mysql> delete from employee where id >=100; Query OK, 3 rows affected (0.06 sec) mysql> select * from employee; Empty set (0.00 sec)
广告