MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )

Slides:



Advertisements
Similar presentations
Chapter 4: Logical Database Design and the Relational Model (Part I)
Advertisements

1 Logical Database Design and the Relational Model Modern Database Management.
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.
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.
Mapping from E-R Model to Relational Model Yong Choi School of Business CSUB.
Terms - data,information, file record, table, row, column, transaction, concurrency Concepts - data integrity, data redundancy, Type of databases – single-user,
© 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.
 Keys are special fields that serve two main purposes: ◦ Primary keys are unique identifiers of the relation in question. Examples include employee numbers,
Chapter 5: Logical Database Design and the Relational Model
Normalization Rules for Database Tables Northern Arizona University College of Business Administration.
Chapter 5 1 © Prentice Hall, 2002 Chapter 5: Transforming EER Diagrams into Relations Mapping Regular Entities to Relations 1. Simple attributes: E-R attributes.
© 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)
Mapping from Data Model (ERD) to Relational Model Yong Choi School of Business CSUB.
Web-Enabled Decision Support Systems
Concepts and Terminology Introduction to Database.
Mapping from Data Model (ERD) to Relational Model
MIS 301 Information Systems in Organizations Dave Salisbury ( )
MIS 301 Information Systems in Organizations Dave Salisbury ( )
Chapter 5: Logical Database Design and the Relational Model
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.
10/3/2012ISC329 Isabelle Bichindaritz1 Logical Design.
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
Chapter 5 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 8 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
© 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.
Pree Thiengburanathum, CAMT, Chiang Mai University 1 Database System Logical Database Design and the Relational Model November 1 st, 2009 Software Park,
MIS 301 Information Systems in Organizations Dave Salisbury ( )
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.
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.
Chapter 4, Part A: Logical Database Design and the Relational Model
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.
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.
Converting ER/EER to logical schema; physical design issues 1.
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 4: Part B Logical Database Design and the Relational Model
Normalization Karolina muszyńska
Modern Database Management Jeff Hoffer, Ramesh Venkataraman,
Chapter 5: Logical Database Design and the Relational Model
Example Question–Is this relation Well Structured? Student
Unit 4: Normalization of Relations
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:

MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( ) (web site)

Objectives of logical design... Translate the conceptual design into a logical database design that can be implemented on a chosen DBMS Input: conceptual model (ERD) Output: relational schema, normalized relations Resulting database must meet user needs for: Data sharing Ease of access Flexibility

Relational database components Data structure Data organized into tables Data manipulation Add, delete, modify, and retrieve using SQL Data integrity Maintained using business rules

Why do I need to know this? Mapping conceptual models to relational schema is straight-forward CASE tools can perform many of the steps, but.. Often CASE cannot model complexity of data and relationship (e.g., ternary relationships, supertype/subtypes) There are times when legitimate alternates must be evaluated You must be able to perform a quality check on CASE tool results

Some rules... Every table has a unique name. Attributes in tables have unique names. Every attribute value is atomic. Multi-valued and composite attributes? Every row is unique. The order of the columns is irrelevant. The order of the rows is irrelevant.

The key... Relational modeling uses primary keys and foreign keys to maintain relationships Primary keys are typically the unique identifier noted on the conceptual model Foreign keys are the primary key of another entity to which an entity has a relationship Composite keys are primary keys that are made of more than one attribute Weak entities Associative entities

Implementing it Instance Attribute Entity Field

What about relationships?

Constraints Domain constraints Allowable values for an attribute as defined in the domain Entity integrity constraints No primary key attribute may be null Operational constraints Business rules Referential integrity constraints

Referential integrity constraint Maintains consistency among rows of two entities matching of primary and foreign keys Enforcement options for deleting instances Restrict–don’t allow delete of “parent” side if related rows exist in “dependent” side Cascade–automatically delete “dependent” side rows that correspond with the “parent” side row to be deleted Set-to-Null–set the foreign key in the dependent side to null if deleting from the parent side  not allowed for weak entities

Transforming the EER diagram into relations The steps: Map regular entities Map weak entities Map binary relationships Map associative entities Map unary relationships Map ternary relationships Map supertype/subtype relationships

Transforming E-R diagrams into relations Mapping regular entities to relations Simple attributes: E-R attributes map directly onto the relation Composite attributes: Use only their simple, component attributes Multivalued Attribute–Becomes a separate relation with a foreign key taken from the superior entity

Mapping simple attributes

Mapping composite attributes

Mapping multi-valued attributes

Mapping weak entities Becomes a separate relation with a foreign key taken from the superior entity Primary key composed of: Partial identifier of weak entity Primary key of identifying relation (strong entity)

Mapping a weak entity

Looks like this using relational schema notation

Transforming E-R diagrams into relations Mapping binary relationships One-to-many - primary key on the one side becomes a foreign key on the many side Many-to-many - create a new relation (associative entity) with the primary keys of the two entities as its primary key I like to call these intersection entities to distinguish them from associative entities created at the conceptual level One-to-one - primary key on the mandatory side becomes a foreign key on the optional side

Example of mapping a 1:M relationship

Looks like this using relational schema notation

Example of mapping an M:N relationship

Looks like this using relational schema notation

Mapping a binary 1:1 relationship

Looks like this using relational schema notation

Mapping associative entities Identifier not assigned Default primary key for the association relation is the primary keys of the two entities Identifier assigned It is natural and familiar to end-users Default identifier may not be unique

Mapping an associative entity with an identifier

Looks like this using relational schema notation

Associative entity with identifier

Maps thusly to relational notation

Mapping unary relationships One-to-many - recursive foreign key in the same relation Many-to-many - two relations: One for the entity type One for an associative relation in which the primary key has two attributes, both taken from the primary key of the entity

For example...

Would look like...

And..

Would look like...

Mapping ternary (and n-ary) relationships One relation for each entity and one for the associative entity

Mapping a ternary (and n-ary) relationship

Looks like this using relational schema notation

Mapping Supertype/subtype relationships Create a separate relation for the supertype and each of the subtypes Assign common attributes to supertype Assign primary key and unique attributes to each subtype Assign an attribute of the supertype to act as subtype discriminator

Mapping supertype/subtype relationships

Would look like this...

Data normalization Normalization is a formal process for deciding which attributes should be grouped together in a relation Objective: to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of data Definition: the process of decomposing relations with anomalies to produce smaller, well-structured relations

Well-structured relations Well-structured relations contain minimal redundancy and allow insertion, modification, and deletion without errors or inconsistencies Anomalies are errors or inconsistencies resulting from redundancy Insertion anomaly Deletion anomaly Modification anomaly

Steps in normalization

Functional dependencies and keys Functional dependency: the value of one attribute (the determinant) determines the value of another attribute A -> B, for every valid instance of A, that value of A uniquely determines the value of B Candidate key: an attribute or combination of attributes that uniquely identifies an instance Uniqueness: each non-key field is functionally dependent on every candidate key Non-redundancy

First normal form No multi-valued attributes. Every attribute value is atomic. Any valid table is in first normal form.

Table with multivalued attributes, not in 1st normal form

Table with no multivalued attributes and unique rows, in 1st normal form

Anomalies in this Table Insertion–if new product is ordered for order 1007 of existing customer, customer data must be re-entered, causing duplication Deletion–if we delete the Dining Table from Order 1006, we lose information concerning this item's finish and price Update–changing the price of product ID 4 requires update in several records These anomalies exist because there are multiple themes (entity types) in one relation, resulting in duplication and an unnecessary dependency between the entities.

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, not by only part of the key. No partial functional dependencies.

Order_ID  Order_Date, Customer_ID, Customer_Name, Customer_Address Customer_ID  Customer_Name, Customer_Address Product_ID  Product_Description, Product_Finish, Unit_Price Order_ID, Product_ID  Order_Quantity Invoice functional dependency diagram (partial dependencies, therefore not in 2NF)

Partial dependencies are removed, but there are still transitive dependencies Removing partial dependencies

Third normal form 2NF and no transitive dependencies (functional dependency between non-key attributes.) This is called transitive, because the primary key is a determinant for another attribute, which in turn is a determinant for a third Non-key determinant with transitive dependencies go into a new table; non-key determinant becomes primary key in the new table and stays as foreign key in the old table

Transitive dependencies are removed Removing transitive dependencies

Merging Relations View Integration–Combining entities from multiple ER models into common relations Issues to watch out for when merging entities from different ER models: Synonyms–two or more attributes with different names but same meaning Homonyms–attributes with same name but different meanings Transitive dependencies–even if relations are in 3NF prior to merging, they may not be after merging Supertype/subtype relationships–may be hidden prior to merging

Enterprise Keys Primary keys that are unique in the whole database, not just within a single relation Corresponds with the concept of an object ID in object-oriented systems

a) Relations with enterprise key b) Sample data with enterprise key Enterprise keys