You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can create a Threshold table in the database that has a n:1 relationship with the Course table. This makes the code cleaner and DRYer. It also makes it possible to add courses with more or less letter grades than the ones specified in the code.
My proposal would be for the Threshold table to have the following attributes: (id: int, name: varchar, threshold: double, course_id: int, grade: double). Most of these are self explanatory, but the grade column is for the number that gets used to calculate GPA.
The following SQL could be used for a lookup: SELECT grade FROM Threshold WHERE course_id = ? AND threshold <= ? ORDER BY grade DESC LIMIT 1
The text was updated successfully, but these errors were encountered:
We can create a Threshold table in the database that has a n:1 relationship with the Course table. This makes the code cleaner and DRYer. It also makes it possible to add courses with more or less letter grades than the ones specified in the code.
My proposal would be for the Threshold table to have the following attributes:
(id: int, name: varchar, threshold: double, course_id: int, grade: double)
. Most of these are self explanatory, but thegrade
column is for the number that gets used to calculate GPA.The following SQL could be used for a lookup:
SELECT grade FROM Threshold WHERE course_id = ? AND threshold <= ? ORDER BY grade DESC LIMIT 1
The text was updated successfully, but these errors were encountered: