© 2011 Pearson Education, Inc. Publishing as Prentice Hall

Slides:



Advertisements
Similar presentations
Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
Advertisements

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.
Data Storage Formats Files Databases
Modern Systems Analysis and Design Third Edition
Chapter 9 Designing Databases
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Introduction to Schema Refinement. Different problems may arise when converting a relation into standard form They are Data redundancy Update Anomalies.
10-1 Chapter 10 Designing Databases Modern Systems Analysis and Design Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
1 C omputer information systems Design Instructor: Mr. Ahmed Al Astal IGGC1202 College Requirement University Of Palestine.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
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 ( )
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.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 2 Slide 1 Chapter 10 Designing Databases.
Chapter 9 Designing Databases Modern Systems Analysis and Design Sixth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Lecture 12 Designing Databases 12.1 COSC4406: Software Engineering.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
Normalisation Rules and Practical Application Geoff Leese January 2010.
Logical Database Design Relational Model. Logical Database Design Logical database design: process of transforming conceptual data model into a logical.
10/3/2012ISC329 Isabelle Bichindaritz1 Logical Design.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
Chapter 10 Designing Databases Modern Systems Analysis and Design Fifth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
CIS 210 Systems Analysis and Development Week 6 Part II Designing Databases,
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Essentials of Systems Analysis and Design Fourth Edition Joseph S. Valacich Joey F.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter 9 Designing Databases.
Chapter 10 Designing Databases. Objectives:  Define key database design terms.  Explain the role of database design in the IS development process. 
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.
6-1 © Prentice Hall, 2007 Topic 6: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
8-1 © Prentice Hall, 2007 Chapter 8: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
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.
Logical Database Design and Relation Data Model Muhammad Nasir
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 12 Designing.
Cis339 Modern Systems Analysis and Design Fifth Edition Chapter 10 Designing Databases 10.1.
Logical Design & the Relational Model
Chapter 8: Object-Relational Modeling
Logical Database Design and the Rational Model
Chapter 4 Logical Database Design and the Relational Model
Chapter 4: Logical Database Design and the Relational Model
Chapter 9 Designing Databases
Normalization Karolina muszyńska
Chapter 5: Logical Database Design and the Relational Model
Entity-Relationship Model
MIS 322 – Enterprise Business Process Analysis
Modern Systems Analysis and Design Third Edition
Chapter 4 Relational Databases
Example Question–Is this relation Well Structured? Student
Translation of ER-diagram into Relational Schema
Chapter 9 Designing Databases
Relational Database.
Chapter 9 Designing Databases
System Analysis and Design
Chapter 12 Designing Databases
Database Processing: David M. Kroenke’s Chapter Six:
A Normalization Example
Chapter 10 Designing Databases
Chapter 9 Designing Databases
System Analysis and Design
Copyright © 2018, 2015, 20 Pearson Education, Inc. All Rights Reserved Database Concepts Eighth Edition Chapter # 2 The Relational Model.
Chapter 17 Designing Databases
Database Processing: David M. Kroenke’s Chapter Six:
Chapter 4 The Relational Model and Normalization
Database Processing: David M. Kroenke’s Chapter Six:
Shelly Cashman: Microsoft Access 2016
Presentation transcript:

Data Modeling Breaking data into different tables is the first step in data modeling

© 2011 Pearson Education, Inc. Publishing as Prentice Hall Introduction FIGURE 9-1 Systems development life cycle with design phase highlighted Chapter 9 © 2011 Pearson Education, Inc. Publishing as Prentice Hall

Relational Database Model Relation: a named, two-dimensional table of data; each relation consists of a set of named columns and an arbitrary number of unnamed rows Relational database model: data represented as a set of related tables and their relations Relations have several properties that distinguish them from non-relational tables: Entries in cells are simple. Entries in columns are from the same set of values. Each row is unique. The sequence of columns can be interchanged without changing the meaning or use of the relation. The rows may be interchanged or stored in any sequence. Chapter 9 © 2011 Pearson Education, Inc. Publishing as Prentice Hall

Transforming E-R Diagrams into Relations It is useful to transform the conceptual data model into a set of normalized relations. Steps Represent entities. Represent relationships. Normalize the relations (remove redundancies) Merge the relations. Connect the tables (entities) Chapter 9

Representing Entities (tables) Each regular entity is transformed into a table with attributes and a primary key. The identifier of the entity type becomes the primary key of the corresponding relation. The primary key must satisfy the following two conditions. The value of the key must uniquely identify every row in the relation – choose a field that can identify each row (ie customerID) The key should be non-redundant. (no duplicates) Chapter 9 © 2011 Pearson Education, Inc. Publishing as Prentice Hall

