TM 6-1 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Logical Database Design and the Relational Database Professor Chen.

Slides:



Advertisements
Similar presentations
Normalization Dr. Mario Guimaraes. Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints.
Advertisements

1 Logical Database Design and the Relational Model Modern Database Management.
Monash University Week 7 Data Modelling Relational Database Theory IMS1907 Database Systems.
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.
The Database Approach u Emphasizes the integration of data across the organization.
© 2005 by Prentice Hall Chapter 3a Database Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Logical Database Design and the Relational Model (part 1)
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Chapter 4: Logical Database Design and the Relational 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.
© 2007 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 8 th Edition Jeffrey A. Hoffer, Mary B.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Chapter 4 Logical Database Design and the Relational Model
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 4: Logical Database Design and the Relational Model Modern Database Management 10.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
Chapter 4: Logical Database Design and the Relational Model (Part II)
Week 6 Lecture Normalization
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Concepts and Terminology Introduction to Database.
Database Management COP4540, SCS, FIU Relational Model Chapter 7.
Chapter 5: Logical Database Design and the Relational Model
Database Management COP4540, SCS, FIU Relation Normalization (Chapter 14)
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
Logical Database Design Relational Model. Logical Database Design Logical database design: process of transforming conceptual data model into a logical.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
Chapter 7 1 Database Principles Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
Object-Relational Modeling. What Is a Relational Data Model? Based on the concept of relations (tables of data) Relationships established by matching.
Chapter 5 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 8 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
Unit 4 Object Relational Modeling. Key Concepts Object-Relational Modeling outcomes and process Relational data model Normalization Anomalies Functional.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
© 2005 by Prentice Hall 1 The Database Development Process Dr. Emad M. Alsukhni The Database Development Process Dr. Emad M. Alsukhni Modern Database Management.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
CS263 Lecture 5: Logical Database Design Can express the structure of a relation by a Tuple, a shorthand notation Name of the relation is followed (in.
Pree Thiengburanathum, CAMT, Chiang Mai University 1 Database System Logical Database Design and the Relational Model November 1 st, 2009 Software Park,
Logical Database Design and the Relational Model.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part c): Logical Database Design and the Relational Model Modern Database Management.
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. 
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Normalization Hour1,2 Presented & Modified by Mahmoud Rafeek Alfarra.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
6-1 © Prentice Hall, 2007 Topic 6: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Chapter 8: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 3: LOGICAL DATABASE.
Chapter 5 MODULE 6: Normalization © 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 Prepared by: KIM GASTHIN M. CALIMQUIM.
© 2007 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 8 th Edition Jeffrey A. Hoffer, Mary B.
8-1 © Prentice Hall, 2007 Chapter 8: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Chapter 4, Part A: Logical Database Design and the Relational Model
Lecture 4: Logical Database Design and the Relational Model 1.
Logical Database Design and Relational Data Model Muhammad Nasir
Chapter 4 © 2013 Pearson Education, Inc. Publishing as Prentice Hall Chapter 4: Logical Database Design and the Relational Model Modern Database Management.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 4: PART C LOGICAL.
Database Normalization. What is Normalization Normalization allows us to organize data so that it: Normalization allows us to organize data so that it:
Chapter 4 Logical Database Design and the Relational Model
Normalization Karolina muszyńska
Chapter 5: Logical Database Design and the Relational Model
Example Question–Is this relation Well Structured? Student
Unit 4: Normalization of Relations
© 2011 Pearson Education, Inc. Publishing as Prentice Hall
Relational Database.
Chapter 5: Logical Database Design and the Relational Model
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Presentation transcript:

TM 6-1 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Logical Database Design and the Relational Database Professor Chen School of Business Administration Gonzaga University Spokane, WA 99258

TM 6-2 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems What is a Relation? A relation is a named, two-dimensional table of data. Each relation consists of a set of named columns and an arbitrary number of unnamed rows. Not all table are relations

TM 6-3 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-1: EMPLOYEE1 Relation with sample data EMPLOYEE1 Emp_IDNameDept_Name Salary 100 Margaret SimpsonMarketing 48, Allen BeetonAccounting 52, Chris LuceroInfo. System 43, Lorenzo DavisFinance 55, Susan MartinMarketing 42,000

TM 6-4 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Relational Definitions Relation –Every relation has a unique name. –Every attribute value is atomic (singled-value) (Fig. 6-1) –Every row is unique. –Attributes in tables have unique names. –The order of the columns is irrelevant. –The order of the rows is irrelevant.

TM 6-5 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-2: Eliminating multi-valued attributes (a) Table with repeating groups (Un-Normalized) Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X Java 8/12/199X

TM 6-6 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X Java 8/12/199X Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X 100 Margaret Simpson Marketing 48,000 Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X 110 Chris Lucero Info. System 43,000 C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X 150 Susan Martin Marketing 42,000 Java 8/12/199X

