ENTITY-RELATIONSHIP MODEL. CS 564- Spring 2018

Size: px
Start display at page:

Download "ENTITY-RELATIONSHIP MODEL. CS 564- Spring 2018"

Transcription

1 ENTITY-RELATIONSHIP MODEL CS 564- Spring 2018

2 WHAT IS THIS LECTURE ABOUT E/R Model: entity sets, attribute relation: binary, multi-way relationship roles, attributes on relationships subclasses (ISA) weak entity sets constraints design principles E/R to Relational Model CS 564 [Spring 2018] - Paris Koutris 2

3 HOW TO BUILD A DB APPLICATION CS 564 [Spring 2018] - Paris Koutris 3

4 HOW TO BUILD A DB APPLICATION Pick an application Figure out what to model (ER model) Output: ER diagram Transform the ER diagram to a relational schema Refine the relational schema (normalization) Now ready to implement the schema and load the data! CS 564 [Spring 2018] - Paris Koutris 4

5 RUNNING EXAMPLE We want to store information about: companies and employees Each company has a name, an address, Each company has a list of employees products manufactured by these companies Each product has a name, a description, CS 564 [Spring 2018] - Paris Koutris 5

6 E/R MODEL Gives us a visual language to specify what information the DB must hold what are the relationships among components of that information Proposed by Peter Chen in 1976 What we will cover: 1. basic stuff: entities, attributes, relationships 2. constraints 3. weak entity sets 4. design principles CS 564 [Spring 2018] - Paris Koutris 6

7 ENTITIES & ATTRIBUTES Entity an object distinguishable from other object Entity set a collection of similar entities represented by rectangles described using a set of attributes Attribute represented by ovals attached to an entity set Product name CS 564 [Spring 2018] - Paris Koutris 7

8 ENTITIES & ATTRIBUTES price name category name stockprice Product Company Entities are not explicitly represented in E/R diagrams! Person name address ssn CS 564 [Spring 2018] - Paris Koutris 8

9 RELATIONS A mathematical definition: if A, B are sets, then a relation R is a subset of A x B Example A = {1, 2, 3}, B = {a, b, c, d} R = {(1, a), (1, c), (2, c), (3, b)} A a b c d B CS 564 [Spring 2018] - Paris Koutris 9

10 RELATIONSHIPS price name category name stockprice Product makes Company makes is a subset of Product x Company Person name address ssn CS 564 [Spring 2018] - Paris Koutris 10

11 RELATIONSHIPS price name category name stockprice Product makes Company buys Person employs name address ssn CS 564 [Spring 2018] - Paris Koutris 11

12 MULTIPLICITY OF RELATIONSHIPS one-one A a b c d B many-one A a b c d B many-many A a b c d B CS 564 [Spring 2018] - Paris Koutris 12

13 MULTIPLICITY OF RELATIONSHIPS price name category name stockprice Product makes Company buys Person employs name address ssn CS 564 [Spring 2018] - Paris Koutris 13

14 NOTATION DIFFERENCE We use: The cow book uses (page 33): You should use the notation in the slides! CS 564 [Spring 2018] - Paris Koutris 14

15 MULTI-WAY RELATIONSHIPS How do we model a purchase relation between buyers, products and stores? Product purchase Store Person We can still model this as a mathematical set (ternary relation) CS 564 [Spring 2018] - Paris Koutris 15

16 ARROWS IN MULTI-WAY RELATIONSHIPS What does the arrow mean here? Product purchase Store Person A given person can purchase a given product from at most one store! CS 564 [Spring 2018] - Paris Koutris 16

17 ARROWS IN MULTI-WAY RELATIONSHIPS What about here? Product purchase Store Person A given person can purchase a given product from at most one store AND a given store sells to a given person at most one product CS 564 [Spring 2018] - Paris Koutris 17

18 ARROWS IN MULTI-WAY RELATIONSHIPS How can we say that a given person buys from at most one store? Product purchase Store Person Not possible, we can only approximate! CS 564 [Spring 2018] - Paris Koutris 18

19 ROLES IN RELATIONSHIPS What if we need an entity set twice in a relationship? Product purchase Store Person salesperson Person buyer CS 564 [Spring 2018] - Paris Koutris 19