Binary 1:N Relationships Binary 1:N Relationship is represented by adding the primary key attribute (or attributes) of the entity on the one side of the relationship as a foreign key in the relation that is on the many side of the relationship. This is the common one to many relationship Chapter 9 © 2011 Pearson Education, Inc. Publishing as Prentice Hall

Binary and Higher-Degree M:M Relationships Create another relation and include primary keys of all relations as primary key of new relation Chapter 9 © 2011 Pearson Education, Inc. Publishing as Prentice Hall

Standard Table Notation 11/14/2018Chapter 9 © 2011 Pearson Education, Inc. Publishing as Prentice Hall

Normalization and Rules of Normalization Normalization: the process of converting complex data structures (chaos data) into simple, stable data structures Un-normalized Form Multi-valued Attributes (more than one value in a column) Normal Forms First Normal Form (1NF) Unique rows, no multi-valued attributes (no repeating groups, ie. More than one value in a cell) Second Normal Form (2NF) Each non-primary key attribute is identified by the whole key (called full functional dependency). The columns belong together in a table – belong to the primary key Third Normal Form (3NF) Non-primary key attributes do not depend on each other (i.e. no transitive dependencies). A value in a column in a table is not dependent on a non-primary key value from another table

© Shelly and Rosenblatt 2011 Unnormalized Table A table that contains a repeating group (multivalued attributes) is in “unnormalized” form ORDER (ORDER-NUM, ORDER-DATE, (PRODUCT-NUM, PRODUCT-DESC, NUM-ORDERED)) © Shelly and Rosenblatt 2011

First Normal Form – 1NF – add more rows A table is in first normal form(1NF ) if it does not contain a repeating group. To convert an unnormalized design to 1NF, you must expand the table's primary key to include the primary key of the repeating group. ORDER (ORDER-NUM, ORDER-DATE, PRODUCT-NUM, PRODUCT-DESC, NUM-ORDERED) 11/14/2018Chapter 9 © Shelly and Rosenblatt 2011

Functional Dependency For a given relation, attribute B (Region) is functionally dependent on attribute A (customer name) if, for every valid value of A, that value of A uniquely determines the value of B. Customers can belong to only one region. If not create another row of data with a composite primary key The functional dependence of B on A is represented by A→B. Functional dependency is not a mathematical dependency. Knowledge of problem domain is most reliable method for identifying functional dependency. Chapter 9 © 2011 Pearson Education, Inc. Publishing as Prentice Hall

