我想写这些查询
到目前为止我写的查询不适用于第一个任务
SELECT
name
FROM
students
INNER JOIN issued ON students.rollno = issued.rollno
GROUP BY
issued.rollno
HAVING
COUNT( issued.rollno )> 2
答案 0 :(得分:0)
尝试这些查询
select s.name from students s
left join issued i on (s.rollno = i.rollno)
left join bookcopy bc on (i.copyid = bc.copyid)
left join books b on (bc.bookid = b.bookid)
left join category c on (b.catid = c.catid and c.catname = 'Poetry')
where c.catid is null
select s.name, count(*) as from students s
left join issued i on (s.rollno = i.rollno)
group by s.name
having count(*) > 5
select s.name, b.title, a.authorname, i.issuedate from students s
left join issued i on (s.rollno = i.rollno)
left join bookcopy bc on (i.copyid = bc.copyid)
left join books b on (bc.bookid = b.bookid)
left join author a on (b.authorid = a.authorid);