1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.

Slides:



Advertisements
Similar presentations
Database Design Process
Advertisements

Chapter 5 Normalization of Database Tables
BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
Modeling the Data: Conceptual and Logical Data Modeling
Normalization of Database Tables
Systems Development Life Cycle
© 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.
© 2005 by Prentice Hall Chapter 3a Database Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Entity-Relationship Model and Diagrams (continued)
The Relational Database Model:
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Modern Systems Analysis and Design Third Edition
Chapter 5 Normalization of Database Tables
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Chapter 3: Data Modeling
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 5 Normalization of Database Tables.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
Introduction to Databases
Chapter 7 Logical Database Design
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
Chapter 5 1 © Prentice Hall, 2002 Chapter 5: Transforming EER Diagrams into Relations Mapping Regular Entities to Relations 1. Simple attributes: E-R attributes.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
Web-Enabled Decision Support Systems
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Chapter 1 Overview of Database Concepts Oracle 10g: SQL
1 Chapter 1 Overview of Database Concepts. 2 Chapter Objectives Identify the purpose of a database management system (DBMS) Distinguish a field from a.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 2 Slide 1 Chapter 10 Designing Databases.
Relational DB Components
Fundamentals of Database Management Systems, 2nd ed
Concepts and Terminology Introduction to Database.
CHAPTER 8: MANAGING DATA RESOURCES. File Organization Terms Field: group of characters that represent something Record: group of related fields File:
Lecture 2 An Overview of Relational Database IST 318 – DB Admin.
Normalization A technique that organizes data attributes (or fields) such that they are grouped to form stable, flexible and adaptive entities.
Database Systems: Design, Implementation, and Management Tenth Edition
1 DATABASE SYSTEMS DESIGN IMPLEMENTATION AND MANAGEMENT INTERNATIONAL EDITION ROB CORONEL CROCKETT Chapter 7 Normalisation.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
MS Access: Creating Relational Databases Instructor: Vicki Weidler Assistant: Joaquin Obieta.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T5 DESIGNING DATABASE APPLICATIONS.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
CIS 210 Systems Analysis and Development Week 6 Part II Designing Databases,
Next Back A-1 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights.
C-1 Management Information Systems for the Information Age Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Extended Learning Module.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
IMS 4212: Introduction to Data Modeling—Relationships 1 Dr. Lawrence West, Management Dept., University of Central Florida Relationships—Topics.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.
9/23/2012ISC329 Isabelle Bichindaritz1 Normalization.
Lection №4 Development of the Relational Databases.
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
Chapter 10 Designing Databases. Objectives:  Define key database design terms.  Explain the role of database design in the IS development process. 
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
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.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
Lecture 4: Logical Database Design and the Relational Model 1.
Logical Design 12/10/2009GAK1. Learning Objectives How to remove features from a local conceptual model that are not compatible with the relational model.
McGraw-Hill/Irwin Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Modeling the Data: Conceptual and Logical Data Modeling.
Normalization. Overview Earliest  formalized database design technique and at one time was the starting point for logical database design. Today  is.
Database Planning Database Design Normalization.
Converting ER/EER to logical schema; physical design issues 1.
Chapter 5: Logical Database Design and the Relational Model
Presentation transcript:

1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Session 7 Designing a Database (Part 2 – some gentle repetition) ITE 252 Database Management

2 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Homework HW#1: Create an E-R diagram modeled after the Good Reading Bookstores E-R diagram (Figure 3-19 in your text and slide 14 here) for a publisher of music (limit to MP3s). Draw the diagram by hand and write up a description similar to the one in section (pp.95-95) in your text. Some are outstanding

3 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Designing Relational Tables Typical process for converting E-R diagrams to relational tables: – Each entity converts to table – For many-to-many relationships, each associative entity converts to table – Attributes become table columns – Ensure foreign keys appear in proper places in tables To convert single entity, create table of same name with column for each attribute

4 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Salesperson Entity and Table

5 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Converting Binary Relationships Greater importance in selecting identifier and primary key – Identifier and primary key define foreign key that establishes relationships between tables Often more than one way to represent entity relationships as relational tables

