mysql< adding, updating, and deleting data >

Source: Internet
Author: User

adding, updating, and deleting data Add Data

Add data to all fields in a table

INSERT into table name (field name 1, field Name 2, ...)

Values (value 1, value 2, ...);

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

Add data to a specified field in a table

INSERT into table name

SET field name 1= value 1[, field name 2= value 2, ...];

Add multi-day records at the same time

INSERT into table name [(Field name 1, field Name 2, ...)]

Values (value 1, value 2, ...), (value 1, value 2, ...),

... ...

(value 1, value 2, ...);

Update Data

UPDATE Table Name

SET Field Name 1 = value 1[, field Name 2 = value 2, ...]

[WHERE condition expression];

To update one or several records in a table, you need to use the WHERE clause to specify the criteria for updating the record.

If you do not use a WHERE clause, the specified fields of all records in the table are updated

All data: Update student set grade=80;

Delete Data

Delete from table name [where condition expression];

All data: delete from student;

mysql< adding, updating, and deleting data >

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.