Assume that the database has four tables. Student(SSN, SName, DOB, Major) , Grad
ID: 3664455 • Letter: A
Question
Assume that the database has four tables. Student(SSN, SName, DOB, Major) , Grade(SSN, CNo, Grade(0,1,2,3,4)) and Course table(CNo,CName, Credit Hour), Prerequisite(CNo, PreCNo);
Student and couse data ae given in the following SQL statements
a. Accept a number n as user input with SQL*Plus telling top n%.
b. In a loop get the SName and GPA of the top n% people with respect to GPA.
c. Store the SName and GPA in the TOP_GPA table.
d. Assume that two people may have the same GPA. If one is listed then the other must also be listed.
e. At least one student need to be reported.
(fraction is rounded up at 5 and rounded off below 4) If there are number of students having the same GPA the cut off line should not be in the middle of these students. In other word if you include one of them you must include all of them.
Report top 5%, 30%, 50% students in term of GPA
Explanation / Answer
SQL query to accept a number n as user input with SQL telling top n% students with respect to GPA:
To store the SName and GPA in new table TOP_GPA, we use the following SQL query:
So, when we insert n values as 5, 10, 30 in the above queries at defined positions, we get our results.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.