Database Systems Lecture # 7 8 th Feb, 2011. Conceptual and Logical Design Person buys Product name pricenamessn Conceptual Model: Relational Model: (plus.

Slides:



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

the Entity-Relationship (ER) Model
Chapter 31 Chapter 3 Data Modeling Using the Entity-Relationship Model.
ENTITY RELATIONSHIP MODELLING
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.
Lecture 2: Entity/Relationship modelling
Chapter 4 ENTITY-RELATIONSHIP MODELLING.
Chapter 4 Entity-Relationship modeling Transparencies © Pearson Education Limited 1995, 2005.
Database Management COP4540, SCS, FIU Database Modeling Using the Entity-Relationship Model (Chapter 3)
Entity/Relationship Modelling
CS 405G Introduction to Database Systems
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
1 © Prentice Hall, 2002 Chapter 3: Modeling Data in the Organization Modern Database Management 7th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R.
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.
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.
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Introduction to Database Systems Conceptual Modeling
Chapter 5 Entity–Relationship Modeling
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Introduction to Database Systems Mapping ER Models to Relational Schemas Irvanizam Zamanhuri, M.Sc Informatics (Computer Science) Study Program Syiah Kuala.
(Extended) Entity Relationship Modelling and Mappings to the Relational Data Model.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 1 © Akhilesh Bajaj, 2000, 2002, 2003, 2004.
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
© Pearson Education Limited, Chapter 7 Entity-Relationship modeling Transparencies.
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:
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
CS 405G: Introduction to Database Systems Lecture 2 : Database Design I.
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.
3 & 4 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Keys Consists of one or more attributes that determine other.
Database Management Systems MIT Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz.
 Entity-relationship models (ERM) Entity-relationship models (ERM)  Simple E-R Diagram Simple E-R Diagram  Weak Entity Weak Entity  Strong Entity.
ITTelkom Entity Relationship Diagram (1) CS2343 Perancangan Basisdata Relasional.
Databases Illuminated Chapter 3 The Entity Relationship Model.
advanced data modeling
DatabaseIM ISU1 Fundamentals of Database Systems Chapter 3 Data Modeling Using Entity-Relationship Model.
Data Modeling Using the Entity-Relationship (ER) Data Model.
The Entity-Relationship Model, P. I R. Nakatsu. Data Modeling A data model is the relatively simple representation, usually graphic, of the structure.
Entity-Relationship Modeling. 2 Entity Type u Entity type –Group of objects with same properties, identified by enterprise as having an independent existence.
Data Modeling and the Entity-Relationship Model CS 475 Lecture Notes.
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.
The Relational Model Lecture #2 Monday 21 st October 2001.
Topic 3: ER – Entity Relationship Model (ERM) 6/12/
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
Comp 1100 Entity-Relationship (ER) Model
Simplified phases of Database Design
Entity-Relationship Model
Chapter 3 Data Modeling Using the Entity-Relationship Model
ER model Ashima Wadhwa.
Entity-Relationship Model
Entity Relationship Model
Entity-Relationship Modelling
Lecture3: Data Modeling Using the Entity-Relationship Model.
Entity Relationship Diagrams
Entity-Relationship Modelling
Database Modeling using Entity Relationship Model (E-R Model)
Conceptual Data Modeling Using Entities & Relationships
Practical Relevance Examples Class Laboratory
Entity Relation Model Tingting Zhang.
Presentation transcript:

Database Systems Lecture # 7 8 th Feb, 2011

Conceptual and Logical Design Person buys Product name pricenamessn Conceptual Model: Relational Model: (plus functional dependencies) Normalization:

University Data Requirements A student has a name, which consists of a given name and a family name, and a student ID. Each student is uniquely identified by his/her student ID. A course has a subject and a course ID and the type of equipment being used for the course. For each course, we want to record the number of students taking that course. A course is uniquely identified by its course ID. A student can be enrolled in an arbitrary number of courses, and an arbitrary number of students can be enrolled in a course. For each course in which they are enrolled students receive a lab mark and an exam mark. A course cannot exist if there is no student enrolled in it. A school is distinguished by the honour's degree that it awards. We also want to record to which faculty a school belongs. A student is registered with at most one school, while a school can have an arbitrary number of students.

University Data Requirements (contd.) A student is also registered for a year of study. A year of study is identified by a number between 1 and 4. A student is registered for only one year of study, but each year of study an have many students. For each member of staff we want to record their name and their room number. A member of staff is identified by the combination of these two pieces of data. Staff are appraised by other staff. A member of staff has no more than one appraiser. Students can be allocated to a member of staff as their tutor. A student can have no more than one tutor. The tutor and the student agree upon a time slot for regular meetings. For each year of study, there is one member of staff who acts as the year tutor. A member of staff can only be responsible for one year of study. Students can be registered for a year of study. Courses are taught by members of staff only. A course can have several teachers, and a staff member can teach several courses.

