#查询
Select
From table name
Cases:
Selectfrom 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