prateeksharma

DBMS 51

Feb 26th, 2020
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1.  
  2. select * from student;
  3. select * from college;
  4. select * from apply;
  5.  
  6. select sid ,sname from student where sid in(select sid from apply where major='CS');
  7.  
  8.  
  9. select sid,sname from student where sizehs in(select sizehs from student where sname in('Jay'));
  10.  
  11. select sid,sname from student where sizehs in(select sizehs from student where sname in('Jay')) and sname not in('Jay');
  12.  
  13. select sid,sname,gpa from student where gpa not in(select gpa from student where sname in('Irene'));
  14.  
  15. select cname from apply where sid in(select sid from student where sname like('J%'));
  16.  
  17.  
  18. select major from apply where sid in(select sid from student where sname in('Irene'));
  19.  
  20. select sid,major from apply where major in(select major from apply where sid in(select sid from student where sname in('Irene')));
  21.  
  22. select sid,major from apply where major in(select major from apply where sid in(select sid from student where sname in('Irene'))) and sid not in(select sid from student where sname='Irene');
  23.  
  24.  
  25. select count(distinct(cname)) from apply where sid in(select sid from student where sname in('Jay'));
  26.  
  27. select sid from apply group by sid having count(cname)>=
  28. (select count(cname) from apply where sid in(select sid from student where sname in('Jay')));
  29.  
  30.  
  31. select * from student where sid in(select sid from apply where major in(select major from apply where major in 'CS'));
  32.  
  33. select * from student where sid in(select sid from apply where major in(select major from apply where major in 'EE'));
  34.  
  35.  
  36. select cname from college union select sname from student;
  37.  
  38.  
  39. select distinct sid from apply minus select distinct sid from apply where cname='Stanford';
  40.  
  41. select distinct sid from apply where cname='Stanford' intersect select distinct sid from apply where cname='Berkeley';
  42.  
  43. select sname from student where sid in(select sid from apply where cname in(select distinct cname from apply where sid='987'));
  44.  
  45.  
  46. select * from college c1 where exists(select *from college c2 where c1.state=c2.state and );
Add Comment
Please, Sign In to add comment