我有一个数据库模式:
member(memb_no, name, age)
book(isbn, title, authors, publisher)
borrowed(memb_no, isbn, date)
这是问题:
对于每个出版商,打印出借过该出版商五本书以上的成员的姓名。
我该如何为此编写查询?
以下是我的尝试:
Select B.publisher,
M.memb_no, M.name
From book as B,
member as M,
borrowed as R
Where M.memb_no = R.memb_no and B.isbn = R.isbn and R.isbn in
(select B.publisher, count (R.isbn)
from borrowed as R and book as B
where B.isbn = R.isbn
group by B.publisher
having count >5);
请指出错误并解释。
试试这个:
避免性能损失的提示:
您的代码中的语法错误位于:
应该是