MySQL Delete Data
- Delete query is used to delete desired rows from table.
- To delete all the rows from table:
- It will delete all the rows that satisfy the condition:
DELETE FROM tableName;
DELETE FROM tableName WHERE conditions;
We have following table with us-
- Now we have to delete data from the above table using following code:
$query="DELETE FROM employee WHERE name='peter'";
After running the program, the table will appear as following:
- Above program will delete the row/rows in which have 'peter' as the value of column 'name'.