select name , room
from class
where room="R128"
or name in (select cname
from enrolled
group by cname
having count(*)>=5;
);
Also this query seems that it will take more time as it is finding out whether each of its name is present among any of the cname as mentioned. Can you do any better?