BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.

Slides:



Advertisements
Similar presentations
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. Extended Learning Module C Designing Databases and Entity-Relationship.
Advertisements

© McGraw-Hill Companies, Inc., McGraw-Hill/Irwin Extended Learning Module C Designing Databases and Entity-Relationship Diagramming.
The Relational Database Model
Accounting System Design
Systems Development Life Cycle
Storing Organizational Information—Databases
Modeling the Data: Conceptual and Logical Data Modeling
System Analysis - Data Modeling
Databases Revision.
Systems Development Life Cycle
Systems Analysis Requirements structuring Process Modeling Logic Modeling Data Modeling  Represents the contents and structure of the DFD’s data flows.
The Relational Database Model:
Extended Learning Module C Designing Databases and Entity-Relationship Diagramming McGraw-Hill/Irwin Copyright © 2010 by the McGraw-Hill Companies, Inc.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 7 Storing Organizational Information - Databases.
Business Driven Technology Unit 2 Exploring Business Intelligence Copyright © 2015 McGraw-Hill Education. All rights reserved. No reproduction or distribution.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Concepts of Database Management Seventh Edition
Chapter 3: Data Modeling
BUSINESS DRIVEN TECHNOLOGY
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
APPENDIX C DESIGNING DATABASES
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 10 Structuring.
PHASE 3: SYSTEMS DESIGN Chapter 7 Data Design.
Computer System Analysis Chapter 10 Structuring System Requirements: Conceptual Data Modeling Dr. Sana’a Wafa Al-Sayegh 1 st quadmaster University of Palestine.
6-1 DATABASE FUNDAMENTALS Information is everywhere in an organization Information is stored in databases –Database – maintains information about various.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Chapter 1 Overview of Database Concepts Oracle 10g: SQL
STORING ORGANIZATIONAL INFORMATION— DATABASES CIS 429—Chapter 7.
Chapter 5 Entity–Relationship Modeling
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
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:
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Fundamentals of Relational Database Operations
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T5 DESIGNING DATABASE APPLICATIONS.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T5: Designing Database Applications Business Driven Technology.
Storing Organizational Information - Databases
1 A Guide to MySQL 2 Database Design Fundamentals.
Concepts of Database Management Sixth Edition Chapter 6 Database Design 2: Design Method.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 7 Storing Organizational Information - Databases.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 7 Storing Organizational Information - Databases.
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
C-1 Management Information Systems for the Information Age Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Extended Learning Module.
Lecture 4 Conceptual Data Modeling. Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship,
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Concepts of Database Management, Fifth Edition Chapter 6: Database Design 2: Design Methodology.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 3 The Relational Database Model.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.
The relational model A data model (in general) : Integrated collection of concepts for describing data (data requirements). Relational model was introduced.
Lection №4 Development of the Relational Databases.
1 DATABASE TECHNOLOGIES (Part 2) BUS Abdou Illia, Fall 2015 (September 9, 2015)
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Chapter 10 Designing Databases. Objectives:  Define key database design terms.  Explain the role of database design in the IS development process. 
Understand Relational Database Management Systems Software Development Fundamentals LESSON 6.1.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 7 Storing Organizational Information - Databases.
Chapter 3 The Relational Database Model. Database Systems, 10th Edition 2 * Relational model * View data logically rather than physically * Table * Structural.
Microsoft Access 2010 Chapter 11 Database Design.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 10 Structuring.
McGraw-Hill/Irwin Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Modeling the Data: Conceptual and Logical Data Modeling.
Week 2 Lecture The Relational Database Model Samuel ConnSamuel Conn, Faculty Suggestions for using the Lecture Slides.
DATA SCIENCE MIS0855 | Spring 2016 Designing Data
Rationale Databases are an integral part of an organization. Aspiring Database Developers should be able to efficiently design and implement databases.
Microsoft Office Access 2010 Lab 1
© 2014 by McGraw-Hill Education. This is proprietary material solely for authorized instructor use. Not authorized for sale or distribution in any manner.
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
DESIGNING DATABASE APPLICATIONS
CIS 207 The Relational Database Model
Database Design Chapter 7.
Presentation transcript:

BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 4-2 LEARNING OUTCOMES 1.Describe the purpose of the relational database model in a database management system 2.List the relational database model’s basic components 3.Describe why entities and attributes are organized into tables 4.Describe how data redundancy is handled in the relational database model

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Explain the need for an entity-relationship Diagram in a database management system 6.Describe the Chen model symbols used in entity- relationship modeling 7.Explain the purpose of normalization 8.List the three normal forms typically used in normalization LEARNING OUTCOMES

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 4-4 Introduction The core chapters introduced: – Database - maintains information about various types of objects (inventory), events (transactions), people (employees), and places (warehouses) – Database management system (DBMS) - software through which users and application programs interact with a database – Relational database model - a type of database that stores its information in the form of logically-related two-dimensional tables This plug-in will build on the core chapters by providing specific details on how to design relational databases

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 4-5 Entities and Data Relationships Data model - a formal way to express data relationships to a database management system (DBMS) The underlying relationships in a database environment are: – Independent of the data model – Independent of the DBMS that is being used Before designing a database for any data model, data relationships need to be defined Entity-relationship diagram (ERD) - a technique for documenting the relationships between entities in a database environment

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 4-6 ENTITIES AND THEIR ATTRIBUTES Entity - a person, place, thing, transaction, or event about which information is stored – A customer is an entity, as is a merchandise item Attributes, also called fields or columns, are characteristics or properties of an entity class – Example: A CUSTOMER entity can be described by a Customer Number, First Name, Last Name, Street, City, State, Zip Code, Phone Number, Credit Card No, and Credit Card Exp

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 4-7 ENTITIES AND THEIR ATTRIBUTES

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 4-8 Entity Identifiers Entity identifier - ensures that each entity instance has a unique attribute value that distinguishes it from every other entity instance – An entity identifier is also referred to as a primary key – An entity identifier ensures that each entity has a unique attribute value that distinguishes it from every other entity Constraint - a rule to which some elements in a database must adhere – When an instance of an entity in a database is stored, the DBMS needs to ensure that the new instance has a unique identifier

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 4-9 Entity Identifiers

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved SINGLE-VALUED VERSUS MULTI- VALUED ATTRIBUTES Single-valued - means having only a single value of each attribute of an entity at any given time Example: – A CUSTOMER entity allows only one Telephone Number for each CUSTOMER – If a CUSTOMER has more than one Phone Number and wants them all included in the database the CUSTOMER entity cannot handle them

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Multi-valued - means having the potential to contain more than one value for an attribute at any given time An entity in a relational database cannot have multi-valued attributes, those attributes must be handled by creating another entity to hold them Relational databases do not allow multi-valued attributes because they can cause problems: – Confuses the meaning of data in the database – Significantly slow down searching – Place unnecessary restrictions on the amount of data that can be stored SINGLE-VALUED VERSUS MULTI- VALUED ATTRIBUTES

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved SINGLE-VALUED VERSUS MULTI- VALUED ATTRIBUTES

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Documenting Logical Data Relationships The two most commonly used styles of ERD notation are: 1.Chen 2.Information Engineering The Chen model uses rectangles to represent entities – Each entity's name appears in the rectangle and is expressed in the singular, as in CUSTOMER – Attributes are expressed in ovals

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Documenting Logical Data Relationships

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved BASIC DATA RELATIONSHIPS The relationships that are stored in a database are between instances of entities

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Once the basic entities and attributes have been defined, the next task is to identify the relationships among entities There are three basic types of relationships: 1.One-to-one 2.One-to-many 3.Many-to-many BASIC DATA RELATIONSHIPS

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved One-to-One Relationship One-to-one relationship (1:1) - between two entities in which an instance of entity A can be related to only one instance of entity B and entity B can be related to only one instance of entity A

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved One-to-Many Relationship One-to-many relationship (1:M) - between two entities, in which an instance of entity A, can be related to zero, one, or more instances of entity B and entity B can be related to only one instance of entity A

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Many-to-Many Relationship Many-to-many relationship (M:N) - between two entities in which an instance of entity A can be related to zero, one, or more instances of entity B and entity B can be related to zero, one, or more instances of entity A

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved RELATIONSHIP CONNECTIVITY AND CARDINALITY Cardinality - expresses the specific number of entity occurrences associated with one occurrence of the related entity In the Chen model, the cardinality is indicated by placing numbers beside the entities in the format of (x, y) – The first number is the minimum value and the second number is the maximum value

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Documenting Relationships – The Chen Method The Chen method uses diamonds for relationships and lines with arrows to show the type of relationship between entities

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved There is no obvious way to indicate weak entities and mandatory relationships – An ORDER should not exist in the database without a CUSTOMER – ORDER is a weak entity and its relationship with a CUSTOMER is mandatory – Some database designers have added a new symbol to the Chen method for a weak entity, a double-bordered rectangle Documenting Relationships – The Chen Method

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved DEALING WITH MANY-TO-MANY RELATIONSHIPS There are problems with many-to-many relationships 1.The relational data model cannot handle many-to- many relationships directly – It is limited to one-to-one and one-to-many relationships – Many-to-many relationships need to be replaced with a collection of one-to-many relationships 2.Relationships cannot have attributes – An entity must represent the relationship

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Composite Entities Composite entities - entities that exist to represent the relationship between two other entities Example: – There is a many-to-many relationship between an ITEM and an ORDER An ORDER can contain many ITEM (s) and over time, the same ITEM can appear on many ORDER (s)

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Composite Entities

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Composite Entities

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved SCHEMAS Schema - a completed entity-relationship diagram representing the overall, logical plan of a database – The way in which the people responsible for maintaining the database will see the design Physical schema -the underlying physical storage, which is managed by the DBMS

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved The Relational Data Model Once the ERD is completed, it can be translated from a conceptual logical schema into the formal data model required by the DBMS Most database installations are based on the relational data model The relational data model is the result of the work of one person, Edgar (E. F.) Codd

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved UNDERSTANDING RELATIONS The word “table” is used synonymously with “entity” The definition specifies what will be contained in each column of the table, but does not include data When rows of data are included, an instance of a relation is created

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Columns and Column Characteristics Two or more tables within the same relational schema may have columns with the same names When the same column name appears in more than one table and tables that contain that column are used in the same data manipulation operation – The name of the column must be qualified by preceding it with the name of the table and a period Example: – CUSTOMER.Customer Number, First Name, Last Name, Phone Number

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Rows and Row Characteristics A row in a relation has the following properties: – Only one value at the intersection of a column and row - a relation does not allow multi-valued attributes – Uniqueness - there are no duplicate rows in a relation – Primary key - a field (or group of fields) that uniquely identifies a given entity in a table

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Primary Key A unique primary key makes it possible to uniquely identify every row in a table The primary key is important to define to be able to retrieve every single piece of data put into a database There are only three pieces of information to retrieve for any specific bit of data: 1.The name of the table 2.The name of the column 3.The primary key of the row

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved The proper notation to use when documenting the name of the table, the column name, and primary key: – CUSTOMER(Customer Number, First Name, Last Name, Phone Number) Two qualities of all primary keys: 1.A primary key should contain some value that is highly unlikely ever to be null 2.A primary key should never change Primary Key

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved REPRESENTING DATA RELATIONSHIPS The use of identifiers represent relationships between entities

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved When a table contains a column that is the same as the primary key of a table, the column is called a foreign key Foreign key - a primary key of one table that appears as an attribute in another file and acts to provide a logical relationship between the two files Example: – CUSTOMER(Customer Number, First Name, Last Name, Phone Number) – ORDER(Order Number, Customer Number, Order Date) REPRESENTING DATA RELATIONSHIPS

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Foreign Keys And Primary Keys In The Same Table Foreign keys do not necessarily need to reference a primary key in a different table – They need only reference a primary key Example: – EMPLOYEE(Employee Number, First Name, Last Name, Department, Manager Number)

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Referential Integrity The relational data model enforces a constraint called referential integrity – Referential integrity - states that every non-null foreign key value must match an existing primary key value Referential integrity ensures the consistency of the cross- references among tables Referential integrity constraints are stored in the database that are enforced automatically by the DBMS

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved The Data Dictionary Data dictionary - a file that stores definitions of information types, identifies the primary and foreign keys, and maintains the relationships among the tables The structure of a relational database is stored in the database's data dictionary, or catalog The data dictionary is made up of a set of relations, identical in properties to the relations used to hold data Information found in a data dictionary: – Definitions of the columns that make up each table – Integrity constraints placed on relations – Security information (which user has the right to perform which operation of which table)

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved The Data Dictionary 4-39

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved RELATIONSHIPS AND BUSINESS RULES The “correct” design for a specific business depends on the business rules – What is correct for one organization may not be correct for another – Not a matter of right or wrong database design, but an issue of how the business operates

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Normalization Normalization - the process of placing attributes into tables that avoid the problems associated with poor database design – Given any group of entities and attributes, there is a large number of ways to group them into relations There are at least two ways to approach normalization: 1.Work from an ERD 2.Use the theoretical concepts behind good design to create relations

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved NORMAL FORMS Normal forms - the theoretical rules that the design of a relation must meet – Each normal form represents an increasingly stringent set of rules – The higher the normal form, the better the design of the relation

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved NORMAL FORMS Nested normal forms

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved First Normal Form (1NF) First normal form (1NF) - where each field in a table contains different information A table is in first normal form (1NF) if the data are stored in a two-dimensional table with no repeating groups Example: – ORDER(Customer Number, First Name, Last Name, Street, City, State, Zip, Phone, Order Date, Item Number, Title, Price, Has Shipped)

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Given that the primary key is made up of the Order Number and the Item Number, two things that cannot be done : 1.Data about a customer cannot be added until the customer places at least one order 2.Data about a merchandise item cannot be added without that item being ordered – There must be an Order Number to complete the primary key First Normal Form (1NF)

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved Third Normal Form (3NF) Third normal form (3NF) - when the relation is in second normal form and there are no transitive dependencies The relation needs to broken down into two smaller relations: – ITEM(Item Number, Distributor Number) – DISTRUBUTOR(Distributor Number, Warehouse Phone Number)

McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved NORMALIZED RELATIONS AND DATABASE PERFORMANCE Normalizing the relations in a database separates entities into their own relations – Makes it possible to enter, modify, and delete data without disturbing entities other than the one directly being modified Join - an operation that combines two relations by matching rows based on values in columns in the two tables – The matching relationship is primary key to foreign key