Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
Modeling a database begins by identifying the information to be stored Need to also define how information elements are related to one another Further, define constraints on the information, including defining keys, referential integrity, etc.
Fundamental goals of E/R modeling: Capture and document all requirements and business rules as clearly and exactly as possible Satisfy all requirements of the given problem Produce E/R diagrams that are easily translatable into relational models/implementations
Each course has many enrolled students Each student enrolls in many classes, but the maximum for each student is 6 Students Courses enroll-in <= 6
In a referential-integrity constraint, an entity in one set is required to have an entity in another set to which it is related Each department has exactly one chair Each faculty member can be chair of at most one department Faculty Departments chair-of C “exactly one”“at most one”
Much like OOP, we can define subclasses in an E/R diagram We identify parent/child entity sets via the is-a relationship The Students and Faculty relations inherit all attributes of People ▪ This includes the key(s) of People Students Faculty People is-a
Undergrads Graduates Students is-a specialization generalization Is this a good design?
A weak entity set is one in which its key is not guaranteed to be unique The weak entity set is always linked to one or more (strong) entity sets keyB keyA Weak Entity Set Strong Entity Set support C
Weak entities are determined by one or more supporting entities The key of the supporting entities are appended to the key of the weak entity ▪ keyA is not unique, but the combined keyA-keyB should be unique Strong Entity Set support keyB keyA Weak Entity Set C
Dependent names are not guaranteed unique Names of dependents of a given employee are guaranteed to be unique Each dependent depends on exactly one employee (required) Employees depend empid name Dependents C
Course names are not guaranteed to be unique Names of courses within a given department are guaranteed to be unique Each course is offered in exactly one department (required) Departments offered deptid name Courses C
Advisors Students advises C Majors has C Faculty serves-as C
Go back to the relations we’ve worked with in class and create E/R diagrams for each e.g. MusicGroup, Company Also create a detailed E/R diagram for the celebrities relations (and relationships!) see next slide....