prateeksharma

dbms_lab_assign

Jan 23rd, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.37 KB | None | 0 0
  1. select sname, dob from student;
  2.  
  3. select sname from student where gpa>3.7;
  4.  
  5. select sname from student where sizehs>=1000 and dob>'31-dec-1996';
  6.  
  7. select sname from student where gpa>2.9 and gpa<3.9;
  8.  
  9. select * from college where state='MA';
  10.  
  11. select sname from student where gpa>2.0 and gpa<3.5;
  12.  
  13. select sname from student where dob>'1-jul-1996' order by dob asc;
  14.  
  15. select sid,cname,decision from apply where decision='Y';
  16.  
  17. select sid,cname from apply where cname='Stanford';
  18.  
  19. select cname from college where enrollment>10001;
  20.  
  21. select cname from college where state!='CA';
  22.  
  23.  
  24.  
  25.  
  26. create table Student(
  27. stID number(3),
  28. sName varchar2(15),
  29. GPA number(2,1),
  30. sizeHS number(4),
  31. DoB date
  32. )
  33. insert into Student values(123,'Amy',3.9,1000,'26-JUN-96');
  34. insert into Student values(234,'Bob',3.6,1500,'7-Apr-95');
  35. insert into Student values(345,'Craig',3.5,500,'4-Feb-95');
  36. insert into Student values(456,'Doris',3.9,1000,'24-Jul-97');
  37. insert into Student values(567,'Edward',2.9,2000,'21-Dec-96');
  38. insert into Student values(678,'Fay',3.8,200,'27-Aug-96');
  39. insert into Student values(789,'Gary',3.4,800,'8-Oct-96');
  40. insert into Student values(987,'Helen',3.7,800,'27-Mar-97');
  41. insert into Student values(876,'Irene',3.9,400,'7-Mar-96');
  42. insert into Student values(765,'Jay',2.9,1500,'8-Aug-98');
  43. insert into Student values(654,'Amy',3.9,1000,'26-JUN-96');
  44. insert into Student values(543,'Craig',3.4,2000,'27-Aug-98');
  45. select sName , DoB from Student;
  46. select sName from Student where GPA>3.7;
  47. select sName from Student where sizeHS>=1000 and DoB > '31 December, 1996';
  48. select sName from Student where GPA between 2.9 and 3.9;
  49. select * from Student;
  50. create table Apply(
  51. stID number(3),
  52. cName varchar2(10),
  53. major varchar(20),
  54. decision varchar2(2))
  55. insert into Apply values(123,'Standford','CS','Y');
  56. insert into Apply values(123,'Standford','EE','N');
  57. insert into Apply values(123,'Berkeley','CS','Y');
  58. insert into Apply values(123,'Cornell','EE','Y');
  59. insert into Apply values(234,'Berkeley','biology','N');
  60. insert into Apply values(345,'MIT','bioengineering','Y');
  61. insert into Apply values(345,'Cornell','bioengineering','N');
  62. insert into Apply values(345,'Cornell','CS','Y');
  63. insert into Apply values(345,'Cornell','EE','N');
  64. insert into Apply values(678,'Standford','history','Y');
  65. insert into Apply values(987,'Standford','CS','Y');
  66. insert into Apply values(987,'Berkeley','CS','Y');
  67. insert into Apply values(876,'Standford','CS','N');
  68. insert into Apply values(876,'MIT','biology','Y');
  69. insert into Apply values(876,'MIT','marine biology','N');
  70. insert into Apply values(765,'Standford','history','Y');
  71. insert into Apply values(765,'Cornell','history','N');
  72. insert into Apply values(765,'Cornell','psychology','Y');
  73. insert into Apply values(543,'MIT','CS','N');
  74. select stID,cName from Apply where decision='Y';
  75. select stID,cName from Apply where cName= 'Standford';
  76.  
  77.  
  78. select sName , DoB from Student;
  79. select sName from Student where GPA>3.7;
  80. select sName from Student where sizeHS>=1000 and DoB > '31 December, 1996';
  81. select sName from Student where GPA between 2.9 and 3.9;
  82. select sName from Student where GPA >2.0 and GPA<3.5;
  83. select sName from Student where DoB>'1 July,1996' order by DoB;
  84. select sName from Student2 where sizeHS>17000 and GPA<3.8;
  85. select * from Student2;
  86. select sName from Student2 where sName like ' ';
  87. select sName from Student2 where sName like 'H ';
  88. select sName from Student2 where sName like ' e e%';
  89. select sName from Student2 where sName like '%y';
  90. select * from Student2 order by GPA;
  91. select * from Student2 order by GPA asc , DoB desc;
  92. update Student2 set GPA=10*GPA/100+GPA;
  93. select * from Student2;
  94. update Student2 set GPA=GPA+1.5 where GPA<3.5 and sizeHS>1500;
  95. select * from Student2;
  96. delete from Student2 where GPA<3.2;
  97. select * from Student2;
  98.  
  99. select stID,cName from Apply where decision='Y';
  100. select stID,cName from Apply where cName= 'Standford';
  101. selct distinct major from Apply;
  102. select stID from Apply cName in ('Standford', 'Cornell', 'MIT');
  103. delete from Apply where cName = 'Standford';
  104. select * from Apply;
  105. create table College(
  106. cName varchar(15),
  107. state varchar(3),
  108. enrollment number(7))
  109. select * from College;
  110. select cName from College where state = 'MA';
  111. select cName from college where enrollment>10001;
  112. select cName from college where not state='CA';
  113. delete from College where cName = 'Standford';
  114. select * from College;
Add Comment
Please, Sign In to add comment