图书管理系统有三张表 读者表 图书表 借阅表,查询计算机专业的借书数量最多的读者名称

读者表(借书证号,姓名,性别,出生年月,专业,读者类型)
图书表(IBSN,书名,作者,出版社,价格,总数量,库存数量,图书类型)
借阅表(ID,借书证号,IBSN,借书时间,到期时间,借书数量,还书时间)

用select 查询‘计算机’专业的借书数量最多的读者信息????
查询读者类型为02的性别为女的读者信息的平均借书数量???

第1个回答  2011-12-20
select *
from 读者表
where 专业='计算机' and 借书证号 in ( select 借书证号 from 借阅表 where max(结束数量) )

select avg(借书数量)
from 借阅表
where 借书证号 in (select 借书证号 from 读者表 where 性别='女' and 读者类型='02')追问

第一个运行不出来,第二个可以运行、。

追答

select *
from 读者表
where 专业='计算机' and 借书证号= ( select 借书证号 from 借阅表 where max(结束数量) )

第2个回答  2011-12-27
elect *
from 读者表
where 专业='计算机' and 借书证号 in ( select 借书证号 from 借阅表 where max(结束数量) )

select avg(借书数量)
from 借阅表
where 借书证号 in (select 借书证号 from 读者表 where 性别='女' and 读elect *
from 读者表
where 专业='计算机' and 借书证号= ( select 借书证号 from 借阅表 where max(结束数量) )
第3个回答  2012-01-02
select (select xm from dzb b where b.jszh=a.jszh)
as xm from jyb a where jszh in (select jszh from dzb where zy='计算机')
group by jszh having sum(jszh)=(select max(hj) from (select jszh,sum(jssl) as hj from jyb
where jszh in(select jszh from dzb where zy='计算机')group by jszh )as hjsl)本回答被提问者采纳
相似回答