MySQL database to learn the operation of nine data

Source: Internet
Author: User

9.1 Inserting data records

1. Insert full or partial data records:

INSERT into table_name (field1,field2,field3,... fieldn)    VALUES (value1,value2,value3,... Valuen);

Field parameters (field1,field2,field3,... fieldn) can be omitted when inserting full data records.

Note: in a specific development, a field with a default value constraint does not need to insert a value in addition to a field in the autogrow constraint .

2. Insert more than one full or partial data record:

INSERT into table_name (field1,field2,field3,... fieldn)    VALUES (value11,value11,value21,... valuen1),          ( Value12,value22,value32,... valuen2),           ...          (value1m,value2m,value3m,... valuenm);

Field parameters (field1,field2,field3,... fieldn) can be omitted when inserting full data records.

3. Insert Query Results

INSERT into table_name1 (field11,field12,field13,... field1n)   SELECT (value1,value2,value3,... Valuen)        from Table_name2            WHERE ...;

  

9.2 Updating data records

UPDATE table_name    SET field1=value1,        field1=value1,        field1=value1,    "WHERE CONDITION";

  

9.3 Deleting data records

DELETE from table_name    "WHERE CONDITION";

  

MySQL database to learn the operation of nine 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.