CSIS 115 Database Design and Applications for Business

Slides:



Advertisements
Similar presentations
Database Lecture Notes Mapping ER Diagrams to Tables 2 Dr. Meg Murray
Advertisements

(wrapping up from last week)
Database Design Chapter Five DATABASE CONCEPTS, 6th Edition
Database Processing: Fundamentals, Design, and Implementation, 9/e by David M. KroenkeChapter 5/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Fundamentals, Design, and Implementation, 9/e COS 346 Day 8.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 5-1 COS 346 Day 9.
Fundamentals, Design, and Implementation, 9/e Chapter 5 Database Design.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 David M. Kroenke Database Processing Chapter 6 Transforming Data.
Relational Model Stores data as tables –Each column contains values about the same attribute –Each column has a distinct name –Each row contains values.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 COS 346 Day 10.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 COS 346 Day 8.
Methodology Logical Database Design for the Relational Model
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 COS 346 Day 7.
RELATIONSHIP  THE WAY TABLES ARE RELATED  A TABLE MUST PARTICIPATE IN AT LEAST ONE RELATIONSHIP  IN A BINARY RELATIONSHIP TWO ENTITIES PARTICIPATE 
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.
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.
Database Design Concepts INFO1408 Term 2 week 1 Data validation and Referential integrity.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 David M. Kroenke’s Chapter Six: Transforming ER Models into Database.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 6-1 David M. Kroenke’s Chapter Six: Transforming ER Models into Database.
LOGICAL DATABASE DESIGN
Transforming Data Models into Database Designs
Database Design.  Define a table for each entity  Give the table the same name as the entity  Make the primary key the same as the identifier of the.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
KROENKE and AUER - DATABASE CONCEPTS (3 rd Edition) © 2008 Pearson Prentice Hall 5-1 Chapter Objectives Learn how to transform E-R data models into relational.
Chapter Six Professor Adams’ Slides. Note that entities are shadowed, tables are not. Note that entities have no physical existence (blueprint) Note.
David M. Kroenke and David J. Auer Database Processing: F undamentals, Design, and Implementation Chapter Six: Transforming Data Models into Database Designs.
Database Design IST210 Class Lecture
Database Application Design and Data Integrity AIMS 3710 R. Nakatsu.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
1 Chapter 17 Methodology - Local Logical Database Design.
Database Design Chapter Five DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 3 rd Edition.
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.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 9 Designing Databases 9.1.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
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.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Six: Transforming Data Models into Database Designs.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall. 1 Skills for Success with Microsoft ® Office 2007 PowerPoint Lecture to Accompany.
AOIT Database Design Unit 3, Lesson 9 Data Integrity Copyright © 2009–2011 National Academy Foundation. All rights reserved.
Chapter Six: Transforming Data Models into Database Designs 6-1.
CSIS 115 Database Design and Applications for Business
Tables & Relationships
CSIS 115 Database Design and Applications for Business
Chapter 5 Database Design
CSIS 115 Database Design and Applications for Business
Methodology Logical Database Design for 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
CSIS 115 Database Design and Applications for Business
Database Design Chapter Five DATABASE CONCEPTS, 4th Edition
Chapter 5: Logical Database Design and the Relational Model
MIS 322 – Enterprise Business Process Analysis
CSIS 115 Database Design and Applications for Business
CSIS 115 Database Design and Applications for Business
Lecture # 13 (After 1st Exam)
COS 346 Day 8.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall
Database Processing: David M. Kroenke’s Chapter Six:
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Entities Things about which you need to store data. One entity for each different thing. At least two attributes At least two occurrences Not a property.
Database Design: Relational Model
Guide to Modeling Keys to E-R diagrams.
Chapter 17 Designing Databases
Microsoft Access Validation Rules, Table Relationships And
Database Processing: David M. Kroenke’s Chapter Six:
Database Processing: David M. Kroenke’s Chapter Six:
Guide to Modeling Keys to E-R diagrams.
Presentation transcript:

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

Agenda Quiz Review Homework (see next slide) Project Part II Appointments Chapter 6: Translating ER Diagrams to Relations Conceptual design to physical database

Homework See Course Schedule for Readings? Project – Part II (Rewrite) Due Weds, 10/31 by start of class Midterm is Mon, 11/5 Will discuss format as we get closer May bring a “cheat sheet” 8.5x11, handwritten, both sides, must use your own!

Project ER Diagram Make an appointment with to go over your project ER Diagram Go to Doodle Poll to select appt day/time http://www.doodle.com/z549que58ybwc3cd Pick a timeslot by start of class Monday (10/22) If you cannot make any of these times you must let me know by the end of this week so we can find an alternate time.