20 ROLES IN RELATIONSHIPS Label the edges to indicate the roles Collapse the two entity sets into one Product purchase Store salesperson buyer Person CS 564 [Spring 2018] - Paris Koutris 20

21 ATTRIBUTES IN RELATIONSHIPS date Product purchase Store Person Relationships have attributes as well! CS 564 [Spring 2018] - Paris Koutris 21

22 MULTI-WAY TO BINARY RELATIONSHIPS Product purchase Store productof Product Person Purchase storeof Store Why do we need the arrows? buyerof Person CS 564 [Spring 2018] - Paris Koutris 22

23 RELATIONSHIPS: RECAP Modeled as a mathematical set Binary and multi-way relationships Converting a multi-way one into many binary ones Constraints on the degree of the relationship many-one, one-one, many-many limitations of arrows Attributes of relationships not necessary, but useful! CS 564 [Spring 2018] - Paris Koutris 23

24 E/R: ADDITIONAL FEATURES CS 564 [Spring 2018] - Paris Koutris 24

25 SUBCLASSES subclass = specialized case = fewer entities = more properties Example: Products Software products Educational products CS 564 [Spring 2018] - Paris Koutris 25

26 SUBCLASSES price name category Product Attributes are inherited by the subclasses! version ISA age group Software Product Educational Product CS 564 [Spring 2018] - Paris Koutris 26

27 CONSTRAINTS constraint := an assertion about the database that must be true at all times part of the database schema central in database design When creating the ER diagram, you need to find as many constraints as possible! CS 564 [Spring 2018] - Paris Koutris 27

28 TYPES OF CONSTRAINTS keys: SSN uniquely identifies a person single-value: a person can have only one father referential integrity: if you work for a company, it must exist in the database domain: age is between 0 and 150 other: e.g. at most 80 students enroll in a class CS 564 [Spring 2018] - Paris Koutris 28

29 WHY DO WE NEED CONSTRAINTS? Give more semantics to the data help us better understand it Prevent wrong data entry Allow us to refer to entities (e.g. using keys) Enable efficient storage and data lookup CS 564 [Spring 2018] - Paris Koutris 29

30 KEY CONSTRAINTS price name category name stockprice Product makes Company buys Person employs name address ssn CS 564 [Spring 2018] - Paris Koutris 30

31 KEY CONSTRAINTS Every entity set must have a key! A key can consist of more than one attribute There can be more than one key for an entity set one key will be designated as primary key No formal way to specify multiple keys in an ER diagram CS 564 [Spring 2018] - Paris Koutris 31

32 SINGLE-VALUE CONSTRAINTS An entity may have at most one value for a given attribute or relationship an attribute of an entity set has a single value a many-one relation implies a single value constraint CS 564 [Spring 2018] - Paris Koutris 32

33 REFERENTIAL INTEGRITY CONSTRAINT A relationship has one value and the value must exist Product makes Company CS 564 [Spring 2018] - Paris Koutris 33

34 WEAK ENTITY SETS Entity sets are weak when their key attributes come from other classes to which they are related Team affiliation University number sport name entities of an entity set need help to identify them uniquely! CS 564 [Spring 2018] - Paris Koutris 34

35 E/R: DESIGN PRINCIPLES CS 564 [Spring 2018] - Paris Koutris 35

36 1. BE FAITHFUL TO THE APP! What is wrong here? Product purchase Person Country president Person CS 564 [Spring 2018] - Paris Koutris 36

37 2. AVOID REDUNDANCY! What is wrong here? date Product purchase Store personname personaddress CS 564 [Spring 2018] - Paris Koutris 37

38 2. AVOID REDUNDANCY! Redundancy occurs when we say the same thing in two different ways Redundancy wastes space and encourages inconsistency The two instances of the same fact may become inconsistent if we change one and forget to change the other CS 564 [Spring 2018] - Paris Koutris 38

39 2. AVOID REDUNDANCY! What is wrong here? address Beer manfby Manufacturer manufacturer name CS 564 [Spring 2018] - Paris Koutris 39

40 3. KEEP IT SIMPLE! What is wrong here? Date date Product purchase Store Person CS 564 [Spring 2018] - Paris Koutris 40

