CSIS 115 Database Design and Applications for Business

Slides:



Advertisements
Similar presentations
(wrapping up from last week)
Advertisements

Database Processing: Fundamentals, Design, and Implementation, 9/e by David M. KroenkeChapter 5/1 Copyright © 2004 Please……. No Food Or Drink in the class.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.
Fundamentals, Design, and Implementation, 9/e COS 346 Day 8.
© 2005 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B.
© 2008 Pearson Prentice Hall, Experiencing MIS, David Kroenke
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 8-1 COS 346 Day 17.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 5 th Edition.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
Functional Dependence An attribute A is functionally dependent on attribute(s) B if: given a value b for B there is one and only one corresponding value.
Chapter 9 Designing Databases Modern Systems Analysis and Design Sixth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Concepts and Terminology Introduction to Database.
© 2002 by Prentice Hall 1 Database Design David M. Kroenke Database Concepts 1e Chapter 5 5.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Database Design IST210 Class Lecture
Chapter 4 Database Processing Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall 4-1.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Database Design Sections 11 Database relationship, Integrity, keys, mapping conceptual model to logical/physical model Previous Section 12 – DDLesson11Fa12.ppt.
+ Relational Model IST210 Class Lecture. + Premiere Products A new company that is going to sells random merchandise via sales representatives You have.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 David M. Kroenke’s Chapter Six: Transforming Data Models into Database.
The Relational Model Chapter Two DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 4 th Edition.
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
Logical Database Design and the Relational Model.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
Chapter 3: Relational Databases
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 The Relational Data Model and Relational Database Constraints تنبيه.
AOIT Database Design Unit 3, Lesson 9 Data Integrity Copyright © 2009–2011 National Academy Foundation. All rights reserved.
Copyright © 2014 Pearson Canada Inc. 5-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5a Database Design Part 2: Using Information Technology.
Application Extension 5a
Chapter 5 Database Design
CSIS 115 Database Design and Applications for Business
Chapter 4 Logical Database Design and the Relational Model
Chapter 4: Logical Database Design and the Relational Model
CSIS 115 Database Design and Applications for Business
CSIS 115 Database Design and Applications for Business
CSIS 115 Database Design and Applications for Business
Transforming Data Models
Chapter 9 Part-1: Concepts & Foreign Keys
CSIS 115 Database Design and Applications for Business
The Relational Model and Database Normalization
David M. Kroenke and David J
The Relational Model Chapter Two DATABASE CONCEPTS, 3rd Edition
Implementing an REA Model in a Relational Database
Chapter 5: Logical Database Design and the Relational Model
CSIS 115 Database Design and Applications for Business
MIS 322 – Enterprise Business Process Analysis
Tables and Their Characteristics
CSIS 115 Database Design and Applications for Business
CSIS 115 Database Design and Applications for Business
Chapter 4 Relational Databases
Implementing an REA Model in a Relational Database
Developing Data Models – Conversion Rules
Translation of ER-diagram into Relational Schema
COS 346 Day 8.
Chapter 9 Designing Databases
© 2011 Pearson Education, Inc. Publishing as Prentice Hall
ERD’s REVIEW DBS201.
Chapter 9 Part-1: Concepts & Foreign Keys
Database Processing: David M. Kroenke’s Chapter Six:
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Copyright © 2018, 2015, 20 Pearson Education, Inc. All Rights Reserved Database Concepts Eighth Edition Chapter # 2 The Relational Model.
Guide to Modeling Keys to E-R diagrams.
Database Processing: David M. Kroenke’s Chapter Six:
Database Processing: David M. Kroenke’s Chapter Six:
Guide to Modeling Keys to E-R diagrams.
© 2008 Pearson Prentice Hall, Experiencing MIS, David Kroenke
Entity-Relationship Design
Presentation transcript:

CSIS 115 Database Design and Applications for Business Dr. Meg Fryling “Dr. Meg” Fall 2012 @SienaDrMeg #csis115 © 2012 Meg Fryling

Agenda Midterm Feedback/Questions Chapter 6: Translating ER Diagrams to Relations Enforcing minimum cardinalities Chapter 3: The Relational Model and Normalization

Heads-Up Next Quiz (Monday, 11/19) Minimum cardinality and referential integrity (including cascade updates and deletes) How to enforce and what those constraints mean. As usual, can have cheat sheet!

Homework Chapter 3: The Relational Model and Normalization Project Part III – Convert ER Diagram to DB Design First fix ER Diagram to reflect feedback from Project Part II (rewrite), as needed. Make sure you read the assignment requirements! Turn back in your last ER diagram Due Wednesday, 11/14 by start of class

