首页 > 其他 > 详细

简单查询练习

时间:2016-03-13 17:35:52      阅读:140      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!