41 4. ATTRIBUTES OVER ENTITY SETS An entity set should satisfy at least one of the following conditions it is more than the name of something; it has at least one non-key attribute it is the many in a many-one or many-many relationship Beer manfby Manufacturer name What is wrong here? name CS 564 [Spring 2018] - Paris Koutris 41

42 5. DON T OVERUSE WEAK ENTITY SETS Beginner database designers often doubt that anything could be a key by itself They make all entity sets weak, supported by all other entity sets to which they are linked In reality, we create unique IDs for entity sets Examples: SSN, ISBN, CS 564 [Spring 2018] - Paris Koutris 42

43 E/R TO RELATIONAL MODEL CS 564 [Spring 2018] - Paris Koutris 43

44 ER MODEL VS RELATIONAL MODEL ER model many concepts: entities, relations, attributes, etc. well-suited for capturing the app requirements not well-suited for computer implementation Relational model has just a single concept: relation world is represented with a collection of tables well-suited for efficient manipulations on computers CS 564 [Spring 2018] - Paris Koutris 44

45 TRANSLATION Basic cases: entity set E -- > relation with attributes of E relationship R -- > relation with attributes being keys of related entity sets + attributes of R Special cases: combining two relations weak entity sets is-a relationships CS 564 [Spring 2018] - Paris Koutris 45

46 ENTITY SET TO RELATION Person name address ssn Person(ssn, name, address) CREATE TABLE Person (ssn CHAR(11) PRIMARY KEY, name CHAR(40), address CHAR(50)) CS 564 [Spring 2018] - Paris Koutris 46

47 ENTITY SET TO RELATION price name category Product Product(name, category, price) CREATE TABLE Product (name CHAR(40), category CHAR(20), price REAL, PRIMARY KEY(name, category)) CS 564 [Spring 2018] - Paris Koutris 47

48 RELATIONSHIP TO RELATION price name category ssn name Product buys Person date address Product(name, category, price) Person(ssn, name, address) Buys(prodname, prodcategory, ssn, date) CS 564 [Spring 2018] - Paris Koutris 48

49 MANY-ONE RELATIONSHIPS price name category name stockprice Product makes Company No need for a Makes relation; instead modify Product: Product(name, category, price, company_name) Company(name, stockprice) CS 564 [Spring 2018] - Paris Koutris 49

50 MANY-MANY RELATIONS price name category ssn name Product buys Person date address Product(name, category, price, ssn) What is wrong here? CS 564 [Spring 2018] - Paris Koutris 50

51 RELATIONSHIP TO RELATION: SQL CREATE TABLE Buys (prodname CHAR(40), prodcategory CHAR(20), ssn CHAR(11), date DATE, PRIMARY KEY(prodname,prodcategory,ssn) FOREIGN KEY (ssn) REFERENCES Person, FOREIGN KEY (prodname, prodcategory) REFERENCES Product(name, category)) CS 564 [Spring 2018] - Paris Koutris 51

52 WEAK ENTITY SETS Team affiliation University number sport name Team(number, affiliated-university, sport) Affiliation does not need a separate relation! Attribute name needed as part of the key CS 564 [Spring 2018] - Paris Koutris 52

53 WEAK ENTITY SETS The relation for a weak entity set must include: attributes for its complete key (including those in other entity sets) its own, non-key attributes A supporting (double-diamond) relationship is redundant and produces no relation CS 564 [Spring 2018] - Paris Koutris 53

54 SUBCLASSES: OPTION 1 price name category Product version ISA age group Software Product Educational Product Product(name, category, price) SoftwareProduct(name, category, price, version) EducationalProduct(name, category, price, age-group) CS 564 [Spring 2018] - Paris Koutris 54

55 SUBCLASSES: OPTION 2 price name category Product version ISA age group Software Product Educational Product Product(name, category, price) SoftwareProduct(name, version) EducationalProduct(name, age-group) CS 564 [Spring 2018] - Paris Koutris 55

56 SUBCLASSES: OPTION 3 price name category Product version ISA age group Software Product Educational Product Product(name, category, price, version, age-group) Use NULL to denote that the attribute makes no sense for a specific tuple CS 564 [Spring 2018] - Paris Koutris 56

