CS 405G: Introduction to Database Systems

Slides:



Advertisements
Similar presentations
Constraints in Entity-Relationship Models Zaki Malik September 18, 2008.
Advertisements

1 Entity-Relationship Model Diagrams Class hierarchies Weak entity sets.
Chapter 4 Notes. Entity-Relationship Model E/R Diagrams Weak Entity Sets Converting E/R Diagrams to Relations.
CS34311 The Entity- Relationship Model Part 4.. CS34312 Coming up with a good design for your application Guidelines via examples.
Design Principles: Faithfulness
Weak Entity Sets. Occasionally, entities of an entity set need “help” to identify them uniquely. Example. Crews might have a number and some description,
Weak Entity Sets. Occasionally, entities of an entity set need “help” to identify them uniquely. Entity set E is weak if in order to identify entities.
Design Principles: Faithfulness
Database Design and the E-R Model Chapter 7 [1 of 2]
1 Entity-Relationship Model Slides by Jeffrey Ullman Modified by J. Welch to replace beers with candies.
DATABASE APPLICATION DEVELOPMENT SAK 3408 Database Design II (week 3)
From ER Diagrams to the Relational Model Rose-Hulman Institute of Technology Curt Clifton.
A four-way Relationship
1 Entity-Relationship Model Diagrams Class hierarchies Weak entity sets.
Winter 2002Arthur Keller – CS 1802–1 Schedule Today: Jan. 8 (T) u Weak Entity Sets, Entity-Relationship Design. u Read Sections Jan. 10 (TH) u.
Modeling Your Data Chapter 2. Part II Discussion of the Model: Good Design/ Bad Design?
CS411 Database Systems Kazuhiro Minami
1 Database Systems ( 資料庫系統 ) September 24, 2014 Lecture #2.
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 3 Introduction to a First Course in Database Systems.
Databases : Entity-Relationship Model 2007, Fall Pusan National University Ki-Joune Li These slides are made from the materials that Prof. Jeffrey D. Ullman.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
ER Data Models Ctd. CSET 3300.
1 Entity-Relationship Model Chapter 2 Copyright : Jeff Ullman + Hank Korth.
1 Database Systems ( 資料庫系統 ) September 26, 2005 Lecture #2.
1 Database Systems ( 資料庫系統 ) September 27/28, 2006 Lecture #2.
1 Session 2 Welcome: The fifth learning sequence “ Entity-Relationship Model -2“ E-R Model Recap : In the previous learning sequence, we discussed the.
Tallahassee, Florida, 2015 COP4710 Database Systems E-R Model Fall 2015.
Entity-Relationship Model
SAnta Clara UniversityHolliday – COEN 1782–1 Today’s Topic Today: u Constraints, Weak Entity Sets, Entity- Relationship Design. u Read Sections
Winter 2006Cushing Keller UllmanJudy Cushing2–1 Weak Entity Sets Sometimes an E.S. E ’s key comes not (completely) from its own attributes, but from the.
1 Conceptual Design using the Entity- Relationship Model.
Databases 1 Fifth lecture. Entity-Relationship Model Diagrams Class hierarchies Weak entity sets From E/R diagrams to Relations 2.
Instructor: Jinze Liu Fall Phases of Database Design u Conceptual design begins with the collection of requirements and results needed from the.
Entity-Relationship Model E/R Diagrams Converting E/R Diagrams to Relations.
Winter 2002Arthur Keller – CS 1802–1 Weak Entity Sets Sometimes an E.S. E ’s key comes not (completely) from its own attributes, but from the keys of one.
Modeling Your Data Chapter 2 cs5421. Part II Discussion of the Model: Good Design/ Bad Design? cs5422.
Database Management COP4540, SCS, FIU Database Modeling Using the Entity- Relationship Model (Continued)
1 Database Systems ( 資料庫系統 ) 9/23/2009 Lecture #2.
CS 405G Introduction to Database Systems Lecture 3: ER Model Instructor: Chen Qian.
1 Database Design Sections 6 & 7 First Normal Form (1NF), Second Normal Form (2NF), Unique Identifiers (UID), Third Normal Form (3NF), Arcs, Hierarchies.
Database Design and Programming Jan Baumbach Adopted from previous slides of Peter Schneider-Kamp.
CS422 Principles of Database Systems Entity-Relationship Model Chengyu Sun California State University, Los Angeles Adapted from Jeffrey Ullman’s lecture.
CS422 Principles of Database Systems Entity-Relationship Model
COP Introduction to Database Structures
Introduction to Database Systems, CS420
Let try to identify the conectivity of these entity relationship
Entity-Relationship Model
CSIS 115 Database Design and Applications for Business
COP4710 Database Systems E-R Model.
CSE 103 Day 15: Database Design
Weak Entity Sets Sometimes an E.S. E ’s key comes not (completely) from its own attributes, but from the keys of one or more E.S.’s to which E is linked.
02: ER Model Ch 4.1 – 4.4 Optionally, begin with Ch 2.1.
Constraints in Entity-Relationship Models
CPSC-310 Database Systems
Modeling Your Data Chapter 2 cs542
Instructor: Zhe He Department of Computer Science
Instructor: Elke Rundensteiner
Database Systems (資料庫系統)
Practice of ER modeling
Session 2 Welcome: The fifth learning sequence
CS 405G: Introduction to Database Systems
CS4433 Database Systems E-R Model.
Question Which of the following plays an important role in representing information about the real world in a database? Explain briefly 1)DDL.
CS 405G Introduction to Database Systems
CS 505: Intermediate Topics to Database Systems
MIS2502: Data Analytics Relational Data Modeling 2
E.R. Examples.
Database Management system
Database Management system
CS 405G: Introduction to Database Systems
Presentation transcript:

