MySQL (6): Data manipulation

Source: Internet
Author: User

1. Create data (insert data)

(1) INSERT INTO Tab_name(field list) values(Value list)

(2) If you need to set values for all fields when inserting, you can omit the field list. Requirements are the order of values and should be consistent with the order of the fields in the table.

INSERT into Tab_name values (Value list)

2. Query data (get data)

Select (Field list) from Tab_name query criteria ;

Field list, you can use * instead, representing all the fields ;

The query criteria can be omitted, indicating that all records are obtained. equivalent to where 1; (1 means always set, equivalent to default )

Conditional query: filter out a score greater than 72

SELECT * from Exam_student where fengshu>=72; (where + query condition )

3. Delete data

Delete from tab_name condition ; (remove irreversible, all conditions more stringent )

The deletion needs to strictly give the condition logically, otherwise it is easy to cause the data to operate incorrectly, resulting in loss. (where syntax can not, but logically can have)

4. Modify the data

Update tab_name SET field = new value, .... conditions, (logically with conditions)

MySQL (6): Data manipulation

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.