Delete a row in MySQL


Delete a row in MySQL
Delete a row in MySQL

Hi friends, in this tutorial you will learn how to delete a row in MySQL. Actually, there are two ways by which you can perform the delete operations in MySQL. In order to do so, you must have some data inside the table of your database. Suppose, I have table ‘employee‘ in my database as shown below

Also read, How to insert HTML form data into MySQL database using PHP

Delete a row in MySQL

Now, you can delete that data from the table by directly clicking on the delete button as shown in the above image.

If you want to delete a row using PHP then you have to display all the data from the table of your MySQL database and then attach a delete button. Now, you can use the PHP $_GET method to delete a row from a particular table of the database. If you do not know how to perform CRUD operations in PHP then please go through the above-mentioned link.

Also, you can delete a row with the help of SQL query as given below

Syntax of the delete query:-

DELETE from Table Name WHERE column name=value;

Now, I will delete the employee data from the employee table as shown below

DELETE from employee WHERE name="Robin";

OR

DELETE from employee WHERE id=4;

Conclusion:- I hope this will help you to understand the concept. If there is any doubt then please leave a comment below.


Leave a Comment