Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text 3.1-3.7, 7.1.

Slides:



Advertisements
Similar presentations
Chapter 6: Entity-Relationship Model (part I)
Advertisements

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
Data Modeling using the Entity-Relationship (ER) Model
CS157A Lecture 3 ER Diagram Prof. Sin-Min Lee Department of Computer Science San Jose State University.
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.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
Database Systems: Design, Implementation, & Management, 5 th Edition, Rob & Coronel 1 Data Models: Degrees of Data Abstraction l Modified ANSI/SPARC Framework.
APPENDIX C DESIGNING DATABASES
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
Data Modeling Using the Entity-Relationship Model
Entity-Relationship modeling Transparencies
Data Modeling Using the Entity-Relationship Model
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
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
Entity-relationship Modeling Transparencies 1. ©Pearson Education 2009 Objectives How to use ER modeling in database design. The basic concepts of an.
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Entity-Relationship Model
Entities and Attributes
Database System Concepts, 5th Ed. Chapter 6: Entity-Relationship Model.
Module Title? Data Base Design 30/6/2007 Entity Relationship Diagrams (ERDs)
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
©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 Model Using High-Level Conceptual Data Models for Database Design Entity Types, Sets, Attributes and Keys Relationship Types, Sets,
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:
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Computing & Information Sciences Kansas State University Wednesday, 24 Sep 2008CIS 560: Database System Concepts Lecture 12 of 42 Wednesday, 24 September.
CS 405G: Introduction to Database Systems Lecture 2 : Database Design I.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
1 A Demo of Logical Database Design. 2 Aim of the demo To develop an understanding of the logical view of data and the importance of the relational model.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
Database Management Systems MIT Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz.
ITTelkom Entity Relationship Diagram (1) CS2343 Perancangan Basisdata Relasional.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Databases Illuminated Chapter 3 The Entity Relationship Model.
Entity-Relationship Model Chapter 3 II COSC 457 Sungchul Hong.
Data Modelling Using Entity-Relationship (ER) Model
DatabaseIM ISU1 Fundamentals of Database Systems Chapter 3 Data Modeling Using Entity-Relationship Model.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Lesson 4: The Relational Model. Lesson Overview Database Design Entities Relationships E-R Diagrams.
Data Modeling Using the Entity- Relationship (ER) Model.
Ashima Wadhwa. database  A database can be modeled as: ◦ a collection of entities, ◦ relationship among entities. entity  An entity is an object that.
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
©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.
Data Modeling Using the Entity- Relationship (ER) Model
Entity-Relationship Model
Database Management Systems
ER model Ashima Wadhwa.
Entity-Relationship Model
Entity Relationship Model
Entity-Relationship Model
Lecture3: Data Modeling Using the Entity-Relationship Model.
Chapter Entity-Relationship Modeling & Enhanced Entity- Relationship Modeling.
Database Modeling using Entity Relationship Model (E-R Model)
Conceptual Data Modeling Using Entities & Relationships
Chapter 7: Entity-Relationship Model
Chapter Entity-Relationship Modeling & Enhanced Entity- Relationship Modeling.
Entity Relation Model Tingting Zhang.
Presentation transcript:

Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1

Database Designsemester Slide 2 Overview  Entity-Relationship (ER) model is a popular high-level conceptual data model.  Based on a perception of a real world that consists of a collection of basic objects, called entities, and of the relationships among these objects.  The ER model can be directly translated into relational tables.

Database Designsemester Slide 3 Entities  A database can be modeled as: –a collection of entities, –relationship among entities.  An entity is an object that exists and is distinguishable from other objects. Example: person, company, event, plant  Entities have attributes Example: people have names and addresses  An entity set (aka entity type, entity class) is a set of entities of the same type that share the same properties. Example: set of all persons, companies, students. Entity instance: a specific element in the entity set.

Database Designsemester Slide 4 Attributes  An entity is represented by a set of attributes, that is, descriptive properties possessed by all members of an entity set. Example: customer = (customer-id, customer-name, customer- street, customer-city) Attribute Domain – the set of permitted values for each attribute  Attribute types: –Simple and composite attributes.  Eg composite attribute: address consists of street and city. –Single-valued and multi-valued attributes  E.g. multivalued attribute: phone-numbers –Derived attributes  Can be computed from other attributes  E.g. age, given date of birth

Database Designsemester Slide 5 Keys of Entity  Superkey –subset of attributes which uniquely identify an entity (many possibilities, eg, all attributes in relation, …...)  Candidate Key –minimal superkey - unable to remove any attributes and still provide unique identification of the entity –EMPLOYEE (empno, ……, taxfileno) –one is select as Primary Key (eg. empno) –remaining candidate key/s known as Alternate Keys (taxfileno) –PK’s may be  simple PK (single attribute)  CUSTOMER (custno, ….)  composite PK (multiple attributes)  ORDERLINE (orderno, prodno, quantity,…)

