170 likes | 241 Views
E-R Diagrams. Dr. Mario Guimaraes. Class Will Start Momentarily…. E-R Introduction. Database design tool proposed by Peter Chen (1976). The real world is seen represented as entities, relationships and attributes. Example:. Components of E-R. Entity types Relationship types
E N D
E-R Diagrams Dr. Mario Guimaraes • Class • Will • Start • Momentarily…
E-R Introduction • Database design tool proposed by Peter Chen (1976). The real world is seen represented as entities, relationships and attributes. Example:
Components of E-R • Entity types • Relationship types • Attributes • Cardinality (minimum and maximum) Coffee.kennesaw.edu -> DB Design -> E-R (under testing)
Degree of Relationship • Degree of a Relationship • Number of participating entities in relationship. • Relationship of degree: • one is unary; • two is binary; • three is ternary; Most Relationships are of _______ degree
Binary Relationships • The most common degree for relationships is binary. • Binary relationships are generally referred to as being: • one-to-one (1:1) • one-to-many (1:*) • many-to-many (*:*)
Special Entity/Attribbutes • Other important terminology weak entity multi-valued attribute composite attribute surrogate key
Generalization/Specialization • Superclass • An entity type that includes one or more distinct subgroupings of its occurrences. • Subclass • A distinct subgrouping of occurrences of an entity type.
Characteristics of Subclass • Superclass/subclass relationship is one-to-one (1,1:0,1). • Superclass may contain overlapping or distinct (disjoint) subclasses. • Not all members of a superclass need be a member of a subclass (Partial Specialization). Summary: subclass may be overlapping or disjoint, partial or total.
Convert Scenarios to E-R • A specific DRUG is prescribed for a specific PATIENT bya a specific PHYSICIAN. A PHYSICIAN may issue many different prescritions for a given PATIENT. Likewise, a PATIENT may have several different DRUGs prescribed by different PHYSICIANS. Draw an E-R Diagram.
Convert E-R to tables • 1:N - add a column on the child side • N:N – associate table (two binaries) • 1:1 - look at the minimum cardinality • Recursive or Unary • Ternary -> 3 binaries
ER, EER, Class Diagram • EER is a superset of an ER. What is the difference ? • Class Diagram is a superset of a EER. What is the difference ?
Super-type/Sub-type • What is the default for converting Super-type/Sub-types to tables ?
Referential Integrity • Restrict or No Action • Cascade • Set Null • Animation or http://students.kennesaw.edu/~rzillige/CoffeeCourseware.html
Normalization • All non-key attributes should be dependent on the key, the whole key and nothing but the key. (1NF) (2NF) (3NF, BCNF)
End of Lecture End Of Today’s Lecture.