CS411 Database Systems Kazuhiro Minami 02: The Entity-Relationship Model.

Slides:



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

IELM 511: Information System design Introduction Part I. ISD for well structured data – relational and other DBMS Part II. ISD for systems with non-uniformly.
Chapter 31 Chapter 3 Data Modeling Using the Entity-Relationship Model.
Information Systems Chapter 4 Relational Databases Modelling.
E/R Exercises – Part I April 16, 2017.
Design Principles: Faithfulness
1 Lecture 04 Entity/Relationship Modelling. 2 Outline E/R model (Chapter 5) From E/R diagrams to relational schemas (Chapter 5) Constraints in SQL (Chapter.
Lecture #2 October 5 th, 2000 Conceptual Modeling Administration: –HW1 available –Details on projects –Exam date –XML comment.
Conceptual Models Agenda - Steps in the design of a DB - Need for conceptual models - The Entity-Relationship Model (ER-Model)
Entity-Relationship Data Model Alex Ostrovsky. Presentation Overview ► Short historical overview ► Elements of E-R Model ► Basic organization & relationships.
The Entity-Relationship Data Model
SLIDE 1IS Fall 2002 Database Management: Discussion Session University of California, Berkeley School of Information Management and.
1 Lecture 3: Database Modeling (continued) April 5, 2002.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
1 Conceptual Design with ER Model Lecture #2. 2 Lecture Outline Logistics Steps in building a database application Conceptual design with ER model.
Chapter 4 Entity Relationship (E-R) Modeling
Database Management Systems CSE 594 Lecture #1 April 4 th, 2002.
Modeling & Designing the Database
Lecture 9: Conceptual Database Design January 27 th, 2003.
Multiplicity in E/R Diagrams
1 Lecture 4: Database Modeling (end) The Relational Data Model April 8, 2002.
CS411 Database Systems Kazuhiro Minami
Database Design April 3, Projects, More Details Goal: build a DB application. (almost) anything goes. Groups of 3-4. End of week 2: groups formed.
Entity / Relationship Diagrams Objects entities Classes entity sets Attributes are like in ODL. Relationships: like in ODL except - not associated with.
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Principles of Database Systems With Internet and Java Applications Today’s Topic Chapter 2: Representing Information with Data Models The lecture notes.
Information Systems: Databases Define the role of general information systems Describe the elements of a database management system (DBMS) Describe the.
E/R Diagrams and Functional Dependencies. Modeling Subclasses The world is inherently hierarchical. Some entities are special cases of others We need.
Lecture 08: E/R Diagrams and Functional Dependencies.
Entity-Relationship Data Model N. Harika Lecturer(csc)
Lecture 2: E/R Diagrams and the Relational Model Thursday, January 4, 2001.
Database Systems Lecture # 7 8 th Feb, Conceptual and Logical Design Person buys Product name pricenamessn Conceptual Model: Relational Model: (plus.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Assignements. CSC343: Intro. to Databases2 Exercise 1 Superkeys: Candidate keys: Primary key:
1.1 CAS CS 460/660 Relational Model. 1.2 Review E/R Model: Entities, relationships, attributes Cardinalities: 1:1, 1:n, m:1, m:n Keys: superkeys, candidate.
Entity-Relationship Model Using High-Level Conceptual Data Models for Database Design Entity Types, Sets, Attributes and Keys Relationship Types, Sets,
CS 405G: Introduction to Database Systems Lecture 2 : Database Design I.
Conceptual Database Design. Building an Application with a DBMS Requirements modeling (conceptual, pictures) –Decide what entities should be part of the.
1 Introduction to Database Systems CSE 444 Lecture 07 E/R Diagrams October 10, 2007.
Component 4/Unit 6b Topic II Relational Databases Keys and relationships Data modeling Database acquisition Database Management System (DBMS) Database.
Database Management Systems MIT Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz.
Tallahassee, Florida, 2015 COP4710 Database Systems E-R Model Fall 2015.
© D. Wong Ch. 2 Entity-Relationship Data Model (continue)  Data models  Entity-Relationship diagrams  Design Principles  Modeling of constraints.
Lecture 2: E/R Diagrams and the Relational Model Wednesday, April 3 rd, 2002.
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 2 Introduction to a First Course in Database Systems.
Lecture 3: Conceptual Database Design and Schema Design April 12 th, 2004.
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 4 Introduction to a First Course in Database Systems.
The Entity-Relationship Model CIS 4301 Lecture Notes 1/12/2006.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
1 Lecture 08: E/R Diagrams and Functional Dependencies Friday, January 21, 2005.
COMP 430 Intro. to Database Systems Entity-Relationship Diagram Basics Slides use ideas from Chris Ré.
Modeling Constraints Extracting constraints is what modeling is all about. But how do we express them? Examples: Keys: social security number uniquely.
Entity Relationship Diagram ERD. Background Peter Chen developed ERDs in Charles Bachman and James Martin have added some slight refinements to.
Modeling: Entity-Relationship Diagrams
1 CS122A: Introduction to Data Management Lecture #4 (E-R  Relational Translation) Instructor: Chen Li.
The Entity-Relationship Diagram for Data Modeling
CPSC 603 Database Systems Lecturer: Laurie Webster II, Ph.D., P.E.
Lecture 5: Conceptual Database Design
COP4710 Database Systems E-R Model.
Database Design Oct. 3, 2001.
Database Design Why do we need it? Consider issues such as:
02: ER Model Ch 4.1 – 4.4 Optionally, begin with Ch 2.1.
Conceptual Database Design
Lecture 4: Database Modeling (continued)
name category name price makes Company Product stockprice buys employs
Lecture 8: The E/R Model I
Lecture 9: The E/R Model II
CS4433 Database Systems E-R Model.
Presentation transcript:

CS411 Database Systems Kazuhiro Minami 02: The Entity-Relationship Model

Steps in building a DB application Pick application domain Conceptual design What data do I need for my application domain? How can I describe that data?

Steps in building a DB application Pick application domain Conceptual design ER diagram Convert ER diagram to the data model of your DBMS product Implement application code & user interface SQL & Java/C+++/etc + user interface Step 1 Step 2 Step 3 Steps 4 and 5

Entity Relationship (ER) Model by Peter Chen Born in Taiwan Ph.D from Harvard University in 1973 Professor at Louisiana State University "The Entity-Relationship Model-- Toward a Unified View of Data” 1976 "A Relational Model of Data for Large Shared Data Banks” 1970 Ted Codd

The ER model is very simple 5 address namessn Person buys makes employs Company Product name category stockprice name price

Entity –real-world object distinguishable from other objects –described by its attributes Attribute –Has an atomic domain: string, integers, date, … Entity set: all have the same set of attributes Product namecategoryprice Company stockprice name boardOfDirectors 

Relationships If A, B are sets, then a relation R is a subset of A x B. A = {1, 2, 3} B = {a, b, c, d} R = {(1,a), (1,c), (3,b)} makes is a subset of Product x Company: a b c d A B makes Company Product

We can show the cardinality of a relationship one-one many-one many-many abcdabcd abcdabcd abcdabcd makes Company Product E F

address namessn Person buys makes employs Company Product namecategory stockprice name price

Exercise Design a database for a bank, including information about customers and their accounts. Information about a customer includes their name, address, phone, and Social Security number. Accounts have numbers, types (e.g., saving, checking) and balances. Also record the customer(s) who own an account. 1)Draw the E/R diagram for this database. 2)Change your diagram so an account can have only one customer. 3)Further change your diagram so a customer can have only one account 4)Change your original diagram in (1) so that a customer have a set of addresses.

