1. Annotation syntax:--,#
2. The suffix is. sql files are database query files
3. Save the query
4. There's a name in the database that's called the field row.
crud Operations:
Create Creation (ADD)
Read reads
Update Modification
Delete Deletes
1. Add Data
INSERT into Info values (' p009 ', ' Zhang San ', 1, ' n001 ', ' 2016-8-30 12:9:8 ');
Add data to a specific column
Insert into Info (code,name) VALUES (' p010 ', ' John Doe ');
Handling of self-growing columns
INSERT into family values (' ', ' p001 ', ' data ', ' T001 ', ' data ', 1);
Insert into table name values (value)
2. Delete data
Delete all data
Delete from family
Delete a specific data
Delete from Info where code= ' p001 '
Delete from table name where condition
3. Modify the data
Modify all data
Update Info set name= ' Xu Yepeng '
Modify specific data
Update Info set name= ' LV Yongle ' where code= ' P002 '
Modify multiple columns
Update Info set name= ' LV Yongle ', sex=1 where code= ' p003 '
Update table name set the content to be modified where condition TNO =
4. Read data
(1) Simple read, query all columns (*) All rows (no add condition)
SELECT * FROM Info
(2) reading a specific column
Select Code,name from Info
(3) Conditional query
SELECT * from Info where code= ' p003 '
(4) Multi-criteria Query
SELECT * from Info where code= ' p003 ' or nation= ' n002 ' #或的关系
SELECT * from Info where sex=0 and nation= ' n002 ' #与的关系
(5) keyword query (fuzzy query)
Check all cars that contain Audi
SELECT * from car where name like '% Audi% '; #百分号% represents any number of characters
Check all the cars that start with ' crown '
SELECT * from car where name like ' Crown% ';
Query car Name The second character is ' horse '
SELECT * from car where name like ' _ Ma% '; #下划线_代表任意一个字符
(6) Sort query
SELECT * from Car order by powers #默认升序排列
SELECT * from Car order by powers #升序asc Descending desc
Rank by brand in ascending order, and then
SELECT * FROM car ORDER BY brand,price Desc
(7) Scope query
SELECT * FROM car where price9 () >40 and price<60
SELECT * from car where price between and 60
Basic operations on MySQL additions and deletions