57 SUBCLASSES RECAP Three approaches: 1. create a relation for each class with all its attributes 2. create one relation for each subclass with only the key attribute(s) and attributes attached to it 3. create one relation; entities have null in attributes that do not belong to them CS 564 [Spring 2018] - Paris Koutris 57

Conceptual Design with ER Model

Conceptual 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 information

Entity/Relationship Modelling

Entity/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 information

Introduction to Data Management CSE 344

Introduction 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 information

Introduction to Data Management CSE 344

Introduction 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 information

The Entity-Relationship Model (ER Model) - Part 2

The Entity-Relationship Model (ER Model) - Part 2 Lecture 4 The Entity-Relationship Model (ER Model) - Part 2 By Michael Hahsler Based on slides for CS145 Introduction to Databases (Stanford) Lecture 4 > Section 2 What you will learn about in this section

More information

Introduction to Database Systems CSE 414

Introduction 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 information

Database Systems CSE 414

Database 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 information

Lecture 4. Lecture 4: The E/R Model

Lecture 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 information

Lecture 5. Lecture 5: The E/R Model

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 information

Database Systems CSE 414

Database 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 information

Introduction to Data Management CSE 344

Introduction 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 information

Announcements. Database Design. Database Design. Database Design Process. Entity / Relationship Diagrams. Introduction to Data Management CSE 344

Announcements. 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 information

Introduction to Database Systems CSE 414. Lecture 19: E/R Diagrams

Introduction 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 information

CSE 344 JULY 30 TH DB DESIGN (CH 4)

CSE 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 information

Database Design Process Entity / Relationship Diagrams

Database 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 information

Announcements. Database Design. Database Design. Database Design Process. Entity / Relationship Diagrams. Database Systems CSE 414

Announcements. 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 information

CSE 344 MAY 11 TH ENTITIES

CSE 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 information

Database 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 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 information

Entity-Relationship Model. Purpose of E/R Model

Entity-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 information

CSC 261/461 Database Systems Lecture 7

CSC 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 information

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 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 information

Entity-Relationship Models: Good Design and Constraints

Entity-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 information

Entity-Relationship Model

Entity-Relationship Model Entity-Relationship Model 1 Purpose of E/R Model The E/R model allows us to sketch database schema designs Includes some constraints, but not operations Designs are pictures called entity-relationship

More information

2. E/R Design Considerations

2. 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 information

Database Design Using E/R Model

Database Design Using E/R Model CS145 Lecture Notes #2 Database Design Using E/R Model Steps in Building a Database 1. Understand real-world domain being captured 2. Specify it using a database design model 3. Translate specification

More information

CS 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 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 information

Conceptual Design. The Entity-Relationship (ER) Model

Conceptual 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 information

CS 405G: Introduction to Database Systems. Database Design II

CS 405G: Introduction to Database Systems. Database Design II CS 405G: Introduction to Database Systems Database Design II Review From Database Requirement to Relational Model Entity type(set)s Relationship types 2 Next: ER Design Principles Avoid redundancy. Limit

More information

Where Are We? Next Few Lectures. Integrity Constraints Motivation. Constraints in E/R Diagrams. Keys in E/R Diagrams

Where 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 information

Database Systems. Course Administration

Database 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 information

CSE 344 MAY 14 TH ENTITIES

CSE 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 information

ER Model. CSC 343 Winter 2018 MICHAEL LIUT

ER 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 information

CMPT 354 Database Systems I

CMPT 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 information

Conceptual Data Modeling

Conceptual Data Modeling Conceptual Data odeling A data model is a way to describe the structure of the data. In models that are implemented it includes a set of operations that manipulate the data. A Data odel is a combination

More information

High Level Database Models

High 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 information

E/R Diagrams! Converting E/R Diagrams to Relations!

E/R Diagrams! Converting E/R Diagrams to Relations! E/R Diagrams! Converting E/R Diagrams to Relations! DB design is a serious and possibly complex business.! A client may know they want a database, but they donʼt know what they want in it or how it should

More information

The Entity-Relationship Model (ER Model) - Part 1

The 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 information

OVERVIEW OF DATABASE DEVELOPMENT

OVERVIEW 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 information

CS54100: Database Systems

CS54100: 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 information

MIS Database Systems Entity-Relationship Model.

