The Entity-Relationship Model (ER Model) - Part 2
|
|
- Kelley Henderson
- 5 years ago
- Views:
Transcription
1 Lecture 4 The Entity-Relationship Model (ER Model) - Part 2 By Michael Hahsler Based on slides for CS145 Introduction to Databases (Stanford)
2 Lecture 4 > Section 2 What you will learn about in this section 1. Relationships: multiplicity, multi-way 2. Design considerations 3. Conversion to SQL 4. Advanced concepts 2
3 Lecture 4 > Section 2 > Relationships- Multiplicity & Multi-way Multiplicity of ER Relationships One-to-one: X Y a b c d X 1 1 Y Using Chen s Notation Many-to-one: a b c d X N 1 Y One-to-many: a b c d X 1 N Y a b c d Many-to-many: X Y N M 3
4 Lecture 4 > Section 1 > Relationships Multiplicity of ER Relationships name category name price Product N 1 Makes Company How to read a relationship in both directions: 1. A product is made by a one company 2. A company makes many product 4
5 Lecture 4 > Section 2 > Relationships- Multiplicity & Multi-way name category name price Product N 1 makes Company 1 stockprice No specified cardinality often means N:M, or we do not want to decide, yet. buys employs Person address name ssn N What does this say? 5
6 Lecture 4 > Section 2 > Relationships- Multiplicity & Multi-way Multi-way Relationships How do we model A person buys a product in a store? Product Purchase Store Person 6
7 Lecture 4 > Section 2 > Relationships- Multiplicity & Multi-way Multiplicity in Multiway Relationships Q: What do the 1s and the N mean? Product N Purchase 1 Store 1 Person 7
8 Lecture 4 > Section 2 > Relationships- Multiplicity & Multi-way Multiplicity in Multiway Relationships Better: many to many to many relationship Product N Purchase N Store N Person 8
9 Lecture 4 > Section 2 > Design decisions Conversion of Multi-way Relationship to New Entity + Binary Relationships? Multi-way Relationship Entity + Binary Product ID date N ProductOf 1 Product Purchase Store Purchase N StoreOf 1 Store Person Multiple purchases per (product, store, person) possible here! N BuyerOf 1 Person 9
10 Lecture 4 > Section 2 > Design decisions 3. Design Principles What s wrong with these examples? Product 1 Purchase N Person Country President Person 10
11 Lecture 4 > Section 2 > Design decisions Design Principles: What s Wrong? Product date Purchase Store personaddr personname 11
12 Lecture 4 > Section 2 > Design decisions Design Principles: What s Wrong? - Fixed Product N date M Purchase N 1 Store N 1 Person 12
13 Lecture 4 > Section 2 > Design decisions Examples: Entity vs. Attribute Should address be an attribute? Or an entity? Addr 1 Addr 2 Employee Street Addr Address AddrOf 1 N Employee ZIP 13
14 Lecture 4 > Section 2 > Design decisions Examples: Entity vs. Attribute Should address be an attribute? Addr 1 Addr 2 Employee How do we handle employees with more than two addresses? How do we handle addresses where internal structure of the address (e.g. zip code, state) is useful? 14
15 Lecture 4 > Section 2 > Design decisions Examples: Entity vs. Attribute Use an entity Street Addr ZIP Address N AddrOf 1 Employee In general, when we want to record several values, we choose a separate entity. 15
16 Lecture 4 > Section 2 > Conversion to SQL From ER Diagrams to Relational Schema Key concept: Both Entity sets and Relationships become relations (tables in RDBMS) 16
17 Lecture 4 > Section 2 > Conversion to SQL From ER Diagrams to Relational Schema An entity set becomes a relation (multiset of tuples / table) name price Product category Each tuple is one entity Each tuple is composed of the entity s attributes, and has the same primary key Product name price category Gizmo Camera Gizmo Edible 17
18 Lecture 4 > Section 2 > Conversion to SQL From ER Diagrams to Relational Schema price category name CREATE TABLE Product( name CHAR(50) PRIMARY KEY, price DOUBLE, category VARCHAR(30) ) Product Product name price category Gizmo Camera Gizmo Edible 18
19 Lecture 4 > Section 2 > Conversion to SQL From ER Diagrams to Relational Schema (N:M) A relation between entity sets A 1,, A N also becomes a multiset of tuples / a table price name category Product N date Purchased M firstname Person lastname Each row/tuple is one relation, i.e. one unique combination of entities (a 1,,a N ) Each row/tuple is composed of the union of the entity sets attributes has the entities primary keys as foreign keys has the union of the entity sets keys as primary key Purchased name firstname lastname date Gizmo1 Bob Joe 01/01/15 Gizmo2 Joe Bob 01/03/15 Gizmo1 JoeBob Smith 01/05/15 19
20 Lecture 4 > Section 2 > Conversion to SQL From ER Diagrams to Relational Schema (N:M) CREATE TABLE Purchased( name CHAR(50), firstname CHAR(50), lastname CHAR(50), date DATE, PRIMARY KEY (name, firstname, lastname), FOREIGN KEY (name) REFERENCES Product, FOREIGN KEY (firstname, lastname) REFERENCES Person ) price name category Product Purchased N date Purchased M firstname lastname Person name firstname lastname date Gizmo1 Bob Joe 01/01/15 Gizmo2 Joe Bob 01/03/15 Gizmo1 JoeBob Smith 01/05/15 20
21 Lecture 4 > Section 2 > Conversion to SQL From ER Diagrams to Relational Schema (1:N) A 1:N relationship can be implemented without an extra table. Add the primary key of the 1 side to the table for the N side entity. ID name Customer 1 N has ID Address Street Number ZIPCode Address ID Number Street ZIPCode CustID Main St Willow Dr Nowhere Pl
22 Lecture 4 > Section 2 > Conversion to SQL From ER Diagrams to Relational Schema (1:N) CREATE TABLE Address( ID CHAR(50), Number CHAR(50), Street CHAR(50), ZIPCode CHAR(10), PRIMARY KEY (ID), FOREIGN KEY (CustID) REFERENCES Customer, ) name ID Customer Address 1 N has ID Street Address Number ZIPCode ID Number Street ZIPCode CustID Main St Willow Dr Nowhere Pl
23 Lecture 4 > Section 2 > Conversion to SQL From ER Diagram to Relational Schema How do we represent this as a relational schema? name category date firstname lastname price Product Purchased Person name address Store 23
24 Alternative Notations
25 Lecture 4 > Section 2 > ACTIVITY Add Multiplicity to your ER diagram Also make sure to add (new concepts underlined): A player can only belong to one team, a play can only be in one game, a pass/run..? Multiple players Tackle a single person in a play Players can achieve a Personal Record linked to a specific Game and Play Players have a weight which changes in on vs. off-season 25
26 Lecture 4 > Section 3 3. Advanced ER Concepts 26
27 Lecture 4 > Section 3 What you will learn about in this section 1. Subclasses 2. Constraints 3. Weak entity sets 4. Normal Forms 27
28 Lecture 4 > Section 3 > Subclasses & OO Modeling Subclasses Some objects in a class may be special, i.e. worthy of their own class Define a new class? But what if we want to maintain connection to current class? Better: define a subclass Ex: Products Software products Educational products We can define subclasses in ER! 28
29 Lecture 4 > Section 3 > Subclasses & OO Modeling Subclasses name price Product isa Child subclasses contain all the attributes of all of their parent classes plus the new attributes shown attached to them in the ER diagram Software Product Educational Product platforms agegroup 29
30 Lecture 4 > Section 3 > Subclasses & OO Understanding Subclasses Think in terms of records; ex: Software Product price name Product isa Educational Product Product SoftwareProduct name price name price platforms Child subclasses contain all the attributes of all of their parent classes plus the new attributes shown attached to them in the ER diagram platforms agegroup EducationalProduct name price agegroup 30
31 Lecture 4 > Section 3 > Subclasses & OO Think like tables Product name price category Gizmo 99 gadget name Camera 49 photo price Toy 39 gadget Product Sw.Product name platforms isa Ed.Product Gizmo unix Software Product Educational Product name agegroup platforms agegroup Gizmo todler Toy retired 31
32 Lecture 4 > Section 3 > Subclasses & OO IsA Review If we declare A IsA B then every A is a B We use IsA to Add descriptive attributes to a subclass To identify entities that participate in a relationship No need for multiple inheritance 32
33 Lecture 4 > Section 3 > Subclasses & OO Modeling UnionTypes With Subclasses Person FurniturePiece Company Suppose each piece of furniture is owned either by a person, or by a company. How do we represent this? 33
34 Lecture 4 > Section 3 > Subclasses & OO Modeling Union Types with Subclasses Say: each piece of furniture is owned either by a person, or by a company Solution 1. Acceptable, but imperfect (What s wrong?) Person FurniturePiece Company 1 N N 1 ownedbyperson ownedbycomp 34
35 Lecture 4 > Section 3 > Subclasses & OO Modeling Union Types with Subclasses Solution 2: better (though more laborious) FurniturePiece N What is happening here? ownedby Person 1 Owner Company isa 35
36 Lecture 4 > Section 3 > Constraints Constraints in ER Diagrams Finding constraints is part of the ER modeling process. Commonly used constraints are: Keys: Implicit constraints on uniqueness of entities Ex: An SSN uniquely identifies a person Single-value constraints: Ex: a person can have only one father Referential integrity constraints: Referenced entities must exist Ex: if you work for a company, it must exist in the database Other constraints: Ex: peoples ages are between 0 and 150 Recall FOREIGN KEYs! 36
37 Lecture 4 > Section 3 > Constraints Participation Constraints: Partial v. Total Product makes Company Are there products made by no company? Companies that don t make a product? Product makes Company Double line indicates total participation (i.e. here: all products are made by a company) 37
38 Lecture 4 > Section 3 > Constraints Single Value Constraints N 1 makes vs. makes 38
39 Lecture 4 > Section 3 > Constraints Referential Integrity Express that each product is made by exactly one company: Total Participation + Multiplicity Product N 1 makes Company Each product made by at least one company. Each product made by at most one company. 39
40 Lecture 4 > Section 3 > Constraints Keys in ER Diagrams Underline keys: name category price Product Note: no formal way to specify multiple keys in ER diagrams Person address name ssn 40
41 Lecture 4 > Section 3 > Weak Entity Sets Weak Entity Sets Entity sets are weak when their key comes from other classes to which they are related. Team N 1 affiliation University sport number name Football team v. The Stanford Football team (E.g., Berkeley has a football team too, sort of) 41
42 Lecture 4 > Section 3 > Weak Entity Sets Weak Entity Sets Entity sets are weak when their key comes from other classes to which they are related. Team N 1 affiliation University sport number name number is a partial key. (denote with dashed underline). University is called the identifying owner. 42 Participation in affiliation must be total. Why?
43 Lecture 4 > Summary ER Summary ER diagrams are a visual syntax that allows technical and non-technical people to talk For conceptual design Basic constructs: entity, relationship, and attributes A good design is faithful to the constraints of the application, but not overzealous 43
44 Lecture 5 > Section 1 > Overview Design Theory Design theory is about how to represent your data to avoid anomalies. It is a mostly mechanical process Tools can carry out routine portions We have a notebook implementing all algorithms! We ll play with it in the activities!
45 Lecture 5 > Section 1 > Overview Normal Forms 1 st Normal Form (1NF) = All tables are flat 2 nd Normal Form = disused Boyce-Codd Normal Form (BCNF) 3 rd Normal Form (3NF) DB designs based on functional dependencies, intended to prevent data anomalies 4 th and 5 th Normal Forms
46 Lecture 5 > Section 1 > Overview 1 st Normal Form (1NF) Student Mary Joe Courses {CS145,CS229} {CS145,CS106} Student Mary Mary Joe Joe Courses CS145 CS229 CS145 CS106 In 1 st NF 1NF: Entries have to be single values not a list!
47 Lecture 5 > Section 1 > Data anomalies & constraints Issues with 1NF Student Course Room Mary CS145 B01 Joe CS145 B01 Sam CS145 B If every course is in only one room, contains redundant information!
48 Lecture 5 > Section 1 > Data anomalies & constraints Issues with 1NF Student Course Room Mary CS145 B01 Joe CS145 C12 Sam CS145 B If we update the room number for one tuple, we get inconsistent data = an update anomaly
49 Lecture 5 > Section 1 > Data anomalies & constraints Issues with 1NF Student Course Room If everyone drops the class, we lose what room the class is in! = a delete anomaly
50 Lecture 5 > Section 1 > Data anomalies & constraints Issues with 1NF Student Course Room CS229 C12 Mary CS145 B01 Joe CS145 B01 Sam CS145 B Similarly, we can t reserve a room without students = an insert anomaly
51 Lecture 5 > Section 1 > Data anomalies & constraints Issues with 1NF: Split Table Student Course Mary CS145 Joe CS145 Sam CS Course Room CS145 B01 CS229 C12 Is this form better? Redundancy? Update anomaly? Delete anomaly? Insert anomaly? How do we decide how to split the table?
52 Lecture 5 > Section 1 > Data anomalies & constraints ER Model (if done right) already creates 3NF Student Course CourseNr Room Enrollment N 1 Enrollment for Course Corresponding tables: Enrollment Student Course Mary CS145 Joe CS145 Sam CS Course CourseNr CS145 CS229 Room B01 C12
53 Lecture 5 > Section 1 > Data anomalies & constraints 3NF Each attribute needs to rely on the complete primary key (= 2NF). All attributes only directly depend on the primary key (no transitive dependencies). Student Course Room Grade Mary CS145 B01 NULL Joe CS145 B01 A Sam CS145 B01 NULL Student Course Grade Mary CS145 NULL Joe CS145 A Sam CS145 NULL CourseNr CS145 CS229 Room B01 C In short: The data depends on the key [1NF], the whole key [2NF] and nothing but the key [3NF]
54 Conclusion Databases should be in 3. NF to avoid anomalies. Some databases are poorly designed leading to bad data quality as a result of anomalies. Sometimes databases are on purpose not designed in 3. NF. E.g., for performance or other reasons. In this case, the application/user needs to prevent anomalies (which does not always work). For analytics purposes we often need a single table with all the data. Essentially this table is in 1. NF
Lecture 5. Lecture 5: The E/R Model
Lecture 5 Lecture 5: The E/R Model Lecture 2 Announcements! 1. PS1 due at midnight! Please go over Piazza for hints. We will post solutions tomorrow. Grades coming soon! 2. Project part 1 out today! 3.
More informationLecture 4. Lecture 4: The E/R Model
Lecture 4 Lecture 4: The E/R Model Lecture 4 Today s Lecture 1. E/R Basics: Entities & Relations ACTIVITY: Crayon time! 2. E/R Design considerations ACTIVITY: Crayon time pt. II 3. Advanced E/R Concepts
More informationIntroduction to Database Systems CSE 414
Introduction to Database Systems CSE 414 Lecture 17: E/R Diagrams CSE 414 - Spring 2013 1 Announcements HW5 (XML) due Wednesday New webquiz coming by mid-week Today: E/R diagrams (4.1-4.6) CSE 414 - Spring
More informationIntroduction to Data Management CSE 344
Introduction to Data Management CSE 344 Lecture 15: E/R Diagrams Guest Lecturer: Sudeepa Roy CSE 344 - Fall 2013 1 Announcements WQ6 due Thursday (there is no WQ5 ) Homework 4 posted, due Friday Midterm:
More informationL11: ER modeling 4. CS3200 Database design (sp18 s2) 2/15/2018
L11: ER modeling 4 CS3200 Database design (sp18 s2) https://course.ccs.neu.edu/cs3200sp18s2/ 2/15/2018 132 Announcements! Keep coming with your name plates Mid-course feedback for instructor - Exam: Cheat
More informationIntroduction to Data Management CSE 344
Introduction to Data Management CSE 344 Lecture 17: E/R Diagrams and Constraints CSE 344 - Winter 2016 1 Announcements HW5 due this Friday Please note minor update to the instructions WQ6 due next Wednesday
More informationIntroduction to Data Management CSE 344
Introduction to Data Management CSE 344 Lecture 17: E/R Diagrams and Constraints CSE 344 - Fall 2015 1 Database Design Why do we need it? Need a way to model real world entities in terms of relations Not
More informationDatabase Systems CSE 414
Database Systems CSE 414 Lecture 22: E/R Diagrams (4.1-6) and Constraints (7.1-2) CSE 414 - Fall 2017 1 Announcements HW7 will be posted on Tuesday and due on Dec. 1 st 11pm WQ6 will be posted on Tuesday
More informationEntity/Relationship Modelling
Entity/Relationship Modelling Lecture 4 1 Outline E/R model (Chapter 5) From E/R diagrams to relational schemas (Chapter 5) Constraints in SQL (Chapter 4) 2 1. Database Design Modelling Decide which part
More informationDatabase Systems CSE 414
Database Systems CSE 414 Lecture 17: E/R Diagrams (4.1-6) and Constraints (7.1-2) CSE 414 - Spring 2017 1 Announcements HW5 due on Thursday (was Tuesday before) WQ6 due on Sunday CSE 414 - Spring 2017
More informationIntroduction to Database Systems CSE 414. Lecture 19: E/R Diagrams
Introduction to Database Systems CSE 414 Lecture 19: E/R Diagrams CSE 414 - Spring 2018 1 Class Overview Unit 1: Intro Unit 2: Relational Data Models and Query Languages Unit 3: Non-relational data Unit
More information3. Advanced E/R Concepts
3. Advanced E/R Concepts 75 What you will learn about in this section Subclasses & connection to OO Constraints Weak entity sets 76 Modeling Subclasses Some objects in a class may be special, i.e. worthy
More informationCSE 344 JULY 30 TH DB DESIGN (CH 4)
CSE 344 JULY 30 TH DB DESIGN (CH 4) ADMINISTRIVIA HW6 due next Thursday uses Spark API rather than MapReduce (a bit higher level) be sure to shut down your AWS cluster when not in use Still grading midterms...
More informationDatabase Design Process Entity / Relationship Diagrams
Announcements Database Systems CSE 414 Lecture 22: E/R Diagrams (4.1-6) and Constraints (7.1-2) HW7 will be posted on Tuesday and due on Dec. 1 st 11pm WQ6 will be posted on Tuesday and due on Nov. 30th
More informationCSC 261/461 Database Systems Lecture 8. Fall 2017
CSC 261/461 Database Systems Lecture 8 Fall 2017 Announcement Project 2 is out. Not a group project! CSC 261, Spring 2017, UR Agenda More about ER model ER model to Relation (Table) CSC 261, Spring 2017,
More informationAnnouncements. Database Design. Database Design. Database Design Process. Entity / Relationship Diagrams. Introduction to Data Management CSE 344
Announcements Introduction to Data Management CSE 344 HW5 due this Friday Please note minor up to the instructions WQ6 due next Wednesday Lecture 17: E/R Diagrams and Constraints 1 2 Database Design What
More informationCSC 261/461 Database Systems Lecture 8. Spring 2018
CSC 261/461 Database Systems Lecture 8 Spring 2018 Announcement Quiz No New Problem Set Study Chapter 5, 6, and 7 Go through the problem set Announcement Project 2 Part 1 Already out. Workshop covered
More informationConceptual Design with ER Model
Conceptual Design with ER Model Lecture #2 1/24/2012 Jeff Ballard CS564, Spring 2014, Database Management Systems 1 See the Moodle page Due February 7 Groups of 2-3 people Pick a team name Homework 1 is
More informationCSE 344 MAY 14 TH ENTITIES
CSE 344 MAY 14 TH ENTITIES EXAMS Scores Final grades Concerned? Email about meeting Final Exam 35% of grade ADMINISTRIVIA HW6 Due Wednesday OQ6 Out Wednesday HW7 Out Wednesday E/R + Normalization DATABASE
More information3. Advanced E/R Concepts
What you will learn about in this section Subclasses & connection to OO 3. Advanced E/R Concepts Constraints Weak entity sets 75 76 Modeling Subclasses Modeling Subclasses Some objects in a class may be
More information2. E/R Design Considerations
2. E/R Design Considerations 32 What you will learn in this section Relationships cont d: multiplicity, multi-way Design considerations Conversion to SQL 33 Multiplicity of E/R Relationships Multiplicity
More informationAnnouncements. Database Design. Database Design. Database Design Process. Entity / Relationship Diagrams. Database Systems CSE 414
Announcements Database Systems CSE 414 HW5 due on Thursday (was Tuesday before) WQ6 due on Sunday Lecture 17: E/R Diagrams (4.1-6) and Constraints (7.1-2) 1 2 Database Design What it is: Starting from
More informationENTITY-RELATIONSHIP MODEL. CS 564- Spring 2018
ENTITY-RELATIONSHIP MODEL CS 564- Spring 2018 WHAT IS THIS LECTURE ABOUT E/R Model: entity sets, attribute relation: binary, multi-way relationship roles, attributes on relationships subclasses (ISA) weak
More informationIntroduction to Data Management CSE 344
Introduction to Data Management CSE 344 Lectures 18: Design Theory CSE 344 - Winter 2017 1 Database Design Process Lec 16 Conceptual Model: name product makes company Relational Model: Tables + constraints
More informationCSE 344 AUGUST 1 ST ENTITIES
CSE 344 AUGUST 1 ST ENTITIES EXAMS Will hand back after class Quartiles 1 0 67 2 68 74 3 74 82 4 82 100 (no one actually got 0 or 100) ADMINISTRIVIA HW6 due Wednesday Spark SQL interface much easier to
More informationDatabase design and implementation CMPSCI 645. Lecture 06: Constraints and E/R model
Database design and implementation CMPSCI 645 Lecture 06: Constraints and E/R model Constraints } Constraint: a property that we want our data to sa2sfy } Enforce by taking ac2ons: } Forbid an update }
More informationLectures 12: Design Theory I. 1. Normal forms & functional dependencies 2/19/2018. Today s Lecture. What you will learn about in this section
Today s Lecture Lectures 12: Design Theory I Professor Xiannong Meng Spring 2018 Lecture and activity contents are based on what Prof Chris Ré used in his CS 145 in the fall 2016 term with permission 1.
More informationL12: ER modeling 5. CS3200 Database design (sp18 s2) 2/22/2018
L12: ER modeling 5 CS3200 Database design (sp18 s2) https://course.ccs.neu.edu/cs3200sp18s2/ 2/22/2018 200 Announcements! Keep bringing your name plates J Exam 1 discussion: questions on grading: Piazza,
More informationIntroduction to Database Systems CSE 544. Lecture #2 January 16, 2007
Introduction to Database Systems CSE 544 Lecture #2 January 16, 2007 1 Review Questions: NULLS From Lecture 1: What is 3-valued logic? Why do we need it? What is a left outer join? Why do we sometimes
More informationCSE 344 MAY 11 TH ENTITIES
CSE 344 MAY 11 TH ENTITIES ADMINISTRIVIA HW6 Due next Wednesday (May 16) Section 7 slides very helpful HW7 Out Wednesday Due May 23 rd HW8 Out May 23 rd Due last day of class, Jun 1 Exam Graded and on
More informationCSC 261/461 Database Systems Lecture 6. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101
CSC 261/461 Database Systems Lecture 6 Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101 CSC 261/461 Database Systems Lecture 6 Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101 Announcement
More informationCSC 261/461 Database Systems Lecture 7
CSC 261/461 Database Systems Lecture 7 Spring 2018 Announcement Project 1 Milestone 1 is due Tonight Project 2 Part 1: will be out tonight! You should definitely go to workshops this week Workshop on Project
More informationCSE 544 Data Models. Lecture #3. CSE544 - Spring,
CSE 544 Data Models Lecture #3 1 Announcements Project Form groups by Friday Start thinking about a topic (see new additions to the topic list) Next paper review: due on Monday Homework 1: due the following
More informationThe Entity-Relationship Model (ER Model) - Part 1
Lecture 4 The Entity-Relationship Model (ER Model) - Part 1 By Michael Hahsler Based on slides for CS145 Introduction to Databases (Stanford) Lecture 4 > Section 1 Introduction to Database Design 2 Lecture
More informationCSC 261/461 Database Systems Lecture 10
CSC 261/461 Database Systems Lecture 10 Spring 2018 Please put away all electronic devices Announcements From now on, no electronic devices allowed during lecture Includes Phone and Laptop Why? For your
More informationHigh Level Database Models
ICS 321 Fall 2011 High Level Database Models Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 9/21/2011 Lipyeow Lim -- University of Hawaii at Manoa 1 Database
More informationHigh-Level Database Models (ii)
ICS 321 Spring 2011 High-Level Database Models (ii) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 1 Logical DB Design: ER to Relational Entity sets to
More informationWhere Are We? Next Few Lectures. Integrity Constraints Motivation. Constraints in E/R Diagrams. Keys in E/R Diagrams
Where Are We? Introduction to Data Management CSE 344 Lecture 15: Constraints We know quite a bit about using a DBMS Start with real-world problem, design ER diagram From ER diagram to relations -> conceptual
More informationThe Relational Data Model
The Relational Data Model Lecture 6 1 Outline Relational Data Model Functional Dependencies Logical Schema Design Reading Chapter 8 2 1 The Relational Data Model Data Modeling Relational Schema Physical
More informationIntroduction to SQL Part 1 By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford)
Introduction to SQL Part 1 By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford) Lecture 2 Lecture Overview 1. SQL introduction & schema definitions 2. Basic single-table queries
More informationConceptual Design. The Entity-Relationship (ER) Model
Conceptual Design. The Entity-Relationship (ER) Model CS430/630 Lecture 12 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Database Design Overview Conceptual design The Entity-Relationship
More informationData Modeling. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke
Data Modeling Yanlei Diao UMass Amherst Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Outline v Conceptual Design: ER Model v Relational Model v Logical Design: from ER to Relational 2 Conceptual
More informationEntity-Relationship Model. Purpose of E/R Model
Entity-Relationship Model Slides adapted from http://infolab.stanford.edu/~ullman/fcdb.html 1 Purpose of E/R Model The E/R model allows us to sketch database schema designs. Includes some constraints,
More informationThe Entity-Relationship Model. Overview of Database Design
The Entity-Relationship Model Chapter 2, Chapter 3 (3.5 only) Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Overview of Database Design Conceptual design: (ER Model is used at this stage.)
More informationDS Introduction to SQL Part 2 Multi-table Queries. By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford)
DS 1300 - Introduction to SQL Part 2 Multi-table Queries By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford) What you will learn about in this section 1. Foreign key constraints
More informationTranslating an ER Diagram to a Relational Schema
Translating an ER Diagram to a Relational Schema CS386/586 Introduction to Database Systems, Lois Delcambre 1999-2009 Slide 1 Translate each entity set into a table, with keys. Entity set: represented
More informationCONCEPTUAL DESIGN: ER TO RELATIONAL TO SQL
RELATIONAL MODEL TO Data Model CONCEPTUAL DESIGN: ER TO RELATIONAL TO How to represent Entity sets, Relationship sets, Attributes, Key and participation constraints, Subclasses, Weak entity sets...? 2
More informationER Model. CSC 343 Winter 2018 MICHAEL LIUT
ER Model CSC 343 Winter 2018 MICHAEL LIUT (MICHAEL.LIUT@UTORONTO.CA) DEPARTMENT OF MATHEMATICAL AND COMPUTATIONAL SCIENCES UNIVERSITY OF TORONTO MISSISSAUGA Overview of Database Design Conceptual Designs
More informationLecture 2: Introduction to SQL
Lecture 2: Introduction to SQL Lecture 2 Announcements! 1. If you still have Jupyter trouble, let us know! 2. Enroll to Piazza!!! 3. People are looking for groups. Team up! 4. Enrollment should be finalized
More informationCSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization
CSE 544 Principles of Database Management Systems Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization References R&G Book. Chapter 19: Schema refinement and normal forms Also relevant to
More informationCSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization
CSE 544 Principles of Database Management Systems Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization References R&G Book. Chapter 19: Schema refinement and normal forms Also relevant to this
More informationCSE 562 Database Systems
Goal CSE 562 Database Systems Question: The relational model is great, but how do I go about designing my database schema? Database Design Some slides are based or modified from originals by Magdalena
More informationEntity-Relationship Models: Good Design and Constraints
Entity-Relationship Models: Good Design and T. M. Murali September 29, 2010 T. M. Murali September 29, 2010 CS 4604: E/R Design and Guidelines Be faithful to the specification of the application. Avoid
More informationCIS 330: Applied Database Systems. ER to Relational Relational Algebra
CIS 330: Applied Database Systems ER to Relational Relational Algebra 1 Logical DB Design: ER to Relational Entity sets to tables: ssn name Employees lot CREATE TABLE Employees (ssn CHAR(11), name CHAR(20),
More informationLecture 3: SQL Part II
Lecture 3 Lecture 3: SQL Part II Copyright: These slides are the modified version of the slides used in CS145 Introduction to Databases course at Stanford by Dr. Peter Bailis Lecture 3 Today s Lecture
More informationMIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38
Student Info StudentID: Center: ExamDate: MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: 1356458 Time: 60 min Marks: 38 BC080402322 OPKST 5/28/2010 12:00:00 AM
More informationOVERVIEW OF DATABASE DEVELOPMENT
DATABASE SYSTEMS I WEEK 2: THE ENTITY-RELATIONSHIP MODEL OVERVIEW OF DATABASE DEVELOPMENT Requirements Analysis / Ideas High-Level Database Design Conceptual Database Design / Relational Database Schema
More informationEntity-Relationship Model &
Entity-Relationship Model & IST 210 Diagram Todd S. Bacastow IST 210: Organization of data 2/1/2004 1 Design Principles Setting client has (possibly vague) idea of what he/she wants. YOUR task must design
More informationMIS Database Systems Entity-Relationship Model.
MIS 335 - Database Systems Entity-Relationship Model http://www.mis.boun.edu.tr/durahim/ Ahmet Onur Durahim Learning Objectives Database Design Main concepts in the ER model? ER Diagrams Database Design
More informationThe Relational Model. Chapter 3. Comp 521 Files and Databases Fall
The Relational Model Chapter 3 Comp 521 Files and Databases Fall 2012 1 Why Study the Relational Model? Most widely used model by industry. IBM, Informix, Microsoft, Oracle, Sybase, etc. It is simple,
More informationENTITY-RELATIONSHIP MODEL
Assigned reading: Chapter 4 ENTITY-RELATIONSHIP MODEL Lecture 1 Relational database model Used by all major commercial database systems Very simple model Query with high-level languages: simple yet expressive
More informationThe Entity-Relationship (ER) Model 2
The Entity-Relationship (ER) Model 2 Week 2 Professor Jessica Lin Keys Differences between entities must be expressed in terms of attributes. A superkey is a set of one or more attributes which, taken
More informationThe DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.
Managing Data Data storage tool must provide the following features: Data definition (data structuring) Data entry (to add new data) Data editing (to change existing data) Querying (a means of extracting
More informationIntroduction to Data Management. Lecture #4 (E-R à Relational Design)
Introduction to Data Management Lecture #4 (E-R à Relational Design) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Reminders:
More informationIntroduction to Data Management. Lecture #5 (E-R Relational, Cont.)
Introduction to Data Management Lecture #5 (E-R Relational, Cont.) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW#1 is due
More informationThe Relational Model. Chapter 3
The Relational Model Chapter 3 Why Study the Relational Model? Most widely used model. Systems: IBM DB2, Informix, Microsoft (Access and SQL Server), Oracle, Sybase, MySQL, etc. Legacy systems in older
More informationCS 146 Database Systems
DBMS CS 146 Database Systems Entity-Relationship (ER) Model CS 146 1 CS 146 2 A little history Progression of Database Systems In DBMS: single instance of data maintained and accessed by different users
More informationDatabase Systems. Course Administration
Database Systems ( ) September 20, 2004 Lecture #2 By Hao-hua Chu ( ) 1 Course Administration Can everyone get the textbook? HW #1 is out on the course homepage It is due one week from today. Next week
More informationCISC 3140 (CIS 20.2) Design & Implementation of Software Application II
CISC 3140 (CIS 20.2) Design & Implementation of Software Application II Instructor : M. Meyer Email Address: meyer@sci.brooklyn.cuny.edu Course Page: http://www.sci.brooklyn.cuny.edu/~meyer/ CISC3140-Meyer-lec4
More informationIntroduction to Database Systems CSE 414
Introduction to Database Systems CSE 414 Lecture 16: Constraints CSE 414 - Spring 2015 1 Announcements Reminders: Web quiz due Monday night XML homework due Wednesday night Today: Constraints (7.1, 7.2,
More informationContents. Database. Information Policy. C03. Entity Relationship Model WKU-IP-C03 Database / Entity Relationship Model
Information Policy Database C03. Entity Relationship Model Code: 164323-03 Course: Information Policy Period: Spring 2013 Professor: Sync Sangwon Lee, Ph. D 1 Contents 01. Overview of Database Design 02.
More informationOverview of db design Requirement analysis Data to be stored Applications to be built Operations (most frequent) subject to performance requirement
ITCS 3160 Data Base Design and Implementation Jing Yang 2010 Fall Class 12: Data Modeling Using the Entity-Relationship (ER) Model Overview of db design Requirement analysis Data to be stored Applications
More informationDatabase Applications (15-415)
Database Applications (15-415) The Entity Relationship Model Lecture 2, January 15, 2014 Mohammad Hammoud Today Last Session: Course overview and a brief introduction on databases and database systems
More informationThe Relational Model. Chapter 3. Database Management Systems, R. Ramakrishnan and J. Gehrke 1
The Relational Model Chapter 3 Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc.
More informationApplied Databases. Sebastian Maneth. Lecture 5 ER Model, Normal Forms. University of Edinburgh - January 30 th, 2017
Applied Databases Lecture 5 ER Model, Normal Forms Sebastian Maneth University of Edinburgh - January 30 th, 2017 Outline 2 1. Entity Relationship Model 2. Normal Forms From Last Lecture 3 the Lecturer
More informationThe Relational Model 2. Week 3
The Relational Model 2 Week 3 1 We have seen how to create a database schema, how do we create an actual database on our computers? professor(pid : string, name : string) course(pid : string, number :
More informationCS54100: Database Systems
CS54100: Database Systems Data Modeling 13 January 2012 Prof. Chris Clifton Main categories of data models Logical models: used to describe, organize and access data in DBMS; application programs refers
More informationA Deeper Look at Data Modeling. Shan-Hung Wu & DataLab CS, NTHU
A Deeper Look at Data Modeling Shan-Hung Wu & DataLab CS, NTHU Outline More about ER & Relational Models Weak Entities Inheritance Avoiding redundancy & inconsistency Functional Dependencies Normal Forms
More informationChapter 2 Conceptual Modeling. Objectives
Chapter 2 Conceptual Modeling Basic Entity Relationship Diagrams 1 Objectives Definition of terms Importance of data modeling Write good names and definitions for entities, relationships, and attributes
More informationCS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1
CS 4604: Introduction to Database Management Systems B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1 E/R: NOT IN BOOK! IMPORTANT: Follow only lecture slides for this topic! Differences
More informationRelational model continued. Understanding how to use the relational model. Summary of board example: with Copies as weak entity
COS 597A: Principles of Database and Information Systems Relational model continued Understanding how to use the relational model 1 with as weak entity folded into folded into branches: (br_, librarian,
More informationIntroduction to Data Management. Lecture #6 E-Rà Relational Mapping (Cont.)
Introduction to Data Management Lecture #6 E-Rà Relational Mapping (Cont.) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 It s time again for...
More informationDistributed Database Systems By Syed Bakhtawar Shah Abid Lecturer in Computer Science
Distributed Database Systems By Syed Bakhtawar Shah Abid Lecturer in Computer Science 1 Distributed Database Systems Basic concepts and Definitions Data Collection of facts and figures concerning an object
More informationRoadmap of This Lecture. Weak Entity Sets Extended E-R Features Reduction to Relation Schemas Database Design UML*
E-R Model (II) 1 Roadmap of This Lecture Weak Entity Sets Extended E-R Features Reduction to Relation Schemas Database Design UML* 2 Weak Entity Sets An entity set that does not have a primary key is referred
More informationCSE 544 Principles of Database Management Systems
CSE 544 Principles of Database Management Systems Magdalena Balazinska Winter 2015 Lecture 2 SQL and Schema Normalization 1 Announcements Paper review First paper review is due before lecture on Wednesday
More informationSWEN-220 Mathematical Models of Software. Conceptual to Relational Mapping
SWEN-220 Mathematical Models of Software Conceptual to Relational Mapping 1 Relational (Logical) Design Logical design is where a conceptual design is mapped to a relational schema. Entry = Conceptual
More informationReview The Big Picture
CS445 - Introduction to Database Management Systems Fall Semester 2015 LECTURE 6 The Entity-Relationship Model Introduction TEXTBOOK REFERENCE: CHAPTERS 2,3 R&G 1 Review The Big Picture Data Modeling Relational
More informationCMPT 354 Database Systems I
CMPT 354 Database Systems I Chapter 2 Entity Relationship Data Modeling Data models A data model is the specifications for designing data organization in a system. Specify database schema using a data
More informationThe Relational Model
The Relational Model What is the Relational Model Relations Domain Constraints SQL Integrity Constraints Translating an ER diagram to the Relational Model and SQL Views A relational database consists
More informationCOMP 430 Intro. to Database Systems
COMP 430 Intro. to Database Systems Multi-table SQL Get clickers today! Slides use ideas from Chris Ré and Chris Jermaine. The need for multiple tables Using a single table leads to repeating data Provides
More informationThe Entity-Relationship Model
The Entity-Relationship Model Chapter 2 Instructor: Vladimir Zadorozhny vladimir@sis.pitt.edu Information Science Program School of Information Sciences, University of Pittsburgh 1 Database: a Set of Relations
More informationBİL 354 Veritabanı Sistemleri. Relational Model (İlişkisel Veri Modeli)
BİL 354 Veritabanı Sistemleri Relational Model (İlişkisel Veri Modeli) DB Modeling & Implementation Ideas Database Model (E/R, ODL) Relational Schema Physical storage Diagrams (E/R) Tables: column names:
More informationThe Relational Model. Chapter 3. Comp 521 Files and Databases Fall
The Relational Model Chapter 3 Comp 521 Files and Databases Fall 2014 1 Why the Relational Model? Most widely used model by industry. IBM, Informix, Microsoft, Oracle, Sybase, MySQL, Postgres, Sqlite,
More informationThe Entity-Relationship Model. Overview of Database Design. ER Model Basics. (Ramakrishnan&Gehrke, Chapter 2)
The Entity-Relationship Model (Ramakrishnan&Gehrke, Chapter 2) CS 432 Fall 2007 1 Overview of Database Design Conceptual design: (ER Model is used at this stage.) What are the entities and relationships
More informationIntroduction to Data Management CSE 344
Introduction to Data Management CSE 344 Lecture 16: Constraints CSE 344 - Fall 2014 1 Announcements Sections tomorrow: XML. Quiz and next HW on XML posted soon, due next week after midterm HW 4 due tomorrow
More informationCOMP Instructor: Dimitris Papadias WWW page:
COMP 5311 Instructor: Dimitris Papadias WWW page: http://www.cse.ust.hk/~dimitris/5311/5311.html Textbook Database System Concepts, A. Silberschatz, H. Korth, and S. Sudarshan. Reference Database Management
More informationThe Relational Model (ii)
ICS 321 Fall 2009 The Relational Model (ii) Asst. Prof. Lipyeow Lim Information and Computer Science Department University of Hawaii at Manoa 1 Internet Book Store Example Isbn title author qty price year
More informationPart 5: Introduction to Logical Design
5. Introduction to Logical Design 5-1 Part 5: Introduction to Logical Design References: Elmasri/Navathe:Fundamentals of Database Systems, 3rd Edition, 1999. Chapter 3, Data Modeling Using the Entity-Relationship
More informationUnit I. By Prof.Sushila Aghav MIT
Unit I By Prof.Sushila Aghav MIT Introduction The Need for Databases Data Models Relational Databases Database Design Storage Manager Query Processing Transaction Manager DBMS Applications DBMS contains
More informationIntroduction to Data Management. Lecture #3 (Conceptual DB Design) Instructor: Chen Li
Introduction to Data Management Lecture #3 (Conceptual DB Design) Instructor: Chen Li 1 Announcements v HW #1 is now available v Today s plan Conceptual DB design, cont. Advanced ER concepts 2 Weak Entities
More information