MySQL Data manipulation

Source: Internet
Author: User

1. Inserting a single row of data

INSERT into table_name SET

< field 1>= value 1,

< field 2>= Value 2,

< field n>= value N;

INSERT into T1 SET

Id=1,

Name= ' Zhangsan ',

sex= ' F ';

2. Inserting multiple rows of data

INSERT into table_name

[(Field 1, Field 2, field N)]

VALUES

(value 1, value 2, Value N), (value 1n, value 2n, value 3n);

3. Inserting query results into a table

INSERT into table_name1

(Field 1, Field 2, field N)

SELECT field A, field B, field C from

Table_name2

[WHERE condition];

4. Updating data

UPDATE table_name1 SET

field 1= value 1, field 2= value 2, field n= value n

[WHERE condition];

UPDATE T1

SET

Name= ' Tom '

WHERE

id=2;

Delete data

DELETE from table_name

[WHERE <condition>];

Thing operation

Using tables in the INOODB data engine to support thing operations

By default, MySQL turns on auto-commit

Regin Open a Thing

Rollback rolling back a thing

Commit Commit a thing

MySQL Data manipulation

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.