Easy to get started with MySQL-learning notes-Chapter 1 inserting, updating, and deleting data

Source: Internet
Author: User
ArticleDirectory
    • 11.1.1 insert data for all fields in the table
    • 11.1.2 insert data for specified fields in the table
    • 11.1.3 insert multiple data records at the same time
    • 11.1.4 insert query results into the table
11.1 insert data 11.1.1 insert data for all fields in the table

1. No specific field name is specified in the insert statement.

Insert into table name values (value 1, value 2... Value n)

2. List all fields in the insert statement

Insert into Table Name (attribute 1, attribute 2... Attribute N) values (value 1, value 2... Value n)

11.1.2 insert data for specified fields in the table

Insert into Table Name (attribute 1, attribute 2, attribute 3) values (value 1, value 2, value 3)

11.1.3 insert multiple data records at the same time

Insert into Table Name (attribute 1, attribute 2... Attribute N) values (value 1, value 2... Value n ),

(Attribute 1, attribute 2... Attribute N) values (value 1, value 2... Value n ),

...

(Attribute 1, attribute 2... Attribute N) values (value 1, value 2... Value N );

Unique to MySQL

11.1.4 insert query results into the table

Insert into Table Name (attribute 1, attribute 2... Attribute N)

Select attribute list from table name 2 Where condition expression

 

Use MySQL;

Create Table user1 (User char (16) not null );

Insert into user1 (User) Select User from user;

11.2. Update Data

Update table name

Set property 1 = value 1, property 2 = value 2 ,...

Where condition expression;

11.3 delete data

Delete from table name [condition expression];

 

 

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.