Operation of MySQL Data

Source: Internet
Author: User

First, insert data record

1. Insert the full data record

INSERT into table_name

VALUES (Value1,value2......valuen);

2. Inserting part of a data record

INSERT into table_name (field1,field2,... FIELDN)

VALUES (Value1,value2......valuen);

3. Inserting more than one data record

INSERT into table_name

VALUES (VALUE11,VALUE21......VALUEN1),

(VALUE12,VALUE22......VALUEN2),

。。。

(Value1n,value2n......valuenn);

INSERT into table_name (field1,field2,... FIELDN)

VALUES (VALUE11,VALUE21......VALUEN1),

(VALUE12,VALUE22......VALUEN2),

。。。

(Value1n,value2n......valuenn);

4. Insert Query Results

INSERT into table_name1 (field11,field21,... fieldn1)

SELECT field21,field22,... fieldn2

From Table_name2 WHERE ...

Second, update the data record

1. Updating specific data records

UPDATE table_name

SET Field1=value1,

Field2=value2,

...

Fieldn=valuen

WHERE CONDITION;

2. Update so the data record

UPDATE table_name

SET Field1=value1,

Field2=value2,

...

Fieldn=valuen

Third, delete data records

1. Delete specific data records

DELETE from table_name

WHERE CONDITION;

2. Delete all data records

DELETE from TABLE_NAME;

Operation of MySQL Data

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.