Inquire
Querying all Columns
SELECT * from table name;
Cases:
SELECT * from Classes;
Querying a specified column
You can use as to specify an alias for a column or table
Select column 1, column 2,... from table name;
Cases:
Select Id,name from Classes;
Increase
Note: The primary key column is autogrow, but requires a placeholder for full column insertion, typically using 0, and the actual data will prevail after the insert succeeds
Full column Insert: The order of values corresponds to the order of the fields in the table
Insert into table name values (...)
Cases:
INSERT into students values (0, ' Guo Jing ', 1, ' Mongolia ', ' 2016-1-2 ');
Partial column insertion: The order of values corresponds to the given column order
Insert into table name (column 1,...) VALUES (value 1,...)
Cases:
INSERT into students (Name,hometown,birthday) VALUES (' Huang Rong ', ' Peach Island ', ' 2016-3-2 ');
The above statement can insert a row of data into a table at a time, and you can insert multiple rows of data at once, which can reduce communication with the database
Full column multiple row inserts: The order of values corresponds to the given column order
Insert into table name values (...), (...) ...;
Cases:
Insert into classes values (0, ' Python1 '), (0, ' python2 ');
Insert into table name (column 1,...) VALUES (value 1,...), (value 1,...) ...;
Cases:
INSERT into students (name) values (' Yang Kang '), (' Yang over '), (' Little Dragon Girl ');
Modify
Update table name set column 1= value 1, column 2= value 2 ... where condition
Cases:
Update students gender=0,hometown= ' tomb ' where id=5;
Delete
Delete from table name where condition
Cases:
Delete from students where id=5;
Tombstone is essentially a modification operation
Update students set isdelete=1 where id=1;
MySQL basic operation of the increase and deletion check