MySQL--2 Data manipulation

Source: Internet
Author: User

#查询
Select From table name
Cases:
Select
from students;

#增加
Full column insert: INSERT into table name values (...)
Cases:
INSERT into students values (0, "Huang Rong", ' 1990-01-01 ', 0,0);

Default insert: INSERT into table name (column 1,...) VALUES (value 1,...)
Cases:
INSERT INTO students ("name", "Gender") VALUES ("Guo Jing", 1);

Insert multiple data at the same time: INSERT into table name values (...), (...) ...;
Cases:
INSERT into students values (0, "Little Dragon Girl", "1992-02-03", 0,0), (0, "Yang over", "1991-01-01", 1,0);

or INSERT into table name (column 1,...) VALUES (value 1,...), (value 1,...) ...;
Cases:
INSERT INTO students ("name", "Gender") VALUES ("Eagle", 1), ("Guo Yan", 0);

#Mysql can insert multiple data at the same time, Mysql-specific features.

#修改
Update table name set column 1= value 1,... Where condition
If the Where condition is not added, all columns are modified;

Cases:
Update students set birthday= "1980-02-01" where Name= "Guo Jing";

#修改多个values:
Update students set name= "Rong Son" birthday= "1988-01-01" where Name= "Huang Rong";

#删除
#物理删除
Delete from table name where condition
Example: Delete from students where id=5;

#逻辑删除

Update students isdelete=1 where ...; Add isdelete column, default value is 0, delete change value to 1
Cases:
Update students isdelete=1 where id=6;

Query only query isdelete=0 data to achieve the deletion effect
SELECT * from students where isdelete=0;

MySQL--2 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.