嵌入式数据库开发编程(五)——DQL
一、数据集

二、查询记录
select field1,field2,…fieldn… from 表名 [where 条件]
select*from 表名 [where 条件]
三、查询不重复的记录
- select distinct 字段 from 表名
- select distinct name from students;//4查询名字不相同的学生;
- select distinct name,age from students;//查询名字和年龄同时不同的学生
- distinct必须放在最开头
- distinct只能使用需要去重的字段进行操作
- distinct去重多个字段时,含义是:几个字段同时重复时才会被过滤。

四、条件查询
select字段from表名where条件; select*from student where sex='男’and age>20; //查询性别是男,并且年龄大于20
where后面的条件可以用>、<、>=、<=、!=等多种比较运算符,多个条件之间可以用or、and等逻辑运算符




五、排序和限制
5.1 排序


5.2 限制

六、聚合

6.1 聚合函数



七、多表查询

八、表连接




浙公网安备 33010602011771号