Presentation is loading. Please wait.

Presentation is loading. Please wait.

Entity Relationship Diagram ERD. Background Peter Chen developed ERDs in 1976. Charles Bachman and James Martin have added some slight refinements to.

Similar presentations


Presentation on theme: "Entity Relationship Diagram ERD. Background Peter Chen developed ERDs in 1976. Charles Bachman and James Martin have added some slight refinements to."— Presentation transcript:

1 Entity Relationship Diagram ERD

2 Background Peter Chen developed ERDs in 1976. Charles Bachman and James Martin have added some slight refinements to the basic ERD principles.

3 ER Model An entity-relationship model (ERM) is a conceptual way of showing data relationships in software development. ERM is a database modeling technique that generates an abstract diagram or visual representation of a system's data that can be helpful in designing a relational database.

4 Components of ER model Entity Relationship Attribute

5 Entity Entities are objects or concepts that represent important data. They are typically nouns, e.g. customer, supervisor, location or promotion. Strong entities exist independently from other entity types. They always possess one or more attributes that uniquely distinguish each occurrence of the entity. E.g. student Weak entities depend on some other entity type. They don't possess unique attributes (also known as a primary key) and have no meaning in the diagram without depending on another entity. E.g. course

6 Representation in ERD Entities are represented by rectangles.

7 Attribute Attributes are characteristics of either an entity, a many-to-many relationship, or a one-to-one relationship. Multivalued attributes are those that are capable of taking on more than one value. E.g. phone number Derived attributes are attributes whose value can be calculated from related attribute values. E.g. age Composite attributes are those that can be further subdivided. E.g. name, address

8 Representation in ERD Attributes are represented by means of ellipses.

9 Relationship and Cardinality Relationships, which represent the link between different entities. 1.One to one 2.One to many 3.Many to one 4.Many to many Cardinality is the number of instance of an entity from one relation that can be associated with the other relation.

10 Representation in ERD Relationships are represented by diamond-shaped box. Name of the relationship is written inside the diamond-box. All the entities (rectangles) participating in a relationship, are connected to it by a line.

11 One to one One-to-one − When only one instance of an entity is associated with the relationship, it is marked as '1:1'. E.g. an EMPLOYEE is assigned one PARKING_PLACE, and each PARKING_PLACE is assigned to one EMPLOYEE

12 One to many When more than one instance of an entity is associated with a relationship, it is marked as '1:N'. E.g. a PRODUCT_LINE may contain many PRODUCTS, and each PRODUCT belongs to only one PRODUCT_LINE

13 Many to one When more than one instance of entity is associated with the relationship, it is marked as 'N:1'.

14 Many to many The following image reflects that more than one instance of an entity on the left and more than one instance of an entity on the right can be associated with the relationship. E.g. a STUDENT may register for more than one COURSE, and each COURSE may have many STUDENTS

15 Representation I

16 Representation II

17 Representation III

18 Representation IV

19 How to create an ERD? 1.Identify entities 2.Identify relationships 3.Describe the relationship 4.Add Attributes 5.Complete the diagram

20 Step 1 The first step in making an ERD is to identify all of the entities you will use. An entity is nothing more than a rectangle with a description of something that your system stores information about. This could be a customer, a manager, an invoice, a schedule, etc. Draw a rectangle for each entity you can think of on your page.

21 Step 2 Look at two entities, are they related? If so draw a solid line connecting the two entities.

22 Step 3 How are the entities related? Draw an action diamond between the two entities on the line you just added. In the diamond write a brief description of how they are related.

23 Step 4 Any key attributes of entities should be added using oval-shaped symbols.

24 Step 5 Continue to connect the entities with lines, and adding diamonds to describe each relationship until all relationships have been described. Each of your entities may not have any relationships, some may have multiple relationships. That is okay.

25 Sample ERD

26 Exercise What can you say about policy of the bank from the ER diagram? What can you say about the policy of the company? balance acct# Account CustAcct name Customer ssn addr deptid budget Dept Manages name Employees ssn lot

27 EXERCISE Draw the ERD for the following scenarios: A player plays for a team. Each patient has one or more patient histories; each instance of patient history belongs to one patient. An employee may be recorded as having many jobs; a particular job may be recorded as having been held by many employees. A person is a citizen of a country.

28 Case Study Odeon Cinema and other international cinemas have decided to install a centralized database. This database should keep information regarding cinemas including its name, address and phone number. Each cinema must have one or more theaters and each theater has a specific showing time. During these showing times a movie is shown to the general public

29 Entities CINEMA THEATER SHOW MOVIE

30 Relationships A CINEMA must contain one or more THEATERS. A THEATER must belong to one CINEMA only. A THEATER has one or more SHOW times. A particular SHOW time for a movie must belong to one THEATER only A MOVIE can have many SHOW times and a particular SHOW time at a THEATER must belong to one MOVIE only.

31 Attributes CINEMA Cinema_ID Cinema_Name Cinema_Address Cinema_Phone THEATER Theater_ID Theater_Capacity SHOW Show_Time Show_Date Show_Attendence MOVIE Movie_ID Movie_Title Movie_Director Movie_Rating

32 ENTITY RELATIONSHIP DIAGRAM

33 Practice Library Management System School Management System Hospital Management System Bank Management System Transport Management System

34 ERD Tools RISE Editor ER Studio ERwin Smart Draw Rational Rose Magic Draw


Download ppt "Entity Relationship Diagram ERD. Background Peter Chen developed ERDs in 1976. Charles Bachman and James Martin have added some slight refinements to."

Similar presentations


Ads by Google