TM 6-7 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-2: Eliminating multi-valued attributes (b) EMPLOYEE2 Relation (Normalized) Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X 100 Margaret Simpson Marketing 48,000 Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X 110 Chris Lucero Info. System 43,000 C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X 150 Susan Martin Marketing 42,000 Java 8/12/199X EMPLOYEE2

TM 6-8 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Relational Keys and Structures Primary Key Composite Key Foreign Key –One-to-Many Relationship –Many-to-Many Relationship Intersection Data Candidate Key Surrogate Key

TM 6-9 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-3: Schema for four relations (Pine Valley Furniture) Graphical Representation

TM 6-10 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-3: Schema for four relations (Pine Valley Furniture) Graphical and Text Representations CUSTOMER(Customer_ID, Customer_name,Address, City,State,Zip) ORDER(Order_ID, Order_Date,Customer_ID) ORDER_LINE(Order_ID, Product_ID,Quantity) PRODUCT(Product_ID, Product_Description, Product_Finish,Unit_Price, On_Hand)

TM 6-11 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Integrity Constraints Domain Constraints –Allowable values for an attribute. – A domain definition contains: domain name, data type, size, meaning, and allowable values/range (if applicable). Entity Integrity –No primary key attribute may be null. Operational Constraints –Business rules (see Chapter 4)

TM 6-12 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-5: Referential integrity constraints (Pine Valley Furniture) pk ck/pk pk fk

TM 6-13 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Referential Integrity (Addition and Deletion) PK FK

TM 6-14 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Referential Integrity (Summary) Addition - you can’t add (insert) an ORDER record if Customer_ID (FK) does not exist (or does not match) a Customer_ID (PK) in the CUSTOMER table. Deletion - you can’t delete a CUSTOMER record if there is (are) related Customer_ID in the ORDER table.

TM 6-15 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Integrity Constraints Referential Integrity – A rule that states that either each foreign key value must match a primary key value in the other relation or else the foreign key value must be null. –For example: Delete Rules Restrict Cascade Set-to-Null

TM 6-16 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Referential Integrity (Conclusion) common field fk pk

TM 6-17 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Referential Integrity (Conclusion)

TM 6-18 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Referential Integrity (Conclusion)

TM 6-19 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Referential Integrity (Conclusion)

TM 6-20 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Order of Entering Data and Referential Integrity LOCATION FACULTY STUDENT

TM 6-22 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Well-Structured Relations A well-structured relation contains minimal redundancy and allows users to insert, modify, and delete the rows in a table without errors or inconsistencies. The following anomalies should be removed for a well-structured relation: –Insertion Anomaly –Deletion Anomaly –Modification Anomaly

TM 6-23 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X 100 Margaret Simpson Marketing 48,000 Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X 110 Chris Lucero Info. System 43,000 C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X 150 Susan Martin Marketing 42,000 Java 8/12/199X EMPLOYEE2 Is EMPLOYEE2 a Well- Structured relation?

TM 6-24 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Is EMPLOYEE2 a Well- Structured relation? NO! WHY?

TM 6-25 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Insertion Anomaly : Inserting a new row, the user must supply values for both Emp_ID (PK) and Course_Title (CK and FK). This is an (insertion) anomaly, since the user should be able to enter employee data without knowing (supplying) course (title) data. Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X 100 Margaret Simpson Marketing 48,000 Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X 110 Chris Lucero Info. System 43,000 C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X 150 Susan Martin Marketing 42,000 Java 8/12/199X EMPLOYEE2

TM 6-26 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Deletion Anomaly : Deleting the employee number 140, it results in losing not only the employee’s information but also the course had an offering that completed on that date. Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X 100 Margaret Simpson Marketing 48,000 Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X 110 Chris Lucero Info. System 43,000 C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X 150 Susan Martin Marketing 42,000 Java 8/12/199X EMPLOYEE2

TM 6-27 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Modification Anomaly : If the employee number 100 gets a salary increase, we must record the increase in each of the rows for that employee (two occurences); otherwise the data will be inconsistent. Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X 100 Margaret Simpson Marketing 48,000 Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X 110 Chris Lucero Info. System 43,000 C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X 150 Susan Martin Marketing 42,000 Java 8/12/199X EMPLOYEE2

TM 6-28 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-7: Normalized Relations from EMPLOYEE2 EMPLOYEE2 Emp_IDName Dept_Name Salary 100 Margaret Simpson Marketing 48, Allen Beet Accounting 52, Chris Lucero Info. System 43, Lorenzo Davis Finance 55, Sususan Martin Marketing 42,000 Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X 100 Margaret Simpson Marketing 48,000 Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X 110 Chris Lucero Info. System 43,000 C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X 150 Susan Martin Marketing 42,000 Java 8/12/199X Emp_ID Course_ Date_ Title Completed 100 SPSS 6/19/199X 100 Surveys 10/7/199X 140 Tax Acc 12/8/199X 110 SPSS 1/12/199X 110 C++ 4/22/199X 150 SPSS 6/19/199X 150 Java 8/12/199X EMPLOYEE1EMP_COURSE