Second Normal Form (2NF) Common to drop other columns into this top- level table like totals Second Normal Form (2NF) A relation is in second normal form (2NF) if any of the following conditions apply: Every non-primary key attribute is functionally dependent on the full set of primary key attributes. The primary key consists of only one attribute. No non-primary key attributes exist in the relation. (one to many relationship has no composite PK’s ORDER (ORDER-NUM, ORDER-DATE), PRODUCT (PRODUCT-NUM, PRODUCT-DESC) ORDER-LINE (ORDER-NUM, PRODUCT-NUM, NUM-ORDERED) 11/14/2018Chapter 9

How to convert from 1NF to 2NF – Step 1 – break tables apart Step 1: Create and name a separate table for each field in the existing primary key. For example, in the previous example, the ORDER table's primary key has two fields, ORDER-NUM and PRODUCT-NUM, so you must create two tables. The ellipsis (…) indicates that fields will be assigned later. The result is: ORDER (ORDER-NUM,…) PRODUCT (PRODUCT-NUM,…) © Shelly and Rosenblatt 2011

How to convert from 1NF to 2NF – Step 2 Step 2: Create a new table for each possible combination of the original primary key fields. In the example, you would create and name a new table with a combination primary key of ORDER-NUM and PRODUCT-NUM. This table describes individual lines in an order, so it is named ORDER-LINE, as shown: ORDER-LINE (ORDER-NUM, PRODUCT-NUM,…) © Shelly and Rosenblatt 2011

How to convert from 1NF to 2NF – Step 3 Step 3: Study the three tables and place each field with its appropriate primary key, which is the minimal key on which it functionally depends. When you finish placing all the fields, remove any table that did not have any additional fields assigned to it. The remaining tables are the 2NF version of your original table. In the example, the three tables would be shown as: ORDER (ORDER-NUM, ORDER-DATE) PRODUCT (PRODUCT-NUM, PRODUCT-DESC) ORDER-LINE (ORDER-NUM, PRODUCT-NUM, NUM-ORDERED) © Shelly and Rosenblatt 2011

© Shelly and Rosenblatt 2011 Third Normal Form (3NF) A relation is in third normal form (3NF) if it is in second normal form (2NF) and there are no functional (transitive) dependencies between two (or more) nonprimary key attributes. To convert the table from 2NF to 3NF, you must remove all fields from the 2NF table that depend on another nonkey field and place them in a new table that uses the nonkey field as a primary key. © Shelly and Rosenblatt 2011

Third Normal Form (3NF) – Another example A relation is in third normal form (3NF) if it is in second normal form (2NF) and there are no functional (transitive) dependencies between two (or more) nonprimary key attributes. Chapter 9 © 2011 Pearson Education, Inc. Publishing as Prentice Hall

A Normalization Example © Shelly and Rosenblatt 2011

Q1. Represent this table in standard Table notation. STUDENT (STUDENT-NUMBER, STUDENT-NAME, TOTAL-CREDITS, GPA, ADVISOR-NUMBER, ADVISOR-NAME, (COURSE-NUMBER, COURSE-DESC, NUM-CREDITS, GRADE)) © Shelly and Rosenblatt 2011

Q2. What form is this table in? Unnormalized? 1NF? 2NF?3NF? This table is in Unnormalized form. Why? Because it contains a repeating group. © Shelly and Rosenblatt 2011

© Shelly and Rosenblatt 2011 Q3. Convert the table to first normal form and represent it in standard table notation. STUDENT (STUDENT-NUMBER, STUDENT-NAME, TOTAL-CREDITS, GPA, ADVISOR-NUMBER, ADVISOR-NAME, COURSE-NUMBER, COURSE-DESC, NUM-CREDITS, GRADE) © Shelly and Rosenblatt 2011

© Shelly and Rosenblatt 2011 Q3. Convert the table to second normal form and represent it in standard table notation. Step 1: Create Tables with primary keys and combinations STUDENT (STUDENT-NUMBER, … ) COURSE(COURSE-NUMBER, …) GRADEINFO(STUDENT-NUMBER, COURSE-NUMBER,…) Step 2: Add the non-key attributes which are functionally dependent on minimal keys STUDENT (STUDENT-NUMBER, STUDENT-NAME, TOTAL-CREDITS, GPA, ADVISOR-NUMBER, ADVISOR-NAME) COURSE(COURSE-NUMBER, COURSE-DESC, NUM-CREDITS) GRADEINFO(STUDENT-NUMBER, COURSE-NUMBER, GRADE) Step 3: Drop any tables where there is no additional column other than the primary key. Step 4:Remaining tables are in 2NF form. Verify that condition for 2NF is satisfied: Table is in 1NF and Every non primary-key attribute is functionally dependent on whole primary key. © Shelly and Rosenblatt 2011

© Shelly and Rosenblatt 2011 Q3. Convert the table to third normal form and represent it in standard table notation. Table is in 3NF if it is in 2NF and there are no transitive dependencies (No non-primary key attributes are functionally dependent on each other). Separate them into a separate table. STUDENT (STUDENT-NUMBER, STUDENT-NAME, TOTAL-CREDITS, GPA, ADVISOR-NUMBER) ADVISOR (ADVISOR-NUMBER, ADVISOR-NAME) COURSE(COURSE-NUMBER, COURSE-DESC, NUM-CREDITS) GRADEINFO(STUDENT-NUMBER, COURSE-NUMBER, GRADE) © Shelly and Rosenblatt 2011

© 2011 Pearson Education, Inc. Publishing as Prentice Hall Choosing Data Types Selecting a data type balances four objectives: Minimize storage space. Represent all possible values of the field. Improve data integrity of the field. Support all data manipulations desired on the field. Examples: CHAR, LONG, NUMBER Chapter 9 © 2011 Pearson Education, Inc. Publishing as Prentice Hall

Controlling Data Integrity Default Value: a value a field will assume unless an explicit value is entered for that field Range Control: limits range of values that can be entered into field Both numeric and alphanumeric data Referential Integrity: an integrity constraint specifying that the value (or existence) of an attribute in one relation depends on the value (or existence) of the same attribute in another relation Null Value: a special field value, distinct from zero, blank, or any other value, that indicates that the value for the field is missing or otherwise unknown Chapter 9 © 2011 Pearson Education, Inc. Publishing as Prentice Hall

© 2011 Pearson Education, Inc. Publishing as Prentice Hall Summary Normalization, functional dependency, foreign key, referential integrity, field, data type, null value, Explain the role of designing databases in the analysis and design of an information system. Chapter 9 © 2011 Pearson Education, Inc. Publishing as Prentice Hall