MySQL Tutorial – MySQL DELETE command

MySQL Tutorial – MySQL DELETE command

The DELETE command is used to delete records in a table. The syntax of DELETE command:

DELETE FROM table_name WHERE [conditions];

Note: The where clause in the delete command specifies which records should be deleted. If you exclude the where clause all the records in the table will be erased.

Example of DELETE command:

DELETE FROM employee_record WHERE id = 4;

It will delete the record of employee with the id of 4.

Once you have encoded the command correctly, it will display a success message:

Ex. Query OK, 1 row affected (0.00 sec)

Note: If we excluded the where clause it will delete all the records of the employee.

, , ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.