MySQL DELETE命令用于从表中删除行。它与WHERE子句一起使用。
语法
DELETE From Table_name WHERE Condition;
示例
在下面的示例中,我们已经删除了表格“employee”中id >= 100的行。
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)