Phase 2 - Overview Phase 2: data type, NULL, other constraints Pick most appropriate way to represent each attribute. Determine which attributes are NOT NULL. Sometimes we relax that condition when loading data into a database Identify default value, if any Identify any other data constraints KROENKE AND AUER - DATABASE PROCESSING, 11th Edition © 2010 Pearson Prentice Hall

Now, you do it! Blackboard Assignments > In-Class Activities > 5 – ER (Conceptual) to DB (Physical) Phase 2 only

Column Properties: Data Constraints Data constraints are limitations on data values Domain constraint Validation Rule (Validation Text) column values must be in a given set of specific values: “Red”, “Green”, ”Blue” Range constraint column values must be within a given range of values: between 1 and 1000 KROENKE AND AUER - DATABASE PROCESSING, 11th Edition © 2010 Pearson Prentice Hall

Domain or range constraint See Highland University database for examples KROENKE AND AUER - DATABASE PROCESSING, 11th Edition © 2010 Pearson Prentice Hall

Column Properties: Data Constraints Data constraints are limitations on data values Data format constraints Input Mask Text or Date field types only Zip in 12211-0101 format Phone in (518) 555-5151 format KROENKE AND AUER - DATABASE PROCESSING, 11th Edition © 2010 Pearson Prentice Hall

Intrarelation Constraint

Highline University Example Open STUDENT table Update data types to appropriate values and sizes Make fields required as appropriate Add default value of NY for Residence State

Highline University Example Open STUDENT table Add input mask for Phone and ResidenceZip Add validation rule so GPA is between 2.5 and 3 Add validation rule so Admission Date is greater than today’s date Hint: use Date() Access function Add an intrarelation constraint that ensures graduation date is after admission date. Hint: See next slide >Date()

Phase 2: Verify Normalization The tables should be normalized based on the data model. Verify that all tables are at least in BCNF or 3rd NF No worries, more about this later! Chapters 3 & 4 KROENKE AND AUER - DATABASE PROCESSING, 11th Edition © 2010 Pearson Prentice Hall

Phase 3 - Overview Phase 3: create relationships Between strong and weak (ID-dependent) entities PK for parent is already part of child table’s PK so no FK required Between strong entities 1:1 add PK of first table as PK or FK of second table 1:N add PK of parent table as foreign key on child (many) table M:N create join/intersection table with PK of both tables Other attributes in JOIN table makes it an ASSOCIATION pattern. Recursive relationships 1:1 or 1:N add FK, which will link back to PK of same table M:N create join/intersection table Enforce referential integrity (select cascade updates/deletes as appropriate)

See “Translating ER Diagrams to Access” Blackboard Assignments > In-Class Activities > 5 – ER (Conceptual) to DB (Physical)

Phase 3: Create Relationships: 1:1 Strong Entity Relationships Place the key of one entity in the other entity as a foreign key. Either design will work—no parent, no child. Minimum cardinality considerations may be important. O-M will require a different design than M-O so one design will likely be preferable. More about this later… See Highland University relationship between STUDENT and PARKING_PASS KROENKE AND AUER - DATABASE PROCESSING, 11th Edition © 2010 Pearson Prentice Hall

Create Relationships: 1:1 Strong Entity Relationships Because these have optional-optional relationship we can put the foreign key in either place. KROENKE AND AUER - DATABASE PROCESSING, 11th Edition © 2010 Pearson Prentice Hall

Enforcing 1:1 with Indexed No Dups See Highland University relationship between STUDENT and PARKING_PASS KROENKE AND AUER - DATABASE PROCESSING, 11th Edition © 2010 Pearson Prentice Hall

Indexed = Yes (No Duplicates) Establishes that this is a 1:1 relationship – Yes (Duplicates OK) would be for 1:N Required = Yes -Enforces the minimum cardinality of 1 (required) on the first entity – for optional min cardinality this would be left set to No NOTE: There is no way, without programming, to enforce a minimum cardinality of 1 on child (or second entities).

Referential Integrity Referential Integrity - No (unchecked) Can update/delete record and “break” relationship between related records  Referential Integrity - Yes (checked) Cannot orphan child/related records Either prohibit update/delete OR update/delete child records as well OR remove FK value from child record (if not required)

Cascading Updates and Deletes A cascading update occurs when a change to the parent’s primary key is applied to the child’s foreign key. Surrogate keys never change and there is no need for cascading updates when using them (won’t hurt anything to select the checkbox though) A cascading delete occurs when associated child rows are deleted along with the deletion of a parent row. For strong entities, generally do not cascade deletes. For weak entities, generally do cascade deletes. KROENKE AND AUER - DATABASE PROCESSING, 11th Edition © 2010 Pearson Prentice Hall