*1
图书(书号,书名,价格,出版社)
读者(卡号,姓名,年龄,所属单位)
借阅(书号,卡号,借阅日期)
1 查询书号为tp0103被借阅次数。
2 查询工作单位在计算机系的读者姓名和借阅次数。
3 查阅年龄50以上借阅次数2次以下的读者信息。
4 查询从来没被借阅的图书信息。
select COUNT(*)as num from b_r where b_r.bno='tp0103'
select reader.rname,COUNT(*)as num from reader,b_r where reader.rwork='计算机系'and b_r.card=reader.card group by reader.rname
select * from reader,(select b_r.card from b_r group by b_r.card having COUNT(*)<2)t where reader.card=t.card and age>50
select * from book where book.bno not in (select b_r.bno from b_r group by b_r.bno having COUNT(bno)>0)
完整实验1-8链接
实验数据库1-8