Database Management Systems MIT 22033 Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz.

Slides:



Advertisements
Similar presentations
Logical DB Design: ER to Relational Entity sets to tables. Employees ssn name lot CREATE TABLE Employees (ssn CHAR (11), name CHAR (20), lot INTEGER, PRIMARY.
Advertisements

Chapter 6: Entity-Relationship Model (part I)
the Entity-Relationship (ER) Model
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
The Entity-Relationship (ER) Model
Chapter 31 Chapter 3 Data Modeling Using the Entity-Relationship Model.
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Text-Book Chapters (7 and 8) Entity-Relationship Model
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Modeling Data The Entity Relationship Model (ER) For Database Design.
1–1 The E-R Model Prof. Sin-Min Lee Department of Computer Science.
Chapter 4 ENTITY-RELATIONSHIP MODELLING.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Chapter 4 Entity-Relationship modeling Transparencies © Pearson Education Limited 1995, 2005.
Entity Relationship Diagrams
The Entity-Relationship Model. 421B: Database Systems - ER Model 2 Overview of Database Design q Conceptual Design -- A first model of the real world.
Data Modeling Using the Entity-Relationship Model
Entity-Relationship modeling Transparencies
Data Modeling Using the Entity-Relationship Model
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model.
the Entity-Relationship Model
ICOM 5016 – Introduction to Database Systems Lecture 4 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Entity-Relationship Model Ch. 3
DATABASEMODELSDATABASEMODELS  A database model ◦ defines the logical design of data. ◦ Describes the relationships between different parts of data.
ER to Relational Translation COMSATS INSTITUTE OF INFORMATION TECHNOLOGY, VEHARI.
ICS 321 Spring 2011 High Level Database Models Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 2/7/20111Lipyeow.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 7 Database Design and The E–R Model. 2 Goals n Facilitate DB design and represent the overall logical structure of the DB. n Definition Entities.
© Pearson Education Limited, Chapter 7 Entity-Relationship modeling Transparencies.
Entity-Relationship Modeling Based on Chapter 12.
Chapter 12 Entity-Relationship Modeling Pearson Education © 2009.
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
Entity – Relationship Model (E-R Model)
CS 405G: Introduction to Database Systems Lecture 2 : Database Design I.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
 Entity-relationship models (ERM) Entity-relationship models (ERM)  Simple E-R Diagram Simple E-R Diagram  Weak Entity Weak Entity  Strong Entity.
1 Entity-Relationship Model © Pearson Education Limited 1995, 2005.
ITTelkom Entity Relationship Diagram (1) CS2343 Perancangan Basisdata Relasional.
1 Conceptual Design using the Entity- Relationship Model.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Databases Illuminated Chapter 3 The Entity Relationship Model.
Entity-Relationship Model Chapter 3 II COSC 457 Sungchul Hong.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Chapter 3: Data Modeling Using the Entity-Relationship (ER) Data Model
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Entity-Relationship Modeling. 2 Entity Type u Entity type –Group of objects with same properties, identified by enterprise as having an independent existence.
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
LECTURE 1: Entity Relationship MODEL. Think before doing it! Like most of the software projects, you need to think before you do something. Before developing.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Chapter 2: Entity-Relationship Model. 3.2 Chapter 2: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts - 6 th Edition Chapter 7: Entity-Relationship Model.
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
Data Modeling Using the Entity- Relationship (ER) Model
COP Introduction to Database Structures
Entity-Relationship Model
Entity-Relationship Model
Entity Relationship Model
Entity-Relationship Model
Entity-Relationship Model
Entity Relationship Diagrams
Initial Design of Entity Types: EMPLOYEE, DEPARTMENT, PROJECT, DEPENDENT Gender.
Database Modeling using Entity Relationship Model (E-R Model)
Chapter 7: Entity-Relationship Model
Entity Relation Model Tingting Zhang.
Presentation transcript:

Database Management Systems MIT Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz

ER - Model The entity-relationship (ER) data model allows us to describe the data involved in a real-world enterprise in terms of objects and their relationships and is widely used to develop an initial database design MIT 22033, By: S.Sabraz Nawaz

E-R Model (Entities) The two main constructs of the Entity- Relationship model are Entities & Relationships An entity is an object in the real world that is distinguishable from other objects o e.g. Lecturer, Student, Subject, etc. A collection of similar entities is called an entity set o e.g. Lecturers, Students, Subjects, etc. ENTITY MIT 22033, By: S.Sabraz Nawaz

E-R Model (Entities...) Example, an employee in a company database. EMPLOYEES e1 e2 e3 e4 e5 e6 … Employee Entity set MIT 22033, By: S.Sabraz Nawaz

E-R Model (Attribute) An entity is described using a set of attributes o e.g. Name, NIC, etc. All entities in an entity set have the same attribute Attribute MIT 22033, By: S.Sabraz Nawaz

E-R Model (Attributes…) Example: name, id, age & salary are attributes in EMPLOYEES entity name id dob salary EMPLOYEES e1 e2 e3 e4 e5 e6 … Employee Entity set salary dob id name MIT 22033, By: S.Sabraz Nawaz

E-R Model (Attributes…) The attributes are said to be composite if they can be split. Eg:- the entity Employee contains attribute 'name' which is a composite one LastName FirstName name EMPLOYEES MIT 22033, By: S.Sabraz Nawaz

E-R Model (Attributes…) A multi-valued attribute of an entity is one which has multiple values. o Eg:- attribute phone numbers in employee entity. first_name phone surname EMPLOYEES MIT 22033, By: S.Sabraz Nawaz

E-R Model (Attributes…) Some attributes that can be computed from other attributes are called derived attributes. o Eg:- age is derived from date of birth & current date name age EMPLOYEES MIT 22033, By: S.Sabraz Nawaz dob

E-R Model (Attributes… another sample) MIT 22033, By: S.Sabraz Nawaz Customers

E-R Model (Domain) Each attribute in an entity set has domain; possible values o e.g. Age attribute of an employee has possible integer values from MIT 22033, By: S.Sabraz Nawaz

A Key is a minimal set of attributes whose values uniquely identify an entity in the set E-R Model (Keys) e1 e2 e3 e4 e5 e6 … Employee Entity set salary dob id name MIT 22033, By: S.Sabraz Nawaz

E-R Model (Keys...) A candidate key is a combination of attributes that can be uniquely used to identify a database record If a table has one or more candidate keys, one of these candidate keys is selected as the table primary key and the rest are called alternate keys Primary key is underlined EMPLOYEES id MIT 22033, By: S.Sabraz Nawaz

E-R Model (Keys...) A key formed by combining at least two or more columns is called composite key Always, the minimal set of attributes are considered for the key. Therefore, A key is a minimal set of attributes whose values uniquely identify an entity in the set. MIT 22033, By: S.Sabraz Nawaz

E-R Model (Relationship) A relationship is an association among two or more entities o Sanath works for MIS Department o Thilan works for MIS Department A collection of similar relationships is called a relationship set MIT 22033, By: S.Sabraz Nawaz

E-R Model (Relationship…) Graphically, works in EMPLOYEESDEPARTMENTS MIT 22033, By: S.Sabraz Nawaz

E-R Model (Relationship…) A relationship can also have descriptive attributes These are used to record information about the relationship o E.g. SaNa works for MIS Department frm November In the figure, this is captured by the since in Works_In nic dob MIT 22033, By: S.Sabraz Nawaz

E-R Model (Relationship…) An instance of a relationship set is the set of relationships D1 D2 D Employees Departments Work_in 1/1/91 3/3/93 2/2/92 3/1/92 MIT 22033, By: S.Sabraz Nawaz

E-R Model (contd.) Degree of a relationship is the number of participating entities in the relationship. A relationship of degree two is called a binary relationship (e.g. Works In) A relationship with degree three is called ternary. MIT 22033, By: S.Sabraz Nawaz

E-R Model (contd.) Ternary relationship D1 D2 D Employees Departments Work_in L1 L2 L3 Locations MIT 22033, By: S.Sabraz Nawaz

works in EMPLOYEES DEPARTMENTS LOCATIONS Ternary relationship MIT 22033, By: S.Sabraz Nawaz E-R Model (contd.)

Sometimes, relationships can also have attributes called descriptive attributes that record information about the relationship works in EMPLOYEESDEPARTMENTS since MIT 22033, By: S.Sabraz Nawaz

E-R Model (contd.) D1 D2 D Employees Departments Work_in 1/2/97 1/2/99 1/5/01 1/2/87 1/3/95 MIT 22033, By: S.Sabraz Nawaz

E-R Model (contd.) The cardinality ratio for a binary relationship specifies the number of relationship instances that an entity can participate in. There are three types of cardinality ratios for binary relationships. They are one-to-one, one-to-many (many-to- one) and many-to-many. MIT 22033, By: S.Sabraz Nawaz

E-R Model (contd.) For example, an employee works in at most one department. Graphically, This is a one-to-many relationship works in EMPLOYEES DEPARTMENTS MIT 22033, By: S.Sabraz Nawaz

E-R Model (contd.) One-to-One relationship Example: An employee manages at most one department. A department can have only one manager managing it. manages EMPLOYEESDEPARTMENTS MIT 22033, By: S.Sabraz Nawaz

E-R Model (contd.) Many-to-many relationship Example: An employee can work on several projects. A project can have many employees working on it. works on EMPLOYEESPROJECTS MIT 22033, By: S.Sabraz Nawaz

E-R Model (contd.) Participating constraint specifies whether the existence of an entity depends on its being related to another entity via the relationship type For example, if we specify that an employee must always work for a department. Then we say that the relationship “works in” is in total participation from Employee entity to Department entity If the relationship is not in total participation, then it is known as in partial. o For example, from DEPARTMENTS to EMPLOYEES works in EMPLOYEESDEPARTMENTS MIT 22033, By: S.Sabraz Nawaz

E-R Model (contd.) Entity types without any key attributes is called weak entity types. A weak entity is uniquely identified by considering some of its attributes with the primary key of another entity called the identifying owner. The attributes in the weak entity participating in the key are called partial keys The owner entity and the weak entity participates in an identifying relationship. The cardinality of the identifying relationship is either one-to-one or one-to-many from owner entity to weak entity The weak entity must have total participation in the identifying relationship MIT 22033, By: S.Sabraz Nawaz

E-R Model (contd.) Graphically (Weak Entity) Policy EMPLOYEE name age id DEPENDENTS 1M MIT 22033, By: S.Sabraz Nawaz

E-R Model (contd.) Entities participating in a relationship need not be distinct. Such relationships are called recursive relationships. Each entity in the relationship play a role in the relationship. It is recommended to state the role in recursive relationships. MIT 22033, By: S.Sabraz Nawaz manages EMPLOYEES supervisor subordinate

Reference: Ramakrishnan, R., & Gehrke, J. (2003). Database management systems. Osborne/McGraw-Hill. (Pp. 24 – 50) MIT 22033, By: S.Sabraz Nawaz32