select*from fruit#查询此表所有内容 select ids,name from fruit#查询序列和名字这两列 select*from fruit where ids=‘k007‘ #查找k007信息 select*from fruit where price=‘2.4‘and 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 #跳过几条数据取几条
时间: 2024-11-20 19:11:56