MySQL DELETE Query

MySQL DELETE Data

DELETE‘ statement is used to delete the data from the database.

<?php

$sql="DELETE FROM table_name WHERE id=1";

$result= mysql_query($sql);

echo "Data Deleted Successfully";

?>

Here “WHERE” clause is used to define the particular data which you want to delete (‘id’ is the column name in the table which is unique).

If you do not use the ‘Where’ clause,then all the data from the table will be deleted. You can also use any column like ‘name, email-id etc.’ to signify the WHERE clause.


Leave a Reply

avatar
  Subscribe  
Notify of