PHP MySQL Delete

DELETEstatement is used to delete rows from a database table.

Syntax

DELETEFROM table_name

WHEREsome_column = some_value

Note: Please pay attention to the WHERE clause in the DELETE syntax. The WHERE clause specifies which records need to be deleted. If you want to omit the WHERE clause, all records will be deleted!

To learn more about SQL, please visit our SQL tutorial.


Example description

Let’s take a look at the data in our Myguests first:

6.png

Let’s delete the firstname=’Mary’ data

Run the program:

2.png

Let’s look at the data in the table again

Has been deleted successfully

【Remember】

1. Be sure to remember to add the where condition when deleting, otherwise the entire table will be cleared record of.

2. Be sure to back up, back up, back up before deleting important data.


Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!