We can delete multiple rows from a MySQL table using the DELETE statement and a WHERE clause that identifies these multiple rows.
mysql> Select * from names; +------+-----------+ | id | name | +------+-----------+ | 1 | Rahul | | 2 | Gaurav | | 3 | Raman | | 5 | Ram | +------+-----------+ 4 rows in set (0.00 sec) mysql> DELETE from names WHERE id > 2; Query OK, 2 rows affected (0.04 sec)
The above query will delete multiple rows because the WHERE clause identifies two rows with id > 2 from table "names".
mysql> Select * from names; +------+-----------+ | id | name | +------+-----------+ | 1 | Rahul | | 2 | Gaurav | +------+-----------+ 2 rows in set (0.00 sec)
The above is the detailed content of How can we delete multiple rows from MySQL table?. For more information, please follow other related articles on the PHP Chinese website!