Customers Accounts Name Address Phone SSNTypeBalance own

How do we model a multiway relationship? Purchase Product Person Store Can still model as a mathematical set (how?)

What do arrows mean in n-way relationships? If I know the store, person, and invoice, then there is only one possible movie. “VideoStore, Invoice, and Person determines Movie” VideoStore Person Movie Invoice Rental

What if there are several arrows? store, person, invoice determines movie; store, invoice, movie determines person VideoStore Person Movie Invoice Rental

How do I say “invoice determines store”? No good way; best approximation: Why is this incomplete? VideoStore Person Movie Invoice Rental

What if we need an entity set twice in one relationship? Purchase Product Person Store salespersonbuyer Person the “role”

What if we need an entity set twice in one relationship? Purchase Product Person Store salesperson buyer

Some versions of the ER model allow attributes on relationships Purchase Product Person Store date

You can “upgrade” a relationship to be an entity set Purchase Person Store Product StoreOf ProductOf BuyerOf date

Constraint = assertion about the DB that must always be true Key: social security number uniquely identifies a person. Single-value constraint: a person can have only one father. Referential integrity: if a person works for a company, the company must also be in the DB. Domain constraint: peoples’ ages are between 0 and 150. General constraint: all others (at most 100 students in this course)

Constraints are very important Help us to come up with efficient storage, query processing, etc. Help us keep garbage out of the DB –Garbage in, garbage out! Examples: Erbana, IL Brittany Speers

Underline the key for each entity set address namessn Person Product namecategory price multi-attribute keys are okay! Is this a good key? Multiple “candidate keys”? Pick just one to be the key.

Referential Integrity Constraints makes Company Product makes Company Product ) The reference integrity constraint on relationships explicitly requires a reference to exist The DB equivalent of a dangling pointer

Degree Constraints Constraints on degree of a relationship takes Courses Students <= 5

Sometimes your entity might not seem to have a key Weak entity set: some or all of its key attributes come from other classes to which it is related. UniversityTeam affiliation recordsportname )