Class Exercise:  Data Modeling 

                        
For data models with two or more entity classes, a line between classes may be 
drawn to indicate they are related. For a 1:1 relationship, just draw a line 
between the classes. For a 1:1 recursive relationship (within a class), draw a
line from and back into that class; and include a relationship descriptor. To 
depict a 1:M relationship, draw a one or vertical bar next to the class on the
"one" end of a relationship line, and draw a "crow's foot" or place an 'M' on 
the relationship line next to the class that may occur "many" times. To implement 
M:M between two independent entity classes, create a 1:M relationship from each
to an associative entity. To further refine the rules about a relationship, a 0
or 1 may be placed next to the "foot" to indicate zero or more, or one or more 
instance occurrences.  And, a 0 (small circle) or 1 (vertical bar) may be placed
on the "one" end to indicate zero or one, or one and only one instance occurrence.
1. Construct a data model to depict the entity classes Faculty and Advisor. A 
   Faculty member may or may not be an Advisor. An advisor must be a Faculty 
   member. Faculty id(fId) is the primary key of Faculty. Place a foreign key 
   attribute in the Advisor class. Create other useful attributes for each class.







2. Create an Advisee entity class to be related to the entity class Advisor. An
   Advisor member may have many Advisees, though an Advisee is to be assigned to
   just one Advisor. Create useful attributes for the Advisee class.







3. Construct a data model for the independent class Course. Course has the 
   primary key course code(cCode), and has a title(cTitle), faculty id(fId) and 
   prerequisite (a course). Course is to have a M:1 relationship with Faculty. 
   For a course to be offered, there must be one faculty entity. Faculty may be
   related to zero, one, or more courses.







4. Construct data models for the entity classes Course_Book and Book. Course_Book
   is to be an associative entity class used to relate Course to Book. A course 
   may be related to zero, one, or more books. A book can be used in one or more
   courses. Create useful attributes for each class.







5. Model the 1:1 recursive relationship within Course. A course may have a 
   prerequisite (predecessor) course to be completed before enrolling in that
   course. The attribute named prerequisite for a course entity would be null
   if there is no course that is a prerequisite, and it would have a course code
   if it does have a prerequisite course to be completed.