文档来源为:从网络收集整理.word版本可编辑.欢迎下载支持.
基础题
1、查询读者中姓 杜 的人的所有信息 select * from 读者
where 姓名 like '杜%'
2、查询 扬州大学 所有读者的平均年龄 select avg(年龄) from 读者
where 单位='扬州大学'
3、查询借阅了多于3本书的读者姓名和借书证号 select 姓名,借书证号 from 读者,借阅
where 读者.借书证号=借阅.借书证号 and 借阅.图书编号>3 4、查询 宁静 所借书的书名和借书日期 select 书名,借书日期 from 图书,借阅,读者
where 读者.借书证号=借阅.借书证号 and 图书.图书编号=借阅.图书编号and 读者.姓名='宁静'
5、查询读者最喜爱的3种图书分类号,即借阅表中出现最多的3类图
书分类号
select top 3 分类号 from 图书,借阅
文档来源为:从网络收集整理.word版本可编辑.欢迎下载支持.
where 图书.图书编号=借阅.图书编号 group by 分类号 order by 图书编号 desc
6、查询与 宁静 同一单位的读者的详细信息 select * from 读者 where 单位 in (select 单位 from 读者
where 姓名='宁静')
7、查询图书单价在20-35之间的图书的详细信息 select * from 图书
where 单价>20 and 单价 <35
8、按图书分类号分类汇总,求各类图书的平均价格和最低价格 select avg(单价),min(单价) from 图书 group by 分类号
9、查询年龄在35岁以上的女性读者的姓名 select 姓名 from 读者
where 年龄>35 and 性别='女'
相关推荐: