1 / 12

Entity-Relationship Model

Entity-Relationship Model. Contents. Entity-relationship models (ERM) Simple E-R Diagram Weak Entity Strong Entity Entity vs. Attribute. Entity-relationship models (ERM).

grant
Télécharger la présentation

Entity-Relationship Model

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 Model

  2. Contents • Entity-relationship models (ERM) • Simple E-R Diagram • Weak Entity • Strong Entity • Entity vs. Attribute

  3. Entity-relationship models (ERM) In this step, the database designer creates an entity-relationship (E-R) diagram to show the entities for which information needs to be stored and the relationship between those entities. E-R diagrams uses several geometric shapes, but we use only a few of them here: • Rectangles represent entity sets • Ellipses represent attributes • Diamonds represent relationship sets • Lines link attributes to entity sets and link • Entity sets to relationships sets Back

  4. ER Model Basics • Entity: Real-world object distinguishable from other objects. An entity is described (in DB) using a set of attributes. • Entity Set: A collection of similar entities. E.g., all employees. • All entities in an entity set have the same set of attributes. (Until we consider ISA hierarchies, anyway!) • Each entity set has a key. • Each attribute has a domain.

  5. Key and key attributes: • Key: a unique value for an entity • Key attributes: a group of one or more attributes that uniquely identify an entity in the entity set • Super key, candidate key, and primary key • Super key: a set of attributes that allows to identify and entity uniquely in the entity set • Candidate key: minimal super key • There can be many candidate keys • Primary key: a candidate key chosen by the designer • Denoted by underlining in ER attributes

  6. Relationship: Association among two or more entities. e.g., Jack works in Pharmacy department. • Relationship Set: Collection of similar relationships. • An n-ary relationship set R relates n entity sets E1 ... En; each relationship in R involves entities e1 in E1, ..., en in En • Same entity set could participate in different relationship sets, or in different “roles” in same set. Back

  7. Simple E-R Diagram

  8. After the E-R diagram has been finalized, relations (tables) in the relational database can be created. Back

  9. Weak Entity An entity set that does not possess sufficient attributes to form a primary key is called a weak entity .A weak entity can be identified uniquely only by considering the primary key of another (owner) entity. • Owner entity set and weak entity set must participate in a one-to-many relationship set (one owner, many weak entities). • Weak entity set must have total participation in this identifying relationship set. name cost pname age ssn lot Back Policy Dependents Employees

  10. Strong Entity In an entity-relationship model, any entity whose existence in the database does not depend on the existence of any other entity.  Strong Entity Set: which entity set does have a primary key is called a strong entity set. Example: Set of all Persons,Companies,Trees,Holidays etc. Weak Entity Set: which entity set does not have a primary key is known as a weak entity set. Example: Specific Person,Company,Event,Plant MD.ISRAFIL CSE (DHAKA) Back

  11. Entity vs. Attribute • Should address be an attribute of Employees or an entity (connected to Employees by a relationship)? • Depends upon the use we want to make of address information, and the semantics of the data: • If we have several addresses per employee, address must be an entity (since attributes cannot be set-valued). • If the structure (city, street, etc.) is important, e.g., we want to retrieve employees in a given city, address must be modeled as an entity (since attribute values are atomic). Back

  12. Thank you

More Related