MIS 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 information

CSE 530A. ER Model. Washington University Fall 2013

CSE 530A. ER Model. Washington University Fall 2013 CSE 530A ER Model Washington University Fall 2013 Database Design Requirements Analysis Conceptual Database Design Creates an abstract model Logical Database Design Converts abstract model to concrete

More information

SQL DDL. CS3 Database Systems Weeks 4-5 SQL DDL Database design. Key Constraints. Inclusion Constraints

SQL DDL. CS3 Database Systems Weeks 4-5 SQL DDL Database design. Key Constraints. Inclusion Constraints SQL DDL CS3 Database Systems Weeks 4-5 SQL DDL Database design In its simplest use, SQL s Data Definition Language (DDL) provides a name and a type for each column of a table. CREATE TABLE Hikers ( HId

More information

CSC 261/461 Database Systems Lecture 8. Spring 2018

CSC 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 information

Introduction to Database Systems CSE 414

Introduction 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 information

CSE 344 AUGUST 1 ST ENTITIES

CSE 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 information

Entity-Relationship Model &

Entity-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 information

FUNCTIONAL DEPENDENCIES

FUNCTIONAL DEPENDENCIES FUNCTIONAL DEPENDENCIES CS 564- Spring 2018 ACKs: Dan Suciu, Jignesh Patel, AnHai Doan WHAT IS THIS LECTURE ABOUT? Database Design Theory: Functional Dependencies Armstrong s rules The Closure Algorithm

More information

High-Level Database Models (ii)

High-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 information

The Relational Model 2. Week 3

The 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 information

Translating an ER Diagram to a Relational Schema

Translating 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 information

CIS 330: Applied Database Systems. ER to Relational Relational Algebra

CIS 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 information

The Entity-Relationship Model. Overview of Database Design

The 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 information

SYLLABUS ADMIN DATABASE SYSTEMS I WEEK 2 THE ENTITY-RELATIONSHIP MODEL. Assignment #2 changed. A2Q1 moved to A3Q1

SYLLABUS ADMIN DATABASE SYSTEMS I WEEK 2 THE ENTITY-RELATIONSHIP MODEL. Assignment #2 changed. A2Q1 moved to A3Q1 DATABASE SYSTEMS I WEEK 2 THE ENTITY-RELATIONSHIP MODEL Class Time and Location: Tue 14:30-16:20 AQ3005 Thu 14:30-15:20 AQ3003 Course Website: http://www.cs.sfu.ca/cc/354/rfrank/ Instructor: Richard Frank,

More information

Database Applications (15-415)

Database 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 information

CS W Introduction to Databases Spring Computer Science Department Columbia University

CS W Introduction to Databases Spring Computer Science Department Columbia University CS W4111.001 Introduction to Databases Spring 2018 Computer Science Department Columbia University 1 in SQL 1. Key constraints (PRIMARY KEY and UNIQUE) 2. Referential integrity constraints (FOREIGN KEY

More information

CS 146 Database Systems

CS 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 information

Data 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 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 information

Introduction to Data Management CSE 344

Introduction 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 information

DS Introduction to SQL Part 2 Multi-table Queries. By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford)

DS 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 information

Database Systems. Lecture2:E-R model. Juan Huo( 霍娟 )

Database Systems. Lecture2:E-R model. Juan Huo( 霍娟 ) Database Systems Lecture2:E-R model Juan Huo( 霍娟 ) Reference slides: http://www.cs.wisc.edu/ dbbook Berkeley, Professor Eben Haber,Professor Mary Roth Review: Benefits of a DBMS 1. Data independence applications

More information

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

The 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 information

CS/INFO 330 Entity-Relationship Modeling. Announcements. Goals of This Lecture. Mirek Riedewald

CS/INFO 330 Entity-Relationship Modeling. Announcements. Goals of This Lecture. Mirek Riedewald CS/INFO 330 Entity-Relationship Modeling Mirek Riedewald mirek@cs.cornell.edu Announcements Office hour update (see class homepage) First homework assignment will be available from CMS later today Some

More information

The Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes.

The Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes. Chapter 6: Entity-Relationship Model Our Story So Far: Relational Tables Databases are structured collections of organized data The Relational model is the most common data organization model The Relational

More information

Information Systems Engineering

Information Systems Engineering Information Systems Engineering Database Design Data Scenario ER Design Entity Relationship Model Relational DBMS Relational Schema ER Design After the requirements analysis in terms of data needs, a high

More information

Information Systems Engineering. Entity Relationship Model

Information Systems Engineering. Entity Relationship Model Information Systems Engineering Entity Relationship Model 1 Database Design Data Scenario ER Design Relational DBMS Relational Schema ER Design After the requirements analysis in terms of data needs, a

More information

Introduction to Database Design

Introduction to Database Design Introduction to Database Design UVic C SC 370 Daniel M German Introduction to Database Design (1.2.0) CSC 370 4/5/2005 14:52 p.1/33 Overview What are the steps in designing a database? What is the entity-relationship

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) The Relational Model Lecture 3, January 18, 2015 Mohammad Hammoud Today Last Session: The entity relationship (ER) model Today s Session: ER model (Cont d): conceptual design

