1 //查询所有品牌为“大众”的车型 2 select * from t_car where version like '大众%' 3 4 //查询座位数不低于5座的车型 5 select version,seat from t_car where seat >= 5 6 7 //查询手动档中排量大于2的车型 8 select version,displacement from t_car where displacement > 2 9 10 //查询押金低于10000且租金低于300的车型 11 select version,price,earnestMoney from t_car where price < 300 and earnestMoney < 10000 12 13 //查询押金低于10000或租金低于300的车型 14 select version,price,earnestMoney from t_car where price < 300 or earnestMoney < 10000 15 16 //查询所有车型,并按租金从高到低排序 17 select * from t_car order by price desc 18 19 //统计车辆信息表中自动档和手动档车型的数 20 select gear,count(gear)数量 from t_car group by gear 21 22 //找出每个品牌车辆的最高租金、最低租金、平均租金和车辆数量 23 select brand,max(price),min(price),avg(price),count(brand) from T_car group by brand 24 25 //找出平均租金高于400的品牌 26 select brand,avg(price) as 平均租金 from t_car group by brand having avg(price) > 400 27 28 //列出所有自动档车型,分页显示,每页显示3条数据,分别写出第一页、第二页、第三页的SQL语句 29 select version,gear from t_car limit 0,3 30 select version,gear from t_car limit 3,3 31 select version,gear from t_car limit 6,3