delete data from MySQL database table

How to delete data from MySQL database table?

In this tutorial, you will learn how to delete existing data from a MySQL database table. Let’s see –

Here is some dummy existing data of the users table, and we will see how we can delete one of those.

dummy data of the users table

SQL query syntax for deleting data

DELETE FROM `table_name` WHERE condition;

The WHERE clause is used to define the condition that determines which record should be deleted.

Example

DELETE FROM `users` WHERE `user_id`=4;

The user whose user_id is 4 has been deleted.

the user whose user_id is 4 has been deleted