Conceptual Design with the ER Model The questions to ask: What are the entities (= objects, individuals) in the organization? Which relationships exist among the entities? What information do we want to store about these entities and relationships? What are the business rules of the organization? Which integrity constraints do arise from them? The answers are represented in an Entity Relationship Diagram (ER diagram)

Entities and Entity Sets/Types Entity: An object distinguishable from other objects (e.g., an employee) An entity is described by a set of attributes. Entity Set/Type: A collection of similar entities (e.g., all employees) All entities in an entity set have the same set of attributes. Each attribute has a domain. Each entity set has a key (i.e., one or more attributes whose values uniquely identify an entity)

Graphical Representation of Entity Types name given family STUDENT studno no. of students subject equip courseno COURSE Entity Sets are drawn as rectangles Attributes are drawn using ovals Simple vs. composite attributes Derived attributes are indicated by dashed lines The attributes making up the key are underlined

Relationships and Relationship Sets/Types Relationship: An association between two or more entities (e.g., “Kurt Cobain” is “enrolled” in “CS204”) Relationships may have attributes Relationship Set/Type: A collection of similar relationships An n-ary relationship type relates n entity types E1,…,En Each relationship involves n entities e1  E1,…,en  En

An Instance of a Relationship Type Course StudentEnrol ST1 ST2 ST3 ST5 C1 ST4 ST6 C2 C3 r1 r4 r3 r2 r5 r6 …. Enrol Course Student

Graphical Representation of Relationship Types Relationship sets are drawn as diamonds exammark no. of students labmark name given family STUDENT studno subject equip courseno COURSE ENROL

Roles and Recursive Relationships An entity type can participate in several relationship types and participate more than once in one relationship set (taking on different “roles”) STAFF name appraiser appraisee APPRAISAL roomno

Multiplicity (cardinality) of Relationship Types one-one: many-one: many-many: abcdabcd abcdabcd abcdabcd 11 1 Sometimes letters m, n are used to indicate the “many” side of relationships. N M M

Participation Constraints Participation constraints specify whether or not an entity must participate in a relationship set When there is no participation constraint, it is possible that an entity will not participate in a relationship set When there is a participation constraint, the entity must participate at least once Participation constraints are drawn using a double line from the entity set to the relationship set

Mandatory Participation Department StaffWorks_for ST1 ST2 ST3 ST5 D1 ST4 ST6 D2 D3 r1 r4 r3 r2 r5 r6 …. Works-for Department Staff 1 N

Optional and Mandatory Participation Department StaffManages ST1 ST2 ST3 ST5 D1 ST4 ST6 D2 D3 r1 r3 r2 …. manages Department Staff 1 1

Many:many Relationship Type with Optional and Mandatory Participation Course StaffTeaches ST1 ST2 ST3 C1 ST4 …. C2 C3 r1 r4 r3 r2 r5 r6 C4 …. Teaches Course Staff N M

Recursive Relationship Type with Optional Participation Staff Manages ST1 ST2 ST3 ST5 ST4 ST6 r1 r3 r2 r4 r5 1. Manager 2. Employee unmanaged …. Manages Staff ManagerEmployee

Summary: Properties of Relationship Types Degree The number of participating entity types Cardinality ratios The number of instances of each of the participating entity types which can take part in a single instance of the relationship type 1:1, 1:many, many:1, many:many Participation (optionality) Whether an entity instance has to participate in a relationship instance Represented with a double line

Attributes in ER Modelling For every attribute we define Domain or data type Format, i.e., composite or atomic whether it is derived and whether it can be null Every entity type must have a key attribute or set of attributes exammark no. of students m n labmark name given family STUDENT studno subject equip courseno COURSE ENROL

ER Model of the University Requirements studno name given family hons slot labmark exammark STUDENT SCHOOL YEAR ENROL YEARREG REG TUTOR YEARTUTOR STAFF COURSE courseno subject equip name year faculty appraiser appraisee APPRAISAL TEACH m n 1 m m n m m 1 m 1 roomno

Roles in Non-recursive Relationships Also in non-recursive relationships we may annotate relationship links with the roles that entities play in the relationship STUDENT SUPERVISE STAFF EXAMINE 1 1 m m studno name given family name roomno

Multi-way (non-binary) Relationship STAFF p m TUTORS name given family STUDENT studno COURSE subject equip courseno STAFF name n roomno slot Relationships can involve more than two entity types…

Constraints Reminder: A constraint = an assertion about the database that must be true at all times

Modeling Constraints Finding constraints is part of the modeling process. They reflect facts that hold in the world or business rules of an organization. Examples: Keys: uniquely identifies a person Single-value constraints: a student can enroll in one degree Referential integrity constraints: if you work for a company, it must exist in the database Domain constraints: ages are between 21 and 60 Cardinality constraints: at most 50 students enroll in a course

Keys A key is a set of attributes that uniquely identify an object or entity: Person: social-security-number (U.S.) national insurance number (U.K.) name name + address name + address + dob Perfect keys are often hard to find, so organizations usually invent something.

Variants of Keys Multi-attribute (composite) keys: E.g. name + address Multiple keys: E.g social-security-number, name + address