Suppose you are given a relation grade points that provides conversion from letter grades in the takes
Question:
Suppose you are given a relation grade points that provides conversion from letter grades in the takes relation to numeric scores; for example, an “A” grade could be specified to correspond to 4 points, an “A−” to 3.7 points, a “B+” to 3.3 points, a “B” to 3 points, and so on. The grade points earned by a student for a course offering (section) is defined as the number of credits for the course multiplied by the numeric points for the grade that the student received.
Given the preceding relation, and our university schema, write each of the following queries in SQL. You may assume for simplicity that no takes tuple has the null value for grade.
a. Find the total grade points earned by the student with ID '12345', across all courses taken by the student.
b. Find the grade point average (GPA) for the above student, that is, the total grade points divided by the total credits for the associated courses.
c. Find the ID and the grade-point average of each student.
d. Now reconsider your answers to the earlier parts of this exercise under the assumption that some grades might be null. Explain whether your solutions still work and, if not, provide versions that handle nulls properly.
Step by Step Answer:
Database System Concepts
ISBN: 9780078022159
7th Edition
Authors: Abraham Silberschatz, Henry F. Korth, S. Sudarshan