ASS5
ASS5
ASS5
Section : CA
Roll No. : 24
Assignment : 05
16. Find sID, sName, sizeHS of all students NOT from the
smallest HS
Ans. select sid,sname,sizehs from student where sizehs not in (select
min(sizehs) from student);
17. Find the name of the student who applies to all the colleges
where sID 987 has applied?(Hint: see Query Find IDs of
student applied to all colleges)
Ans. select sName from Student where SID in (select sID from Apply
where cName in (select cName from Apply where sID in (987)) group by
SID having count(distinct cName) = (select count(distinct cName) from
Apply where sID in (987)));
18. Find the college where all the students have applied.
Ans. select cName from College where (select count(distinct SID) from
Student)=(select count(distinct sID) from Apply where Apply.cName =
College.cName);
21. Give a list of all names including all names of colleges and
students.
Ans. select distinct sname from student union select distinct cname
from college;
24. Stanford decides not to take any student who has also
applied to its rival Berkeley turn their application decision to
N.
Ans. update apply set decision = 'N' where cname = 'Stanford' and sid in
(select sid from apply where cname = 'Berkeley');
25. Delete applications that are filed to the city ‘New York’.
Ans. delete from apply where cname in (select cname from college
where state = 'NY');