TM 6-29 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Normalization Normalization is the process of decomposing relations with anomalies to produce smaller, well- structured and stable relations.

TM 6-30 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Data Normalization Normalization is a formal process for deciding which attributes should be grouped together in a relation (see Fig.6-7 next). Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of data.

TM 6-31 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-7: Normalized Relations from EMPLOYEE2 EMPLOYEE2 Emp_IDName Dept_Name Salary 100 Margaret Simpson Marketing 48, Allen Beet Accounting 52, Chris Lucero Info. System 43, Lorenzo Davis Finance 55, Sususan Martin Marketing 42,000 Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X 100 Margaret Simpson Marketing 48,000 Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X 110 Chris Lucero Info. System 43,000 C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X 150 Susan Martin Marketing 42,000 Java 8/12/199X Emp_ID Course_ Date_ Title Completed 100 SPSS 6/19/199X 100 Surveys 10/7/199X 140 Tax Acc 12/8/199X 110 SPSS 1/12/199X 110 C++ 4/22/199X 150 SPSS 6/19/199X 150 Java 8/12/199X EMPLOYEE1 EMP_COURSE

TM 6-32 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Functional Dependencies and Keys Functional Dependency: The value of one attribute (the determinant) determines the value of another attribute. Candidate Key:An attribute, or combination of attributes, that uniquely identifies a row in a relation. A candidate key is always a determinant, while a determinant may or may not be a candidate key. Each non-key field is functionally dependent on every candidate key.

TM 6-33 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-22: Steps in normalization

TM 6-34 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems First Normal Form Normal form is a state of a relation that results from applying simple rules regarding functional dependencies (or relationships between attributes) to that relation. No multi-valued attributes. Every attribute value is atomic. Fig. 6-2a, b.

TM 6-35 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X 100 Margaret Simpson Marketing 48,000 Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X 110 Chris Lucero Info. System 43,000 C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X 150 Susan Martin Marketing 42,000 Java 8/12/199X Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X Java 8/12/199X

TM 6-36 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Second Normal Form 1NF and every non-key attribute is fully functionally dependent on the primary key. Every non-key attribute must be defined by the entire key (either a single PK or a CK), not by only part of the key. No partial functional dependencies. Fig. 6-1,6-23a

TM 6-37 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-23: A Process of 1NF to 2NF (EMPLOYEE NF) (b) Functional Dependencies in EMPLOYEE2 Partial Depend. Emp_IDCourse_TitleNameDept_NameDate_CompletedSalary Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X 100 Margaret Simpson Marketing 48,000 Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X 110 Chris Lucero Info. System 43,000 C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X 150 Susan Martin Marketing 42,000 Java 8/12/199X

TM 6-38 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-23: A Process of 1NF to 2NF EMPLOYEE1 Emp_IDNameSalaryDept_Name (a) Functional dependencies in EMPLOYEE1 (2NF) Emp_IDNameDept_Name Salary 100 Margaret SimpsonMarketing 48, Allen BeetonAccounting 52, Chris LuceroInfo. System 43, Lorenzo DavisFinance 55, Susan MartinMarketing 42,000

TM 6-39 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Emp_IDNameSalaryDept_Name Emp_IDCourse_TitleNameDept_NameDate_CompletedSalary Partial Depend. EMPLOYEE2 EMPLOYEE1 Emp_IDCourse_TitleDate_Completed EMP_COURSE 2NF 3NF ? Fig. 6-23: Summary on Normalization

TM 6-40 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems EMPLOYEE2 (1NF) Emp_IDName Dept_Name Salary 100 Margaret Simpson Marketing 48, Allen Beet Accounting 52, Chris Lucero Info. System 43, Lorenzo Davis Finance 55, Sususan Martin Marketing 42,000 Emp_ID Name Dept_Name Salary Course_ Date_ Title Completed 100 Margaret Simpson Marketing 48,000 SPSS 6/19/199X 100 Margaret Simpson Marketing 48,000 Surveys 10/7/199X 140 Allen Beeton Accounting 52,000 Tax Acc 12/8/199X 110 Chris Lucero Info. System 43,000 SPSS 1/12/199X 110 Chris Lucero Info. System 43,000 C++ 4/22/199X 190 Lorenzo Davis Finance 55, Susan Martin Marketing 42,000 SPSS 6/16/199X 150 Susan Martin Marketing 42,000 Java 8/12/199X Emp_ID Course_ Date_ Title Completed 100 SPSS 6/19/199X 100 Surveys 10/7/199X 140 Tax Acc 12/8/199X 110 SPSS 1/12/199X 110 C++ 4/22/199X 150 SPSS 6/19/199X 150 Java 8/12/199X EMPLOYEE1 (3NF) EMP_COURSE (3NF) Fig. 6-23: Summary on Normalization

