简单查询

分组查询

查询汽车表中,每个系列汽车的数量
 select brand,count(*) from car group by brand



去该系列价格平均值大于40的系列代号
select brand from car group by brand having avg(price)>40


取该系列油耗最大值大于8的系列代号

select brand from car group by having max(oil)>8


去重查询
select distinct brand from car

分页查询

select*from car limit 0,10

聚合函数
select cout(*) from car  有多少条信息
select avg(code) from car  平均值
select max(price) from car  最大值
select min(price) from car  最小值
select sum(price) from car 总格价格


离散查询

select *from car where price=30 or price=40 or price=50 or price=60

select * from car where price not in(30,40,50,60)

范围查找 关键字 between 之间的

select *from car where price between 40 and 60

 

posted on 2016-10-17 16:26  奔跑的葛根  阅读(140)  评论(0)    收藏  举报

导航