当前位置:网站首页>Embedded database development programming (V) -- DQL

Embedded database development programming (V) -- DQL

2022-07-05 05:07:00 Light chasing rain

One 、 Data sets

 Insert picture description here

Two 、 Query log

select field1,field2,…fieldn… from Table name [where Conditions ]
select*from Table name [where Conditions ]

3、 ... and 、 Query non duplicate records

  • select distinct Field from Table name
  1. select distinct name from students;//4 Query students with different names ;
  2. select distinct name,age from students;// Query students with different names and ages
  • distinct Must be placed at the beginning
  • distinct You can only use fields that need to be de duplicated
  • distinct When removing multiple fields , The meaning is : Only when several fields are repeated at the same time can they be filtered .

 Insert picture description here

Four 、 Conditions of the query

select Field from Table name where Conditions ; select*from student where sex=' male ’and age>20; // Query gender is male , And older than 20
where The following conditions can be used >、<、>=、<=、!= And other comparison operators , Between multiple conditions, you can use or、and And so on

 Insert picture description here
 Insert picture description here
 Insert picture description here
 Insert picture description here

5、 ... and 、 Sort and limit

5.1 Sort

 Insert picture description here
 Insert picture description here

5.2 Limit

 Insert picture description here

6、 ... and 、 polymerization

 Insert picture description here

6.1 Aggregate functions

 Insert picture description here
 Insert picture description here
 Insert picture description here

7、 ... and 、 Multi-table query

 Insert picture description here

8、 ... and 、 Table joins

 Insert picture description here
 Insert picture description here

 Insert picture description here

原网站

版权声明
本文为[Light chasing rain]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050456185782.html