Carnegie Mellon Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications C. Faloutsos E-R diagrams.

Slides:



Advertisements
Similar presentations
Chapter 2: Entity-Relationship Model
Advertisements

CMU SCS Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications C. Faloutsos - A. Pavlo Lecture#2: E-R diagrams.
Convert ER to Relational Database Entity relation Entity relation Attributes attributes Attributes attributes Primary key primary key Primary key primary.
Temple University – CIS Dept. CIS616– Principles of Database Systems
Relational Database. Relational database: a set of relations Relation: made up of 2 parts: − Schema : specifies the name of relations, plus name and type.
DBMS, RDBMS Concepts BBSR, 06\11\2012, Prof. Suraj Sharma, IIIT-Bh Insert Client/Partner logo.
Weak Entity Sets An entity set that does not have a primary key is referred to as a weak entity set. The existence of a weak entity set depends on the.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
Text-Book Chapters (7 and 8) Entity-Relationship Model
The (min,max) notation (1,1) (0,1) (1,N) (1,1). SUMMARY OF ER-DIAGRAM NOTATION FOR ER SCHEMAS Meaning ENTITY TYPE WEAK ENTITY TYPE RELATIONSHIP TYPE IDENTIFYING.
1 Data Modelling Which data to include in the database.
Chapter 2: Entity-Relationship Model (Continued)
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Reduction of an E-R Schema to Tables A database which conforms to an E-R diagram can be represented.
Chapter 3: Modeling Data in the Organization
Database System Concepts, 5th Ed. Chapter 6: Entity-Relationship Model.
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.
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.
1.1 CAS CS 460/660 Relational Model. 1.2 Review E/R Model: Entities, relationships, attributes Cardinalities: 1:1, 1:n, m:1, m:n Keys: superkeys, candidate.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Entity-Relationship.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
EXAMPLE. Subclasses and Superclasses Entity type may have sub-grouping that need to be represented explicitly. –Example: Employee may grouped into.
The Hong Kong University of Science and Technology COMP3311 Spring 2013 Tutorial 1 ER Diagrams.
 Entity-relationship models (ERM) Entity-relationship models (ERM)  Simple E-R Diagram Simple E-R Diagram  Weak Entity Weak Entity  Strong Entity.
ICOM 5016 – Introduction to Database Systems Lecture 9 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
COMP231 Tutorial 1 ER Model and ER to Relational Schema.
1 Data Modeling : ER Model…. Lecture Summary so for …. ER Model Entity, Attribute, Key Relationships Instance Diagram.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan Lecture-03 Introduction –Data Models Lectured by, Jesmin Akhter.
Weak Entity Sets A weak entity is an entity that cannot exist in a database unless another type of entity also exists in that database. Weak entity meets.
ICOM 5016 – Introduction to Database Systems Lecture 5 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Carnegie Mellon Carnegie Mellon Univ. Dept. of Computer Science Database Applications C. Faloutsos Relational model.
Computing & Information Sciences Kansas State University Friday, 26 Sep 2008CIS 560: Database System Concepts Lecture 13 of 42 Friday, 26 September 2008.
Keys for Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set. – (customer-id, account-number)
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
advanced data modeling
Lecture 03 Entity-Relationship Diagram. Chapter Outline.
Data Modeling Using the Entity-Relationship (ER) Data Model.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 2 © Akhilesh Bajaj, 2000, 2002, 2003, 2004,
CST203-2 Database Management Systems Lecture 4. Student entity NIDFNameLNameRegNoExamIdBirthdate.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
DBMS ER model-2 Week 6-7.
CS157A Lecture 4 ER Model 2 Prof. Sin-Min Lee Department of Computer Science San Jose State University.
Carnegie Mellon Carnegie Mellon Univ. Dept. of Computer Science Database Applications C. Faloutsos Database design and normalization.
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.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts - 6 th Edition Chapter 7: Entity-Relationship Model.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Entity-Relationship.
CS3431-B111 The Entity- Relationship Model Part II. Instructor: Mohamed Eltabakh
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
Chapter 2: Entity-Relationship Model
COP Introduction to Database Structures
Faloutsos - Pavlo C. Faloutsos - A. Pavlo Lecture#2: E-R diagrams
Entity-Relationship Model
Chapter 2: Entity-Relationship Model
Entity-Relationship Model
Outline of the ER Model By S.Saha
Chapter 2: Entity-Relationship Model
Session 2 Welcome: The seventh learning sequence
Faloutsos - Pavlo C. Faloutsos - A. Pavlo Lecture#2: E-R diagrams
Chapter 6: Entity-Relationship Model
Relational Database Design by ER- and EER-to-Relational Mapping
Chapter 7: Entity-Relationship Model
Weak Entity Sets An entity set that does not have a primary key is referred to as a weak entity set. The existence of a weak entity set depends on the.
Chapter 7: Entity-Relationship Model
Chapter 2: Entity-Relationship Model
CS4222 Principles of Database System
Relational Database Design by ER-to-Relational Mapping
Presentation transcript:

