码迷,mamicode.com
首页 > 其他好文 > 详细

简单查询练习

时间:2016-03-13 17:38:13      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:

select*from fruit#查询此表所有内容

select ids,name from fruit#查询序列和名字这两列

select*from fruit where ids=k007 #查找k007信息

select*from fruit where price=2.4and source=烟台

select*from Car where name like 奥迪%

select*from car where name like 奥迪_%
 
select*from chinastates where areaname like __区%#%为只要数据里包含此字段就查出来,_为占一个位置

排序查询

select*from chinastates order by areacode desc

select*from fruit order by price,source

统计查询

 select count(*)from nation

select count(areacode)from chinastates

select max(price)from car;

select min(price)from car;
 
select avg (price)from car;
 
select sum(price)from car;

select max(price),min(price),avg(price) from car #如果要一起查的话只有这样

分组查询

select code,brand,count(*)from car group by brand

select  price,count(*), max(price) from fruit group by price 

分页查询 

select *from car limit 3,5 #跳过几条数据取几条

 

简单查询练习

标签:

原文地址:http://www.cnblogs.com/crazy-zw/p/5272395.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!