1 / 28

Entity-Relationship Model Cont…..

Entity-Relationship Model Cont…. CST203-2 Database Management Systems Lecture 4. Student entity. Keys. A Key is a single attribute or combination of two or more attributes of an entity set that is used to identify one or more instances of the set. Student entity. Super Key.

burke
Download Presentation

Entity-Relationship Model Cont…..

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Entity-Relationship ModelCont….. CST203-2 Database Management Systems Lecture 4

  2. Student entity

  3. Keys • A Key is a single attribute or combination of two or more attributes of an entity set that is used to identify one or more instances of the set

  4. Student entity

  5. Super Key • A super key of an entity set is a set of one or more attributes whose values uniquely determine each entity. • A superkey is any set of attributes (K) such that no two tuples of a relation can have the same values for K, i.e: t1(K) != t2(K) for every possible pair of distinct tuples, t1,t2.

  6. Student entity

  7. Candidate Key • A candidate key is a superkey such that no proper subset of K is also a superkey. • Customer-idis candidate key of customer • account-number is candidate key of account

  8. Student entity

  9. Primary key • Although several candidate keys may exist, one of the candidate keys is selected to be the primary key. • Primary key does not allow duplicate values(repeating) and null values

  10. Student entity

  11. Unique key • It wont allow duplicate values including NULL... • Means that it will allow any thing only one time ....including null...

  12. Strong entity types • Regular entity types which have a primary key attributes

  13. Weak Entity Types • An entity type that does not have a primary key • The existence of a weak entity type depends on the existence of a identifyingorowner entity type • it must relate to the identifying entity set via a total, one-to-many relationship set from the identifying to the weak entity set • Identifying relationship depicted using a double diamond • Total participation constraint • The discriminator (or partial key) of a weak entity set is the set of attributes that distinguishes among all the entities of a weak entity set. • Weak entity as an attribute

  14. We depict a weak entity set by double rectangles. • We underline the discriminator of a weak entity set with a dashed line. • payment-number – discriminator of the payment entity set • Primary key for payment – (loan-number, payment-number)

  15. In a university, a course is a strong entity and a course-offering can be modeled as a weak entity • The discriminator of course-offering would be semester (including year) and section-number (if there is more than one section) • If we model course-offering as a strong entity we would model course-number as an attribute. Then the relationship with course would be implicit in the course-number attribute

  16. Design of ER diagram Initial design is created and then iteratively refined until the most suitable design is reached • Concept may be first modeled as an attribute and then refined in to relationship(binary) • An attribute that exists in several entity types may be elevated or promoted to an independent entity type e.g.: student, instructor, course has the common attribute department number • Inverse of 2nd one : if an entity type exists with a single attribute and is related to only one entity ……. • Refine using specialization, generalization and relationships of higher degree

  17. Specialization • Top-down design process • we designate subgroupings within an entity set that are distinctive from other entities in the set. • Specific attributes • Specific relationships • Depicted by a triangle component labeled ISA (E.g. customer “is a” person). • Attribute inheritance – a lower-level entity set inherits all the attributes and relationship participation of the higher-level entity set to which it is linked

  18. Specialization Example

  19. Generalization • A bottom-up design process – combine a number of entity sets that share the same features into a higher-level entity set. • Specialization and generalization are simple inversions of each other • they are represented in an E-R diagram in the same way. • The terms specialization and generalization are used interchangeably.

  20. Specialization and Generalization • Can have multiple specializations of an entity set based on different features. • E.g. permanent-employee vs. temporary-employee, in addition to officer vs. secretary vs. teller • Each particular employee would be • a member of one of permanent-employee or temporary-employee, • and also a member of one of officer, secretary, or teller • The ISA relationship also referred to as superclass - subclass relationship

  21. Design Constraints on a Specialization/Generalization • Constraint on which entities can be members of a given lower-level entity set. • Condition-defined / predicate defined subclasses • E.g. all customers over 65 years are members of senior-citizen entity set; senior-citizen ISA person. • User-defined specialization • Disjointness constraint • Constraint on whether or not entities may belong to more than one lower-level entity set within a single generalization. • Disjoint • an entity can belong to only one lower-level entity set • Noted in E-R diagram by writing disjoint next to the ISA triangle • Overlapping • an entity can belong to more than one lower-level entity set • Completenessconstraint -- specifies whether or not an entity in the higher-level entity set must belong to at least one of the lower-level entity sets within a generalization. • totalspecialization: an entity must belong to one of the lower-level entity sets • Partial specialization : an entity need not belong to one of the lower-level entity sets

  22. Insertion and deletion rules for specialization and generalization • Deleting from superclass • Inserting in a superclass • Predicate defined specialization • Total specialization

  23. Aggregation • A class type really represents a collection of individual components

  24. The system is an aggregation of components • It denotes an "is part of" relationship

  25. E-R Diagram for a Banking Enterprise

  26. Summary of Symbols Used in E-R Notation

  27. Alternative E-R Notations

More Related