Thursday, February 16, 2012

Rozenshtein question 3(sql cookbook)

alternative for question 3 - find student taking only one particular course

select * from student s  inner join take t
on t.sno = s.sno and t.cno = 'CS112'
where  exists
(
select t2.sno,count(*)
from take t2
where t2.sno = t.sno
group by t2.sno
having count(*) = 1
)

the books answers are good, though

No comments:

Post a Comment