- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we delete multiple rows from a MySQL table?
We can use DELETE statement along with a WHERE clause, which identifies those multiple rows, to delete multiple rows from MySQL table.
Example
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 query above will delete multiple rows because WHERE clause identify two rows having id > 2 from table ‘names’.
mysql> Select * from names; +------+-----------+ | id | name | +------+-----------+ | 1 | Rahul | | 2 | Gaurav | +------+-----------+ 2 rows in set (0.00 sec)
- Related Articles
- How can we delete all rows from a MySQL table?
- How can we delete a single row from a MySQL table?
- Delete multiple entries from a MySQL table
- How can we delete a MySQL stored function from the database?
- How can you delete a table from a database in MySQL Python?
- Delete more than one rows from a table using id in MySQL?
- How can we remove a column from MySQL table?
- Delete only some rows from a table based on a condition in MySQL
- How can we delete an existing MySQL table by using PHP script?
- How can you delete a record from a table using MySQL in Python?
- Delete only specific rows in a table with MySQL
- How can we drop UNIQUE constraint from a MySQL table?
- How can we set PRIMARY KEY on multiple columns of a MySQL table?
- How can I delete MySQL temporary table?
- How can we get randomly different set of rows or values each time from MySQL table?

Advertisements