How to delete data rows in MySQL?
To delete certain records on a MySQL table:
DELETE FROM table_name [WHERE condition];
For example, we have table class
id | name | subject | score |
---|---|---|---|
1 | Anna | Math | 10 |
2 | Anna | CS | 9 |
3 | Jack | Math | 9 |
4 | Jill | CS | 6 |
5 | Will | CS | 8 |
6 | Jack | Geo | 10 |
7 | Anna | Geo | 4 |
Now we want to delete records of students who got score below 8:
DELETE FROM class WHERE score < 8;
The new table will be:
id | name | subject | score |
---|---|---|---|
1 | Anna | Math | 10 |
2 | Anna | CS | 9 |
3 | Jack | Math | 9 |
5 | Will | CS | 8 |
6 | Jack | Geo | 10 |
In TablePlus, you can edit and delete the data inline from the table view:
Don’t forget to commit changes (cmd + S) to the server.
New to TablePlus? It’s a modern, native tool with an elegant GUI that allows you to simultaneously manage multiple databases such as MySQL, PostgreSQL, SQLite, Microsoft SQL Server and more.
Not on Mac? Download TablePlus for Windows.
On Linux? Download TablePlus for Linux
Need a quick edit on the go? Download TablePlus for iOS.