I have created the entity-relationship diagram (ERD) shown below (for brevity, each individual bubble-shaped box portrays multiple attributes):
Considering such an ERD, I have to convert each entity type or associative entity type depicted there as a relation with its corresponding attribute names, but I run into some problems.
I usually represent a relation as follows:
X = (a, b, c)
*
* Where X
is the name of the relation and a
, b
and c
are the names of its attributes.
Then, in the business domain that I am working on, a Course
depends on zero-to-many (0:M) other Courses
(as portrayed in the ERD). This means that a Course
should be connected somehow to the Courses
it is dependent on.
So, how can I represent this situation as a (mathematical) relation?
Option 1
I have tried the following:
Course = (course_number, course_name, course_dependencies?)
Option 2
I think it is possible to depict the desired aspect in another way, e.g.:
Depends = (course_name)
and then
Course = (course_number, course_name, depends)
Option 3
But I thought about, maybe, arranging the elements as follows:
Course = (course_number, course_name)
Depends = (course_name_depender, course_name_dependee)
In this way, each pair of attribute names in the relation called Depends
represents the association (or relationship) between two occurrences of the relation entitled Course
.
Questions
Which of these options is the right way to do it? Perhaps there is a better approach?