6 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Example: Converting 1-1 Binary Relationship

7 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Example: Converting 1-1 Binary Relationship

8 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Example: Converting 1-1 Binary Relationship

9 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Example: Converting 1-1 Binary Relationship Converting one-to-one Salesperson/Office relationship – Options: Convert relationship to single/combined table Convert relationship to two tables

10 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Example: Converting 1-1 Binary Relationship Considerations: – Business environment considers Salesperson and Office as separate entities – Modality of zero at Salesperson entity in E-R diagram (office may have no one assigned) – Salesperson entity in E-R diagram has relationships with other entities

11 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Example: Converting 1-1 Binary Relationship Solution 1: – Combine two entities into one table

12 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Example: Converting 1-1 Binary Relationship Solution 2: – Two separate tables – Office Number as foreign key in Salesperson table

13 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Example: Converting 1-1 Binary Relationship Solution 3: – Two separate tables – Salesperson Number as foreign key in Office table

14 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting 1-M Binary Relationship

15 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting 1-M Binary Relationship Each occurrence of Salesperson is related to zero or more occurrences of Customer Unique identifier of entity on “one” side is placed as foreign key in entity of “many” side

16 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting 1-M Binary Relationship

17 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting M-M Binary Relationship

18 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting M-M Binary Relationship Most relational DBMS systems DO NOT directly support many-to-many relationships Solution: Include associative entity to establish relationship May use composite key as primary key in associative entity A key that is defined by multiple columns is called a composite key

19 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting M-M Binary Relationship

20 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting M-M Binary Relationship not required

21 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting 1-1 Unary Relationship

22 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting 1-1 Unary Relationship With: – Only one entity type involved, and – One-to-one relationship Conversion requires only one table

23 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting 1-M Unary Relationship each salesperson manages zero or more salespersons each salesperson is managed by a manager

24 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting 1-M Unary Relationship each salesperson is managed by a manager

25 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting M-M Unary Relationship Many-to-many unary relationship: – For example: one product can be constructed out of set or subset of other products – General rule in conversion: Number of tables equal to number of entity types plus one more table for many-to-many relationship – M-M unary relationship - 2 tables – M-M binary relationship - 3 tables – M-M ternary relationship - 4 four tables

26 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting M-M Unary Relationship

27 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting M-M Unary Relationship

28 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Homework Read Chapter 4.1- pp Read several times!

29 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Key Terms Composite key - A key that is defined by multiple columns Data integrity - Ensuring that data values are properly entered and maintained Defining association - A means of expressing that the value of one particular attribute is associated with a single, specific value of another attribute Null value - An undefined value, usually used to identify that no value is provided for that attribute Referential integrity - Another name for relational integrity, referring to the fact that you are maintaining the relationship between referencing and referenced tables. Relational integrity - Ensuring that relationships between tables are correctly created and maintained.

30 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A Which statement best describes the process of converting a one-to-one binary relationship to related tables? a)You should convert the entities into a single related table. b)There will typically be only one way to define the tables. c)There will typically be more than one way to define the tables.

31 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A Which statement best describes the process of converting a one-to-one binary relationship to related tables? a)You should convert the entities into a single related table. b)There will typically be only one way to define the tables. c)There will typically be more than one way to define the tables.

32 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A You are converting a many-to-many unary relationship. How many relational tables will result from this conversion? a)one b)two c)three d)four

33 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A You are converting a many-to-many unary relationship. How many relational tables will result from this conversion? a)one b)two c)three d)four

34 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A Manager-to-Employee is a one-to-many unary relationship. You create an EMPLOYEE table. How any additional tables do you need? a)none b)one c)two

35 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A Manager-to-Employee is a one-to-many unary relationship. You create an EMPLOYEE table. How any additional tables do you need? a)none b)one c)two

36 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A Data integrity ensures that data is entered and stored correctly. True or False?

37 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Q&A Data integrity ensures that data is entered and stored correctly. True or False?

