Quantcast
Channel: How to model "Courses prerequisites" for a university? - Database Administrators Stack Exchange
Viewing all articles
Browse latest Browse all 2

Answer by DrabJay for How to model "Courses prerequisites" for a university?

$
0
0

You have some Courses:

COURSES-------course_idcourse_numbercourse_name

You need to combine one or more of these Courses with a logical operator:

COMBINATIONS------------combination_idlogical_operator (AND, OR or NOT)COMBINATION_COURSES-------------------combination_idcourse_id

You may also need to combine some of these combinations (so changing the COMBINATION_COURSES table):

COMBINATION_COURSES-------------------combination_idcourse_idsub_combination_id

where one and only one of course_id and sub_combination_id is not null.

A Course may have one of the combinations as a prerequisite (so changing the COMBINATIONS table):

COURSES-------course_idcourse_numbercourse_nameprerequisite_combination_id

EDIT

So, given your original examples your tables would be populated:

COURSES=======course_id course_name                    prerequisite_combination_id--------- ------------------------------ ---------------------------        1 Artificial Intelligence                                 12        2 Data Structures        3 Introduction to Logic        4 Mathematical Logic and Proofs         5 Calculus 1        6 Calculus 2                                              13        7 Analytical GeometryCOMBINATIONS============combination_id logical_operator-------------- ----------------            11 OR            12 AND            13 ANDCOMBINATION_COURSES===================combination_id course_id sub_combination_id-------------- --------- ------------------            11         3            11         4            12         2            12                           11            13         7            13         5

Course 1 - Artificial Intelligence has a prerequisite of the Combination 12. Combination 12 is Course 2 - Data Structures AND Combination 11. Combination 11 is Course 3 - Introduction to Logic OR Course 4 - Mathematical Logic and Proofs.

Hence, the prerequisite of Course 1 - Artificial Intelligence is Course 2 - Data Structures AND (Course 3 - Introduction to Logic OR Course 4 - Mathematical Logic and Proofs).

This structure should allow you to store any prerequisite that is the any logical combination of any number of courses.


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>