Simple Method for deleting a record in mysql delete

Source: Internet
Author: User
Tags mysql delete mysql tutorial

The Simple Method for deleting a record in mysql is the simplest entry level. Let's take a look at how to delete a record using mysql SQL statements.

The Simple Method for deleting a record in the mysql tutorial is the simplest entry level. Let's take a look at how to delete a record using mysql SQL statements.

Mysql> delete from table name where id = 1;

Query OK,

In this way, you can delete it,

If you and php tutorial mysql configuration, you only need to use php to connect to the database tutorial and use php mysql_query ("delete from table name where id = 1"); then you can delete it.

<? Php
$ 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 );
?>

Next, let's take a look at the mysql delete syntax.

Delete data from a database
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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.