TM 6-41 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Third Normal Form 2NF and no transitive dependencies (functional dependency between non-key attributes.) Fig. 6-23, 6-24, 6-25.

TM 6-42 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-24: Relation with transitive dependency (a) SALES relation with simple data

TM 6-43 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems What Anomalies might be in SALES relation? Insertion anomaly ? Deletion anomaly ? Modification anomaly ?

TM 6-44 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-24: (b) Transitive dependency in SALES relation Cust_ID ---> Name, Salesperson, Region and Salesperson ---> Region therefore... Cust_ID ---> Region

TM 6-45 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-25: Removing a transitive dependency (a) Decomposing the SALES relation

TM 6-46 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-25: (b) Relations in 3NF

TM 6-47 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Snum Origin Destination Distance 409 Seattle Denver 1, Chicago Dallas 1, Boston Atlanta 1, Denver Las Angeles 1, Minneapolis St. Louis Seattle Denver 1,537 Fig. 6-26: Another example with transitive dependencies Insertion anomaly? Deletion anomaly? Modification anomaly?

TM 6-48 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Break !

TM 6-49 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-26: Another example with transitive dependencies Snum Origin DestinationDistance SHIPMENT Snum Origin Destination 409 Seattle Denver 618 Chicago Dallas 723 Boston Atlanta 824 Denver Las Angeles 629 Minneapolis St. Louis 353 Seattle Denver Origin Destination Distance Seattle Denver 1,537 Chicago Dallas 1,058 Boston Atlanta 1,214 Denver Las Angeles 1,150 Minneapolis St. Louis 587 Seattle Denver 1,537

TM 6-50 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Fig. 6-22: Steps in normalization

TM 6-51 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Merging Relations (View Integration) In a project development process, there may be a number of separate E-R diagrams and user views created and some of them may be redundant. Therefore, some relations should be merged to remove the redundancy.

TM 6-52 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Merging Relations (View Integration - A example) EMPLOYEE1( Employee_ID, Name, Address, Phone) EMPLOYEE2(Employee_ID, Name, Address, Jobcode, No_Years) EMPLOYEE(Employee_ID, Name, Address,Phone, Jobcode, No_Years)

TM 6-53 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Merging Relations (Problems on View Integration) ÊSynonyms: Different names, same meaning. ·Homonyms: Same name, different meanings. ¸Transitive Dependencies: e.g. (Stu ID, Major) (Stu ID, Advisor). ¹Supertype/Subtype.

TM 6-54 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Problems on View Integration ¶Synonyms: Different names, same meaning. STUDENT1(Student_ID, Name) STUDENT2(Matriculation_No,Name, Address) STUDENT(SSN, Name, Address) ·Homonyms: Same name, different meanings. STUDENT1(Student_ID, Name,Address) STUDENT2(Student_ID,Name, Phone_No,Address) STUDENT2(Student_ID,Name, Phone_No, Campus_Address, Permanent_Address)

TM 6-55 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Problems on View Integration ¶Synonyms: Different names, same meaning. STUDENT1(Student_ID, Name) STUDENT2(Matriculation_No,Name, Address) STUDENT(SSN, Name, Address) ·Homonyms: Same name, different meanings. STUDENT1(Student_ID, Name,Address) STUDENT2(Student_ID,Name, Phone_No,Address) STUDENT2(Student_ID,Name, Phone_No, Campus_Address, Permanent_Address)

TM 6-56 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Problems on View Integration ¸Transitive Dependencies STUDENT1(Student_ID, Major) STUDENT2(Student_ID, Advisor) the result is... STUDENT(Student_ID, Major, Advisor) and after removing transitive dependency STUDENT(Student_ID, Major) STUDENT(Major, Advisor)

TM 6-57 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Problems on View Integration ¹Supertype/Subtype PATIENT1(Patient_ID, Name, Address) PATIENT2(Patient_ID, Room_No) PATIENT(Patient_ID, Name, Address) INPATIENT(Patient_ID, Room_No) OUTPATIENT(Patient_ID, Date_Treated)

TM 6-58 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems After learning one of most important database concepts and theories... WHAT’S NEXT ?

TM 6-59 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Relational Definitions Tuple Attribute View

TM 6-60 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Relational Concepts Relational Algebra Relational Calculus Relational Operations –SELECT –PROJECT –JOIN Equijoin - Join field appears twice. Natural Join - Join field appears once.

TM 6-61 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Logical Database Design You have just learned and completed one of the most important concepts and theories, integrity constraints and normalization, for developing a quality of database.