(1). 找出姓李的读者姓名和所在单位。
select 姓名,单位 from 读者 where 姓名 like '李%'
(4).查找价格介于10元和20元之间的图书种类,结果按出版单位和单价升序排序。
select 分类号 from 图书 where 单价 BETWEEN 10 and 20 order by 出版单位,单价 asc
(5). 查找书名以计算机打头的所有图书和作者。
select 书名,作者 from 图书 where 书名 like '计算机%'
(6).检索同时借阅了总编号为112266和449901两本书的借书证号。
select 借书证号 from 借阅 where 总编号 in (112266,449901)
(8).找出李某所借图书的所有图书的书名及借书日期。
select 图书.书名,借阅.借书日期 from 图书,借阅 where 图书.总编号=借阅.总编号 and EXISTS (select * from 读者 where 借阅.借书证号=读者.借书证号 and 姓名 like '李%')
(9).查询1997年10月以后借书的读者借书证号、姓名和单位。
select 借书证号,姓名,单位 from 读者 where EXISTS (select * from 借阅 where 读者.借书证号=借阅.借书证号 and 借书日期>'1997-10-01')
(10).找出借阅了FoxPro大全一书的借书证号。
select 借书证号 from 借阅 where EXISTS (select * from 图书 where 借阅.总编号=图书.总编号 and 书名='FoxPro大全')
(12).查询1997年7月以后没有借书的读者借书证号、姓名及单位。
select 借书证号,姓名,单位 from 读者 where not EXISTS (select * from 借阅 where 读者.借书证号=借阅.借书证号 and 借书日期>'1997-07-01')
(1). 求科学出版社图书的最高单价、最低单价、平均单价。
select max(单价) 最高单价,min(单价) 最低单价, avg(单价) 平均单价 from 图书 where 出版单位='科学出版社'
(2). 求信息系当前借阅图书的读者人次数。
select count(*) 读者人次数 from 读者 where 单位='信息系' and exists (select * from 借阅 where 读者.借书证号=借阅.借书证号)
(3).求出各个出版社图书的最高价格、最低价格和册数。
select max(单价) 最高价格,min(单价) 最低单价, count(*) 册数 from 图书 group by 出版单位
(4).分别找出各单位当前借阅图书的读者人数。
select count(*) 读者人数,单位 from 读者 where exists (select * from 借阅 where 读者.借书证号=借阅.借书证号) group by 单位
(5).找出当前至少借阅了2本图书的读者及所在单位。
select 姓名,单位 from 读者 where (select count(*) from 借阅 where 读者.借书证号=借阅.借书证号) >1
(6).分别找出借书人次超过1人次的单位及人次数。
select 姓名,count(*) 人次数 from 读者 where exists (select * from 借阅 where 读者.借书证号=借阅.借书证号) group by 班级 HAVING count(*)>1
(7).找出藏书中各个出版单位的册数、价值总额。
select count(*) 册数,sum(单价) 总额,出版单位 from 图书 group by 出版单位