Carnegie Mellon Carnegie Mellon Univ. Dept. of Computer Science Database Applications C. Faloutsos E-R diagrams

Carnegie Mellon C. Faloutsos2 Overview concepts –Entities –Relationships –Attributes –Specialization/Generalization –Aggregation turning E-R diagrams to tables

Carnegie Mellon C. Faloutsos3 Tools Entities (‘entity sets’) Relationships (‘rel. sets’) and mapping constraints attributes NM P

Carnegie Mellon C. Faloutsos4 Example Students, taking courses, offered by instructors; a course may have multiple sections; one instructor per course nouns -> entity sets verbs -> relationships

Carnegie Mellon C. Faloutsos5 STUDENT name ssn... INSTRUCTOR issn

Carnegie Mellon C. Faloutsos6 STUDENT name ssn... COURSE c-id c-name but: sections of course (with different instructors)? INSTRUCTOR issn

Carnegie Mellon C. Faloutsos7 COURSE c-id INSTRUCTOR issn STUDENT ssn SECTION s-id but: s-id is not unique...

Carnegie Mellon C. Faloutsos8 COURSE c-id INSTRUCTOR issn STUDENT ssn SECTION s-id takes N M

Carnegie Mellon C. Faloutsos9 COURSE c-id INSTRUCTOR STUDENT SECTION s-id takes N M N 1 teaches

Carnegie Mellon C. Faloutsos10 Cardinalities 1 to 1 (example?) 1 to N N to M

Carnegie Mellon C. Faloutsos11 COURSE c-id INSTRUCTOR STUDENT SECTION s-id takes N M N 1 teaches has N 1

Carnegie Mellon C. Faloutsos12 More details ‘weak’ entities: if they need to borrow a unique id from a ‘strong entity - DOUBLE box. ‘c-id’ + ‘s-id’: unique id for SECTION discriminator (eg., ‘s-id’) COURSE c-id SECTION s-idhas N 1

Carnegie Mellon C. Faloutsos13 More details self-relationships - example?

Carnegie Mellon C. Faloutsos14 EMPLOYEE manages 1 N

Carnegie Mellon C. Faloutsos15 More details 3-way and k-way relationships? EMPLOYEE uses PROJECT TOOL N M P

