Thread: Tables design question

Tables design question

From
JORGE MALDONADO
Date:
I have the following tables:
* courses
* prerequisites
* corequisites

The table "courses" has general data about school courses.
The table "prerequisites" has data about courses that must already have been taken for a certain course.
The table "corequisites" has data about courses that must be taken at the same time that another course.

This means that a course might have zero or more "prerequisites" and zero or more "corequisites" and both point to "courses".

The image below show what I think should be done.
I will very much appreciate any feedback about my approach.




Best regards,
Jorge Maldonado
Attachment

Re: Tables design question

From
"David G. Johnston"
Date:
On Wednesday, March 28, 2018, JORGE MALDONADO <jorgemal1960@gmail.com> wrote:
The table "corequisites" has data about courses that must be taken at the same time that another course.




I would consider setting up corequisites as (id serial, course_group_members integer[]) with an exclusion constraint that no course_id can appear in more than one array.

David J.
Attachment