Data manipulation language, DML, additions and deletions

Source: Internet
Author: User

DML (data manipulation language); manipulation language

Insert data:
Insert data: Only one row of data can be inserted at a time
INSERT into table name (column name 1, column name 2, column name 3 ...) VALUES (value1, value2, value3 ...); Value corresponds to the number of columns one by one.
#插入一行:
INSERT into T_student (id,name,email,age) VALUES (null, ' Wang er ', ' [email protected] ', 23)

#插入部分值:
Inseryt to T_student (name, age) VALUES (' Zhao Si ', 40)


#插入多条数据: MySQL only
INSERT into T_student (name) SELECT name from T_student

UPDATE statement:
Updatae table Name set column Name 1 = value1, column name 2 = value2 ..., Whereid = 4
Note: If there is no where condition, all will be modified
#修改一个
UPDATE t_student set email= ' [email protected] ' WHERE id = 1

#修改多个

UPDATE t_student set email= ' [email protected] ', name= ' xiaoming ' WHERE id = 1

#注意不可以修改主键, not not. If you change the primary key, you won't find it next time.

Delete statement:
Delete from t_student WHERE [condition], deleting qualifying data
If there is no where, the data is emptied

Data manipulation language, DML, additions and deletions

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.