Presentation is loading. Please wait.

Presentation is loading. Please wait.

Entity-Relationship Modelling Introduced by Chen in 1976 The ER Model is used to construct the conceptual data model – independent of DBMS Most widely.

Similar presentations


Presentation on theme: "Entity-Relationship Modelling Introduced by Chen in 1976 The ER Model is used to construct the conceptual data model – independent of DBMS Most widely."— Presentation transcript:

1 Entity-Relationship Modelling Introduced by Chen in 1976 The ER Model is used to construct the conceptual data model – independent of DBMS Most widely used techniques for modelling of business domains data requirements

2 Entity-Relationship Modelling R K Bhagat

3 Entity A ‘thing’ which can be distinctly identified A distinguishable object from the problem domain e.g. –STUDENT, UNIT, COURSE –EMPLOYEE, DEPARTMENT, COMPANY Real or abstract –Book, Author –Loan, Sale

4 Choosing Entities Usually ‘nouns’ from the problem domain – CUSTOMER, ORDER, SUPPLIER – AIRCRAFT, SEAT, FLIGHT, AIRLINE – Eliminate synonyms AIRCRAFT and PLANE are the same entity –Beware of roles that should be entities, e.g - MACHINIST should be EMPLOYEE DELIVERY VAN should be VEHICLE

5 Drawing Entities Entities are in UPPER CASE and singular - ‘EMPLOYEE’ not ‘employees’ Each entity instance must be uniquely identified by a primary key national_insurance_number EMPLOYEE

6 Attributes Attributes are details that identify, quantify or describe the entity Attributes take values from a domain e.g. month = {Jan, Feb, Mar, …. Dec} unit = {DBS1, BP, BITS1, ICT, ACC} Ensure that the attribute really describes the entity, e.g. shirt_colour is an attribute of TEAM, not PLAYER

7 Drawing Attributes Attributes appear below the entity that they describe in lower case Use underlining to denote the primary key department_number name location DEPARTMENT

8 Primary Key The primary key is the attribute, or set of attributes, that uniquely identifies all of the entity instances Ensure that the primary key uniquely identifies the instances, e.g – ‘student_id’ is unique, but ‘surname’ is not There are other types of key – foreign, composite, candidate

9 Relationships ‘An association among entities’ A named significant association A binary association that links two entities Drawn as the line on the diagram Cardinality –one to one –one to many –many to many

10 One-to-One Relationship A HUSBAND has one WIFE A WIFE has one HUSBAND

11 One-to-Many Relationship A DEPARTMENT has one or more EMPLOYEEs

12 Many-to-Many Relationship A STUDENT attends one or more UNITs A UNIT is taken by one or more STUDENTs

13 Checking for Redundant Relationships

14

15 Steps in Entity Relationship Modelling 1. Identify the entities. 2. Identify the relationships using a relationship grid. 3. Identify the relationship types 4. Draw the entity-relationship diagram. 5. Check for and remove redundant relationships

16 Steps in Entity Relationship Modelling 6. Remove many-to-many relationships. 7. Identify/create the primary key for each entity 8. Convert one-to-many relationships to foreign keys. 9. Identify/create additional attributes for each entity. 10. Define the relations corresponding to the entity- relationship model. 11. Create the relations in the Database Management System 12. Declare the primary keys and foreign keys.

17 The Scenario ‘CD-Direct’ is a new Internet Retailer that sells Compact Discs using the web. They require a relational database to store details of the orders placed by their customers. A customer can make one or more orders. For each order, an employee picks out the compact disc and sends them to the customer who placed the order. More than one disc can be ordered on the same order. The company requires that information about which employee dealt with each order be recorded in the database for management reasons. An invoice is sent to the customer with the ordered goods.

18 Check for and remove redundant relationships

19 Summary Identify the entities Identify relationships between entities Remove any redundant relationships Remove M:N relationships by adding an extra entity – many go on the extra entity Add primary keys and foreign keys –foreign keys are the primary keys from the one put into the many side of the relationship Add additional attributes Convert into a set of relations


Download ppt "Entity-Relationship Modelling Introduced by Chen in 1976 The ER Model is used to construct the conceptual data model – independent of DBMS Most widely."

Similar presentations


Ads by Google