Use the DELETEFROM statement to delete records from a database table. Syntax DELETEFROMtable_nameWHEREcolumn_namesome_value Note: SQL is case insensitive. DELETEFROM is equivalent to deletefrom. In order for PHP to execute the preceding statement, we must use mysql_qu
Mysql tutorial DELETE data SQL statement usage DELETE FROM statement is used to DELETE records FROM the database table. Syntax delete from table_name WHERE column_name = some_value Note: SQL is case insensitive. Delete from is equivalent to delete from. In order for PHP to execute the preceding statement, we must use mysql_qu
How to delete a data SQL statement in the mysql tutorial
The delete from statement is used to DELETE records FROM database tables.
Syntax
Delete from table_name WHERE column_name = some_value
Note: SQL is case insensitive. Delete from is equivalent to delete from.
In order for PHP to execute the preceding statement, we must use mysql_query (function. This function is used to send queries and commands to SQL connections.
Example
Earlier, we created a table named "Person" in this tutorial. It looks like this:
FirstName LastName Age
Peter Griffin 35
Glenn Quagmire 33
The following example deletes all records whose LastName is 'grigin' in the "Person" table:
$ Con = mysql_connect ("localhost", "peter", "abc123 ");
If (! $ Con)
{
Die ('could not connect: '. mysql_error ());
}
Mysql_select_db ("my_db", $ con );
Mysql_query ("delete from Person WHERE LastName = 'grigin '");
Mysql_close ($ con );
?>
After this deletion, the table is as follows:
FirstName LastName Age
Peter Griffin 35
Note: More exciting articles, please pay attention to SanlianProgramming TutorialTopic.