CS 405G: Introduction to Database Systems Database Design II

Assignment 1 Please check your canvas CS405G Fall 2016

Review From Database Requirement to Relational Model Entity type(set)s Relationship types

Next: ER-Design Principles Avoid redundancy. Limit the use of weak entity sets. Don’t use an entity set when an attribute will do.

Avoiding Redundancy Redundancy occurs when we say the same thing in two different ways. Redundancy wastes space (more importantly) encourages inconsistency. The two instances of the same fact may become inconsistent if we change one and forget to change the other, related version.

Example Assume we would like to set up a database for a wine distribution company. Wine Manufacture

Example name name addr ManfBy Beers Manfs manf

Example name name addr ManfBy Beers Manfs manf This design states the manufacturer of a beer twice: as an attribute and as a related entity.

Example name manf manfAddr Beers

Example name manf manfAddr Beers This design repeats the manufacturer’s address once for each beer; loses the address if there are temporarily no beers for a manufacturer.

Example name name addr ManfBy Beers Manfs

Example name name addr ManfBy Beers Manfs This design gives the address of each manufacturer exactly once.

Entity Sets Versus Attributes 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 nonkey attribute. or It is the “many” in a many-one or many-many relationship.

Example: Bad name name ManfBy Beers Manfs

Example: Bad name name ManfBy Beers Manfs Since the manufacturer is nothing but a name, and is not at the “many” end of any relationship, it should not be an entity set.

Example: Good name manf Beers There is no need to make the manufacturer an entity set, because we record nothing about manufacturers besides their name.

Example: Good name name addr ManfBy Beers Manfs Manfs deserves to be an entity set because of the nonkey attribute addr. Beers deserves to be an entity set because it is the “many” of the many-one relationship ManfBy.

Don’t Overuse Weak Entity Sets Beginning 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 usually create unique ID’s for entity sets. Examples include social-security numbers, automobile VIN’s etc.

When Do We Need Weak Entity Sets? The usual reason is that there is no global authority capable of creating unique ID’s. Example it is unlikely that there could be an agreement to assign unique player numbers across all football teams in the world.

ER Case Study I Works_In does not allow an employee to work in a department for two or more periods. We want to record several values of the descriptive attributes for each instance of this relationship. from to name Employees ssn lot dname did budget Works_In Departments dname budget did name Departments ssn lot Employees Works_In Duration from to 6/18/2019 22 22

ER Case study II Design a database representing cities, counties, and states For states, record name and capital (city) For counties, record name, area, and location (state) For cities, record name, population, and location (county and state) Assume the following: Names of states are unique Names of counties are only unique within a state Names of cities are only unique within a county A city is always located in a single county A county is always located in a single state 6/18/2019 23

ER Case study Design a database representing cities, counties, and states For states, record name and capital (city) For counties, record name, area, and location (state) For cities, record name, population, and location (county and state) Assume the following: Names of states are unique Names of counties are only unique within a state Names of cities are only unique within a county A city is always located in a single county A county is always located in a single state 6/18/2019 24 24

Case study : first design County area information is repeated for every city in the county Redundancy is bad. What else? State capital should really be a city Should “reference” entities through explicit relationships name name In Cities States population capital county_name county_area 6/18/2019 6/18/2019 25 25 25

Case study : second design Technically, nothing in this design could prevent a city in state X from being the capital of another state Y, but oh well… name Cities population In IsCapitalOf name In Counties States name area 6/18/2019 6/18/2019 26 26 26

Jinze Liu @ University of Kentucky Homework Assignment 1 due Wednesday 09/14 Reading assignment Chapter 3.1, 3.2 (6th edition) Project Find your partner 6/18/2019 Jinze Liu @ University of Kentucky