More information

CIS 330: Web-driven Web Applications. Lecture 2: Introduction to ER Modeling

CIS 330: Web-driven Web Applications. Lecture 2: Introduction to ER Modeling CIS 330: Web-driven Web Applications Lecture 2: Introduction to ER Modeling 1 Goals of This Lecture Understand ER modeling 2 Last Lecture Why Store Data in a DBMS? Transactions (concurrent data access,

More information

Entity Relationship Data Model. Slides by: Shree Jaswal

Entity Relationship Data Model. Slides by: Shree Jaswal Entity Relationship Data Model Slides by: Shree Jaswal Topics: Conceptual Modeling of a database, The Entity-Relationship (ER) Model, Entity Types, Entity Sets, Attributes, and Keys, Relationship Types,

More information

The Relational Model. Chapter 3

The 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 information

Contents. Database. Information Policy. C03. Entity Relationship Model WKU-IP-C03 Database / Entity Relationship Model

Contents. 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 information

Chapter 6: Entity-Relationship Model. The Next Step: Designing DB Schema. Identifying Entities and their Attributes. The E-R Model.

Chapter 6: Entity-Relationship Model. The Next Step: Designing DB Schema. Identifying Entities and their Attributes. The E-R Model. Chapter 6: Entity-Relationship Model The Next Step: Designing DB Schema Our Story So Far: Relational Tables Databases are structured collections of organized data The Relational model is the most common

More information

Introduction to Database Design

Introduction to Database Design ICS 321 Fall 2009 Introduction to Database Design Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 09/03/2009 Lipyeow Lim -- University of Hawaii at Manoa

More information

Chapter 2: Entity-Relationship Model

Chapter 2: Entity-Relationship Model Chapter 2: Entity-Relationship Model! Entity Sets! Relationship Sets! Design Issues! Mapping Constraints! Keys! E-R Diagram! Extended E-R Features! Design of an E-R Database Schema! Reduction of an E-R

More information

Database Design. ER Model. Overview. Introduction to Database Design. UVic C SC 370. Database design can be divided in six major steps:

Database Design. ER Model. Overview. Introduction to Database Design. UVic C SC 370. Database design can be divided in six major steps: Database Design Database design can be divided in six major steps: Requirements analysis Conceptual Database design (mostly done using the ER model) Logical Database design Schema refinement Physical Database

More information

The 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 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 information

Introduction 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) 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 information

Introduction to Database Design

Introduction to Database Design Introduction to Database Design UVic C SC 370, Fall 2002 Daniel M. German Department of Computer Science University of Victoria 2 1 Introduction to Database Design CSC 370 dmgerman@uvic.ca Overview What

More information

0. Database Systems 1.1 Introduction to DBMS Information is one of the most valuable resources in this information age! How do we effectively and efficiently manage this information? - How does Wal-Mart

More information

Informatics 1: Data & Analysis

Informatics 1: Data & Analysis Informatics 1: Data & Analysis Lecture 3: The Relational Model Ian Stark School of Informatics The University of Edinburgh Tuesday 24 January 2017 Semester 2 Week 2 https://blog.inf.ed.ac.uk/da17 Lecture

More information

Relational Database Design Part I. Announcement. Relational model: review. CPS 116 Introduction to Database Systems