Database Designsemester Slide 6 Drawing Entities and Attributes  Chen's Notation rectangles represent entities oval represent attributes derived attributes use dotted line multi-valued attributes use double line primary key attribute indicated with underline student stu_idname dob age phone Rectangles represent entity sets. address streetcity

Database Designsemester Slide 7 Relationship  Relationship –association between two (or more) entities Examples Students Register for Subjects School Has Staff Driver Commits Traffic Offence Customer Orders Product Supplier Supplies Parts To Projects  Relationship type (aka relationship set) –Set of similar associations among entity sets.

Database Designsemester Slide 8 Types of Relationships  Degree of relationship –UNARY – between entities from one entity set, recursive –BINARY – between entities from two entity sets –N-ARY – among entities from more than two entity sets  Relationship may have attributes –eg, customer orders a product  quantity is attribute of orders relationship –A requirement of our text on attributes of relationship: A relationship must be uniquely identifiable by the participating entities without using the descriptive attributes of the relationship.

Database Designsemester Slide 9 Drawing Relationships  relationships represented by diamond customer product orders quantity

Database Designsemester Slide 10 Example Relationships

Database Designsemester Slide 11 Constraints on Relationships  Cardinality –Given an entity instance e of some entity type, how many entity instances of the related entity type can have the relationship with e. –Example:  Each student enrolls in 1 to 4 subjects,  Each subject may be enrolled by 0 to 300 students. Student Subject EnrolIn (1,4)(0,300)

Database Designsemester Slide 12 Cardinality Ratio  Relationships can be classified as –one-to-one (1:1)  One entity of type A corresponds to at most one entity of type B, and vice versa –one-to-many (1:M)  One entity of type A corresponds to more than one entities in B, but one entity of type B may only correspond to at most one entity of type A. –Many-to-one: opposite to one-to-many –many-to-many (M:N)  One entity of type A corresponds to more than one entities of type B, and vice versa

Database Designsemester Slide 13 Participation  Participation of entity instances in relationship can be –Optional (partial)  eg, an employee may not have a spouse  not every staff manages a department –Mandatory (total)  eg, every spouse must be that of an employee  Every department is managed by some staff.  Mandatory participation is represented by double line

Database Designsemester Slide 14 Examples employee spouse 11 has (0,M)(1,1) (1:M)(0:N) ORDERCUSTOMERplace SUBJECTSTUDENTenrol 1N MN

Database Designsemester Slide 15 Weak Entity  Existence depends on the existence of other entities  primary key partially or totally derived from owner entity  The relationship between the weak entity and its owner entity is called weak relationship. –Eg: Employee Has Dependent  Dependent can be regarded as a weak entity—only when the attributes of Dependent can not uniquely identify a dependent. Eg, Dependent has the attributes d_name and d_birthdate only, but two employees may have dependents with the same name and date of birth. However employee_no and d_name uniquely identify each dependent.  Employee is the owner entity  Has is the weak relationship

Database Designsemester Slide 16 Representing Weak Entities and Relationships  Weak entity is indicated by a double line rectangle, and weak relationship is represented by a double line diamond.  Participation of weak entity in weak relationship is always mandatory.  A weak entity type may have more than one owner entity types. EmployeeDependent Has 1 M

Database Designsemester Slide 17 Modelling with E-R Diagram  list the major entity sets in the system  represent the entity sets graphically by a rectangle  search for relationships between the entities and represent them graphically by a diamond  add attributes, underline PK attribute/s  model relationship cardinality and participation  Do not include Foreign Keys (FK's) on ER Diagram –FK used to depict relationship BUT relationship is already present in ER due to relationship - thus never show FK on ER

Database Designsemester Slide 18 Example COMPANY Database  Requirements for the Company database –The company is organized into DEPARTMENTs. Each department has a name, number, and an employee who manages the department. We keep track of the start date of the department manager. A department may have several locations –Each department controls a number of PROJECTs. Each project has a name, number, and is located at a single location.

Database Designsemester Slide 19 Example COMPANY Database (continued) –We store each EMPLOYEE's social security number, address, salary, sex, and birth date. Each employee works for one department but may work on several projects. We keep track of the number of hours per week that an employee currently works on each project. We also keep track of the direct supervisor of each employee. –Each employee may have a number of DEPENDENTs. For each dependent, we keep their name, sex, birth date, and relationship to the employee.

Database Designsemester Slide 20

Database Designsemester Slide 21