Project Part III

Midterm Part III

Midterm Part III FKs in citation entity Relationship between DRIVER and VEHICLE instead of VEHICLE and CITATION

Midterm Part IV

Midterm Part IV Cascade update if PK can change Cascade delete on weak tables and tables created to establish M:N relationship ActorName one field Name fields should be required Index all FKs

Midterm Part IV Movie_CastID

Open Database Blackboard Assignments > In-Class Activities > 5 - ER (Conceptual) to DB (Physical)

Update Parent Primary Key? Your company has decided it wants the “Accounting and Finance” department to be department number 150 instead of 100. Can you change it? Why or why not?

Warning! Don’t use spaces in table or field names You will run into problems with your queries.

Let’s Try It! Update to reflect this design.

Let’s Try It! Update to reflect this design.

Summary 1:1 Relationships 1:1 relationship, first entity optional FK constraint – not required (NULL) FK Indexed (No duplicates) 1:1 relationship, first entity required FK constraint – required (NOT NULL) NOTE: We do not have a way, without programming, to enforce a required second entity

How would you implement a 1:N relationship that is also optional-mandatory? Set foreign key to required Index foreign key and allow duplicates Index foreign key and do not allow duplicates Make foreign key the primary key as well No can do! Answer: E (we can’t implement without programming)

Summary 1:N Relationships 1:N relationship, parent optional FK constraint – not required (NULL) FK Indexed (Duplicates OK) 1:N relationship, parent required FK constraint – required (NOT NULL) NOTE: We do not have a way, without programming, to enforce a required child entity

Hockey League ER Diagram 1:N – Mandatory-Optional We can’t actually enforce the maximum of 3 for coaches. That would require programming. Make sure you enforce minimum cardinalities.

Hockey League ER Diagram 1:N – Mandatory-Mandatory

Let’s Try It! Back to HR Database Update 1:M “belongs-to” relationship between DEPARTMENT and EMPLOYEE to enforce Mandatory-Optional (M-O) minimum cardinality

Hockey League ER Diagram M:N – Optional-Optional This becomes two 1:N – mandatory-optional relationships

Recursive Relationships Previous rules apply! 1:1 and 1:N add foreign key to table M:N need to add a new table

Hockey League ER Diagram M:N – Optional-Optional This becomes two 1:N – mandatory-optional relationships

Now, you do it! Don’t forget your translation “cheat sheet” Blackboard Assignments > In-Class Activities > 5 – ER (Conceptual) to DB (Physical) Phase 4 only

Transforming a Data Model into a Database Design Entity may become primary key (or use surrogate key) Entity attributes become table fields (columns) 1) Represent each entity with a table 2) Normalize tables as necessary Use foreign keys Add additional tables for N:M relationships 3) Represent relationships Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Normalization Normalization is a process of analyzing a table to ensure that it is well formed and contains a single entity We may need to split tables. More specifically, if a relation (table) is normalized (well formed), rows can be inserted, deleted, or modified without creating anomalies KROENKE and AUER - DATABASE CONCEPTS (3rd Edition) © 2008 Pearson Prentice Hall

Normalization Example Blackboard Assignments > In-Class Activities

Deletion Anomalies If we delete Advisor 3, we lose all the information regarding the Marketing Department. The structure of the table forces us to lose facts about 2 different things!!!

Insertion Anomalies To enter department data we are forced to enter unrelated data Structure of table forces us to enter facts about two entities when we just want to enter facts about one

Update Anomalies If we need to update FirstName, LastName, or Email no problem. What if we need to update “Computer Science” to “Computer Science - Information Science”? What bad thing can happen?

Update Anomalies If we need to update FirstName, LastName, or Email no problem If we update DeptCode or DeptName, we may create a data inconsistency Which DepartName is correct?

Normalizing for Data Integrity Data integrity problems happen when data are duplicated Normalized tables eliminate data duplication General goal of normalization is to construct tables so every table has a single topic or theme One fact – one place! Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Normalization Normalization: Process of converting a poorly structured table into two or more well-structured tables. Problem with these tables below is they have two independent themes: Employees and Department. Table before update Some rows show DeptNo 100 is “Accounting and Finance” and others show DeptNo 100 is “Accounting.” Which one is correct? Table after update – what’s wrong? Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Normalization Steps Create a new table for separate theme (repeated data). Keep a copy of the new table’s primary key in the original table as a foreign key. Create relationship between original and new table.