Relational Database Design Part I. Announcement. Relational model: review. CPS 116 Introduction to Database Systems Relational Database Design Part I CPS 116 Introduction to Database Systems Announcement 2 DB2 accounts created; change your password! Let me know if you have NOT received the email Pick up Gradiance registration

More information

KEYS WEAK ENTITY SETS EXAMPLE: WEAK ENTITY SET EXAMPLE: WEAK ENTITY SET. Beers. Ales. Players. Teams ISA. and. Plays-on

KEYS WEAK ENTITY SETS EXAMPLE: WEAK ENTITY SET EXAMPLE: WEAK ENTITY SET. Beers. Ales. Players. Teams ISA. and. Plays-on KEYS In an ISA hierarchy, only the root entity set has a key, and it must serve as the key for all entities in the hierarchy. WEAK ENTITY SETS Occasionally, entities of an entity set need help to identify

More information

Overview. Introduction to Database Design. ER Model. Database Design

Overview. Introduction to Database Design. ER Model. Database Design Introduction to Database Design UVic C SC 370 Dr. Daniel M. German Department of Computer Science Overview What are the steps in designing a database? What is the entity-relationship (ER) model? How does

More information

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530 Translation of ER-diagram into Relational Schema Dr. Sunnie S. Chung CIS430/530 Learning Objectives Define each of the following database terms Relation Primary key Foreign key Referential integrity Field

More information

The Relational Model (ii)

The 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 information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) ER to Relational & Relational Algebra Lecture 4, January 20, 2015 Mohammad Hammoud Today Last Session: The relational model Today s Session: ER to relational Relational algebra

More information

Chapter 2 Conceptual Modeling. Objectives

Chapter 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 information

Relational Model. Topics. Relational Model. Why Study the Relational Model? Linda Wu (CMPT )

Relational Model. Topics. Relational Model. Why Study the Relational Model? Linda Wu (CMPT ) Topics Relational Model Linda Wu Relational model SQL language Integrity constraints ER to relational Views (CMPT 354 2004-2) Chapter 3 CMPT 354 2004-2 2 Why Study the Relational Model? Most widely used

More information

Relational Model. CS 377: Database Systems

Relational Model. CS 377: Database Systems Relational Model CS 377: Database Systems ER Model: Recap Recap: Conceptual Models A high-level description of the database Sufficiently precise that technical people can understand it But, not so precise

More information

Represent entities and relations with diagrams

Represent entities and relations with diagrams LEARNING OBJECTIVES Define data modeling terms Describe E-R Model Identify entities and relations Represent entities and relations with diagrams WHAT IS DATA MODELING? A data model is a collection of concepts

More information

L12: ER modeling 5. CS3200 Database design (sp18 s2) 2/22/2018

L12: 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 information

COMP Instructor: Dimitris Papadias WWW page:

COMP 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 information

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model Chapter 7: Entity-Relationship Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 7: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

Introduction to Data Management. Lecture #4 (E-R à Relational Design)

Introduction 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 information

Lecture 2: Introduction to SQL

Lecture 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 information

Design Techniques. 1. Avoid redundancy 2. Limit the use of weak entity sets 3. Don t use an entity set when an attribute will do

Design Techniques. 1. Avoid redundancy 2. Limit the use of weak entity sets 3. Don t use an entity set when an attribute will do Design Techniques 1. Avoid redundancy 2. Limit the use of weak entity sets 3. Don t use an entity set when an attribute will do 1 Avoiding Redundancy Redundancy = saying the same thing in two (or more)

More information

Chapter 6: Entity-Relationship Model

Chapter 6: Entity-Relationship Model Chapter 6: Entity-Relationship Model Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 6: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

A database can be modeled as: + a collection of entities, + a set of relationships among entities.

A database can be modeled as: + a collection of entities, + a set of relationships among entities. The Relational Model Lecture 2 The Entity-Relationship Model and its Translation to the Relational Model Entity-Relationship (ER) Model + Entity Sets + Relationship Sets + Database Design Issues + Mapping

More information

Chapter 7: Entity-Relationship Model

Chapter 7: Entity-Relationship Model Chapter 7: Entity-Relationship Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 7: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram

More information

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

The 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 information