SQL——分组操作符与聚集函数(数据统计2)

任务描述: 

本关使用的关系为printer(model,color,type,price)

表示的含义是

model:打印机型号;

color:是否彩色, T 彩色,F 黑白

type:类型,ink-jet 表示喷墨, laser 表示激光;

price:单价

编程要求:

1.统计激光彩色打印机有多少种型号;

select count(model) from printer where type='laser' and color='T'

2.找出最便宜的喷墨打印机价格。

select min(price) from printer where type='ink-jet'

3.找出最贵的激光打印机型号和价格。

select model,price from printer where price=(select max(price) from printer where type='laser')

猜你喜欢

转载自www.cnblogs.com/junfblog/p/12766377.html
今日推荐