SQL语言数据查询

来源:百度知道 编辑:UC知道 时间:2024/07/06 19:47:21
图书(书号,书名,作者编号,价格,出版社编号)
作者(编号,姓名,电话)
出版社(编号,出版社名称,地址)
根据上面基本表的信息完成下列查询。
1 统计各出版社出版图书的数量。
2 列出多人合著的图书书号和价格。
3 列出高教出版社出版的最贵图书信息。
4 列出所有图书都是30元以上的出版社名称。

1、select count(书号),出版社编号 from 图书 group by 出版社编号
3、select t.max(价格) from 图书 t,(select 编号 from 出版社 where
出版社名称 = 高教出版社) s where t.出版社编号 = s.编号
4、select s.出版社名称 from 图书 t,出版社 s where t.出版社编号 =
s.编号 and t.价格 > 30

第2题不是很明白意思

1.
select b.出版社名称,count(*) from 图书 a,出版社 b
where a.出版社编号=b.编号
group by b.出版社名称

都不知道他的数量是怎么蹦出来的,看了第一个题目马上没心情了

图书 book 作者 author 出版社 compane
1
select compane.cid,count(book.bid)
from compane inner join book
on compane.cid=book.cid
group by conpane.cid;

2
select book.bid,book.price count(author.aid) from
book inner join author on book.aid=author.aid
group by book.bid,book.price
having count(author.aid)>1;

3
select bid,bname,max(price) from book
where cid=
(select cid from compane where cname='高教出版社出版');

4
select name from compane
where cid not in
(select distinct cid from