Carnegie Mellon C. Faloutsos16 More details - attributes candidate key (eg., ssn; employee#) primary key (a cand. key, chosen by DBA) superkey (eg., (ssn, address) ) multivalued or set-valued attributes (eg., ‘dependents’ for EMPLOYEE) derived attributes (eg., 15% tip)

Carnegie Mellon C. Faloutsos17 More details: in the text: (eg., ‘total participation’) INSTRUCTOR SECTION 0:N 1:1 teaches

Carnegie Mellon C. Faloutsos18 Overview concepts –Entities –Relationships –Attributes –Specialization/Generalization –Aggregation turning E-R diagrams to tables

Carnegie Mellon C. Faloutsos19 Specialization eg., students: part time (#credit- hours) and full time (major) STUDENT name ssn PT-STUDENT #credits FT-STUDENT major IS-A

Carnegie Mellon C. Faloutsos20 Observations Generalization: exact reverse of ‘specialization’ attribute inheritance could have many levels of an IS-A hierarchy

Carnegie Mellon C. Faloutsos21 Aggregation CPU HD treat a relationship as an entity rarely used N M MAKER

Carnegie Mellon C. Faloutsos22 Overview concepts –Entities –Relationships –Attributes –Specialization/Generalization –Aggregation turning E-R diagrams to tables

Carnegie Mellon C. Faloutsos23 COURSE c-id INSTRUCTOR STUDENT SECTION s-id takes N M N 1 teaches has N 1 grade

Carnegie Mellon C. Faloutsos24 Strong entities just list the attributes, and underline the primary key, eg. STUDENT(ssn, name, address)

Carnegie Mellon C. Faloutsos25 Multivalued attributes Eg., EMPLOYEE with many dependents: a new table, with (ssn, dependent-name)

Carnegie Mellon C. Faloutsos26 Relationships get primary keys all involved entities primary key - depends on cardinality –1 to 1: either eg EMPLOYEE( ssn, empno, name,...) –1 to N: the key of the ‘N’ part eg. TEACHES( issn, c-id, s-id) –N to M: both keys - eg TAKES( ssn, c-id, s-id, grade)

Carnegie Mellon C. Faloutsos27 Relationships 1 to N: no need for separate table - eg., SECTION( issn, room-num, c-id, s-id) instead of SECTION1(c-id, s-id, room-num) TEACHES(issn, c-id, s-id) for rel. between strong and corresponding weak entity, no need for table, at all!

Carnegie Mellon C. Faloutsos28 Generalization/Spec. Two solutions: - one table for each or - no table for super-entity (pros and cons?)

Carnegie Mellon C. Faloutsos29 Generalization/Special. Eg., STUDENT(ssn, name, address) PT-STUDENT( FT-STUDENT(

Carnegie Mellon C. Faloutsos30 Generalization/Special. Eg., STUDENT(ssn, name, address) PT-STUDENT( ssn, num-credits) FT-STUDENT( ssn, major)

Carnegie Mellon C. Faloutsos31 Generalization/Special. no super-entity: [STUDENT(ssn, name, address)] PT-STUDENT( ssn, num-credits FT-STUDENT( ssn, major

Carnegie Mellon C. Faloutsos32 Generalization/Special. no super-entity: [STUDENT(ssn, name, address)] PT-STUDENT( ssn, num-credits, name, address) FT-STUDENT( ssn, major, name, address)

Carnegie Mellon C. Faloutsos33 Aggregation make table, with primary keys of all involved entities

Carnegie Mellon C. Faloutsos34 Overview concepts –Entities –Relationships –Attributes –Specialization/Generalization –Aggregation turning E-R diagrams to tables

Carnegie Mellon C. Faloutsos35 Summary E-R Diagrams: a powerful, user-friendly tool for data modeling: –Entities (strong, weak) –Attributes (primary keys, discriminators, derived, multivalued) –Relationships (1:1, 1:N, N:M; multi-way) –Generalization/Specialization; Aggregation

Carnegie Mellon C. Faloutsos36 Summary - cont’d (strong) entity set weak entity set relationship set identifying rel. set for weak entity attribute multivalued attribute derived attribute

Carnegie Mellon C. Faloutsos37 Summary - cont’d primary key A discriminator A cardinalities N M with limits l:h l’:h’ IS-A total generalization (e.t.c. - see book for alternative notations)

Carnegie Mellon C. Faloutsos38 Conclusions E-R Diagrams: a powerful, user-friendly tool for data modeling.