Question: CREATE TABLE Departments (DeptCode CHAR(3) PRIMARY KEY, DepartName VARCHAR2(25), College VARCHAR2(25)); CREATE TABLE Students (ID CHAR(3) PRIMARY KEY, FName VARCHAR2(25), LName VARCHAR2(25), Status VARCHAR2(25), Majorcode
CREATE TABLE Departments (DeptCode CHAR(3) PRIMARY KEY, DepartName VARCHAR2(25), College VARCHAR2(25)); CREATE TABLE Students (ID CHAR(3) PRIMARY KEY, FName VARCHAR2(25), LName VARCHAR2(25), Status VARCHAR2(25), Majorcode CHAR(3) REFERENCES Departments(DeptCode), GPA NUMBER (4,2), AdmittedDate DATE); INSERT INTO Departments VALUES('100','Computer Science','INF'); INSERT INTO Departments VALUES('101','Business Informatics','INF'); INSERT INTO Departments VALUES('102','Mathematics','AS'); INSERT INTO Departments VALUES('103','Accounting','COB'); INSERT INTO Students VALUES ('101','Tom','Smith','Freshman','103',3.51,'3-May-2015'); INSERT INTO Students VALUES ('104','Dori','Negrino','Sophomore','101',2.98,'2-Jul-2015'); INSERT INTO Students VALUES ('923','Horst','Keller','Junior','101',3.49,'21-Jul-2013'); INSERT INTO Students VALUES ('489','Sascha','Kruger','Junior','100',4.00,'21-Apr-2014'); INSERT INTO Students VALUES ('519','Lisa','Miller','Freshman','101',2.79,'21-Oct-2015'); INSERT INTO Students VALUES ('911','Toni','Gaddis','Senior','103',3.68,'1-Nov-2011'); INSERT INTO Students VALUES ('636','Shawn','Lauriat','Freshman','102',3.93,'3-May-2015'); INSERT INTO Students VALUES ('671','Richard','Klein','Senior','103',3.72,'1-Jun-2015'); INSERT INTO Students VALUES ('727','Cathy','Manning','Freshman','100',3.92,'3-May-2015'); INSERT INTO Students VALUES ('453','Peter','Burrows','Sophomore','102',3.34,'2-Sep-2014'); INSERT INTO Students VALUES ('441','Eric','Grover','Freshman','103',3.91,'1-Jan-2017');
5. List the College with the least average GPA.
6. List the students with GPAs higher than the total average GPA.
7. List the Name of the student with the highest GPA.
8. List the college of the student with the highest GPA.
9. List Number of days elapsed since admission for each student.
10. How many majors does each college have.
11. List the maximum GPA by student status.
For each question could you please include the sql code you used.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