38 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Good Reading Bookstores

39 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Good Reading Bookstores

40 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Good Reading Bookstores

41 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Normalizing Data Data normalization: Methodology for organizing attributes into tables to eliminate redundancy among non-key attributes Goals: – Each resultant table describes single entity type or single many-to-many relationship – Foreign keys appear exactly where needed – Properly structured relational database

42 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Normalization Techniques Two types of input needed for data normalization process 1.List of all attributes to be incorporated in database, including intersection data attributes 2.List of functional dependencies: all defining associations between attributes In functional dependencies, one attribute (determinate attribute – left side) defines value of another attribute – functionally dependent on the left side Salesperson Number → Salesperson Name

43 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Converting M-M Binary Relationship

44 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Entity Attributes Assume the salespersons are organized into departments and that each department has a manger who is not herself a sales person We get this list of attributes…

45 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Salesperson Entity Attributes

46 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Salesperson Entity Functional Dependencies (Defining Associations)

47 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Defining Attributes and Functional Dependencies Quantity is defined by two combined attributes Manager is defined independently by two attributes – Department Number and Salesperson Number Salesperson Number also defines Department Number

48 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Normalizing Data Normal forms: Rules for data normalization Three main normal forms – First normal form – Second normal form – Third normal form Normalization: – Uses normal forms to step through “decomposition process” that decomposes attributes into subgroups In third normal form, group of tables is well-structured relational database with no data redundancy Goal: no data redundancy

49 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Normalizing Data First normal form: – Eliminates multiple values Second normal form: – Eliminates partial functional dependencies (data dependent on part of primary key) – Every nonkey attribute must be fully functionally dependent on entire key of table Third normal form: – Eliminates transitive dependencies (one nonkey attribute is functionally dependent on another) – Nonkey attributes are not allowed to define other nonkey attributes

50 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Example: Unnormalized Data multiple values

51 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management First Normal Form multiple values

52 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Second Normal Form eliminate partial functional dependencies (See figure 4-29 in text; some redundant data)

53 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Third Normal Form (See figure 4-31 in text; notice DEPARTMENT table)

54 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Denormalizing Data Denormalizing may be needed when: – Normalization has been taken to extreme Too many small tables creating more work and storage space – E.g. Using State table to be referenced instead of entering two-digit code) – More efficient data retrieval is needed: Many queries requiring resource-intensive joining In denormalizing, you join two or more tables into one less normalized table

55 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Summary In converting E-R diagrams to relational tables, each entity typically converted into table, with attributes as table columns. Considerations in conversion: Business needs, cardinalities, modalities, and defining foreign keys to establish relationships. Normalization: Uses three main normal forms to step through “decomposing” attributes into subgroups that allow data redundancies to be eliminated. Denormalizing may be needed in cases where storage space and speed of data retrieval are important factors.

56 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Key Terms Data normalization - A methodology for organizing attributes into tables so that redundancy among the nonkey attributes is eliminated Decomposition process - Another term for the data normalization process. Also called “non-loss decomposition” Determinant attribute - The attribute in a defining association whose value determines the value of the attribute on the right side of the association Exception conditions - Less commonly used normal forms First normal form - Each attribute value is atomic, that is, no attribute is multivalued Functional dependency - See Defining association

57 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management Key Terms Joining - Combining the data from two tables based on linking columns Non-loss decomposition - Normalization process in which neither data nor relationships are lost Normal forms - Defined rules for data normalization Partial functional dependency - A dependency where data is dependent on part of the primary key Second normal form - Every nonkey attribute must be fully functionally dependent on the entire key Third normal form (3NF) - Transitive dependencies are not allowed Transitive dependency - One nonkey attribute is functionally dependent

58 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management international, open membership, not- for-profit technology standards consortium. Important Links Database Normalization - good description from Wikipedia Database Normalization An Introduction to Database Normalization – if you can get past the computerized female voice, it’s a pretty good overview An Introduction to Database Normalization Database Normalizaion Basics – Microsoft Overview Database Normalizaion Basics