Database Planning Database Design Normalization.

Slides:



Advertisements
Similar presentations
Relational Terminology. Normalization A method where data items are grouped together to better accommodate business changes Provides a method for representing.
Advertisements

BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
1 Class Agenda (04/03 and 04/08)  Review and discuss HW #8 answers  Present normalization process Enhance conceptual knowledge of database design. Improve.
THE RELATIONAL DATABASE MODEL & THE DATABASE DEVELOPMENT PROCESS Fact of the Week: According to a Gartner study in ‘06, Microsoft SQL server had the highest.
Systems Development Life Cycle
Client/Server Databases and the Oracle 10g Relational Database
Chapter Physical Database Design Methodology Software & Hardware Mapping Logical Design to DBMS Physical Implementation Security Implementation Monitoring.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Chapter 17 Designing Databases
Data Management Design
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 Transparencies © Pearson Education Limited 1995, 2005.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Chapter 14 & 15 Conceptual & Logical Database Design Methodology
Logical Database Design Nazife Dimililer. II - Logical Database Design Two stages –Building and validating local logical model –Building and validating.
Page 1 ISMT E-120 Introduction to Microsoft Access & Relational Databases The Influence of Software and Hardware Technologies on Business Productivity.
Introduction to Databases
IST Databases and DBMSs Todd S. Bacastow January 2005.
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
1 DATABASE TECHNOLOGIES BUS Abdou Illia, Fall 2007 (Week 3, Tuesday 9/4/2007)
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Chapter 1 Overview of Database Concepts Oracle 10g: SQL
1 Class Agenda (11/07 and 11/12)  Review HW #8 answers  Present normalization process Enhance conceptual knowledge of database design. Improve practical.
1 Chapter 1 Overview of Database Concepts. 2 Chapter Objectives Identify the purpose of a database management system (DBMS) Distinguish a field from a.
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:
MIS 301 Information Systems in Organizations Dave Salisbury ( )
Lecture 2 An Overview of Relational Database IST 318 – DB Admin.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Database Normalization Lynne Weldon July 17, 2000.
Normalization Transparencies
I Information Systems Technology Ross Malaga 4 "Part I Understanding Information Systems Technology" Copyright © 2005 Prentice Hall, Inc. 4-1 DATABASE.
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T5 DESIGNING DATABASE APPLICATIONS.
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
Fanny Widadie, S.P, M.Agr 1 Database Management Systems.
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
1 CSE 2337 Introduction to Data Management Access Book – Ch 1.
Lecture 5 Normalization. Objectives The purpose of normalization. How normalization can be used when designing a relational database. The potential problems.
Chapter 10 Normalization Pearson Education © 2009.
File and Database Design Class 22. File and database design: 1. Choosing the storage format for each attribute from the logical data model. 2. Grouping.
GIS Data Models GEOG 370 Christine Erlien, Instructor.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.
Lesson 2: Designing a Database and Creating Tables.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.
IS 320 Notes for April 15, Learning Objectives Understand database concepts. Use normalization to efficiently store data in a database. Use.
1 DATABASE TECHNOLOGIES (Part 2) BUS Abdou Illia, Fall 2015 (September 9, 2015)
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.
Logical Database Design and the Relational Model.
1 CS 430 Database Theory Winter 2005 Lecture 7: Designing a Database Logical Level.
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.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
SQL Basics Review Reviewing what we’ve learned so far…….
Converting ER/EER to logical schema; physical design issues 1.
Relational Model.
Basic Concepts in Data Management
Relational Database Model
Presentation transcript:

Database Planning Database Design Normalization

Analyze user environment Develop conceptual data model Choose a DBMS Develop logical model, by mapping conceptual model to DBMS Develop physical model Implement physical model

1. Real world Enterprise in its environment Mini-world, or Universe of Discourse – part of the world that is represented in the database 2. Conceptual Model Entities, entity sets, attributes, relationships Often represented as ER, EER or UML diagram 3. Logical model of database-intension Metadata, data about data Record types, data item types, data aggregates Schema - stored in data dictionary, catalog 4. Data occurrences-extension Database itself Data instances files

Step 1:Identify the data elements Step 2:Subdivide each element into its smallest useful components Step 3:Identify the tables and assign columns Step 4:Identify the primary and foreign keys Step 5:Review whether the data structure is normalized Step 6:Identify the indexes

You can identify data elements in a variety of ways, including interviewing users, analyzing existing systems, and evaluating comparable systems.

Murach’s SQL Server 2008, C9© 2008, Mike Murach & Associates, Inc. Slide 8

If a data element contains two or more components, you should consider subdividing the element into those components. That way, you won’t need to parse the element each time you use it. The extent to which you subdivide a data element depends on how it will be used. Because it’s difficult to predict all future uses for the data, most designers subdivide data elements as much as possible. When you subdivide a data element, you can easily rebuild it when necessary by concatenating the individual components.

You should group the data elements that you’ve identified by the entities with which they’re associated. These entities will later become the tables of the database, and the elements will become the columns.

Each table should have a primary key that uniquely identifies each row. The values of the primary keys should seldom, if ever, change. They should also be short and easy to enter correctly. If possible, you should use an existing column for the primary key. But if a suitable column doesn’t exist, you can create an identity column that can be used as the primary key. If two tables have a one-to-many relationship… You may need to add a foreign key column to the table on the “many” side. The foreign key column must have the same data type as the primary key column it’s related to.

If two tables have a many-to-many relationship… You’ll need to define a linking table to relate them. Each of the tables in the many-to-many relationship will have a one-to-many relationship with the linking table. The linking table doesn’t usually have a primary key. If two tables have a one-to-one relationship… They should be related by their primary keys. This type of relationship is typically used to improve performance. Then, columns with large amounts of data can be stored in a separate table.

Two tables with a many-to-many relationship Two tables with a one-to-one relationship

Referential integrity means that the relationships between tables are maintained correctly. That means that all of the foreign keys in a foreign key table must have matching primary key values in the related table. use foreign key constraints to enforce referential integrity If referential integrity isn’t enforced and a row is deleted from the primary key table that has related rows in the foreign key table, the rows in the foreign key table are said to be orphaned.

Normalization is a formal process you can use to separate the data in a data structure into related tables. Normalization reduces data redundancy, which can cause storage and maintenance problems. In an unnormalized data structure, a table can contain information about two or more entities. It can also contain repeating columns, columns with repeating values, and data that’s repeated in two or more rows. In a normalized data structure, each table contains information about a single entity, and each piece of information is stored in exactly one place. To normalize a data structure, you apply the normal forms in sequence. There are seven normal forms, but a data structure is typically considered normalized if the first three are applied.

A table that contains repeating columns A table that contains redundant data

“is the process of reducing redundant information in a database” removing repeating data – makes the DB more efficient, easier to update if we store the same data in multiple places, we run a risk of data inconsistencies

Normal formDescription First (1NF)The value stored at the intersection of each row and column must be a scalar value, and a table must not contain any repeating columns. Second (2NF)Every non-key column must depend on the entire primary key. Third (3NF)Every non-key column must depend only on the primary key. Notes Each normal form assumes that the design is already in the previous normal form. A database is typically considered to be normalized if it is in third normal form.

data retrieval as well as modification is more efficient data redundancy is minimized, which simplifies maintenance and reduces storage

we want to create a database to store information about this course and enrolled students

course number course name course instructor – name course instructor – course instructor – phone number course location student – name student – student – phone number student status (taking course OR auditing course) student grading method (pass/fail OR grade OR n/a)

there are 3 normal forms: 1 st normal form 2 nd normal form 3 rd normal form each next normal form depends on the previous one being done

divide data into logical units – tables each table is assigned a primary key primary key – one or more columns that uniquely identify a specific row in the table ensure that there are no repeated groups For a table to be in first normal form, its columns must not contain multiple, repeating values. Instead, each column must contain a single, scalar value. In addition, the table must not contain repeating columns that represent a set of values. A table in first normal form often has repeating values in its rows. This can be resolved by applying the second normal form.

For a table to be in second normal form, every non-key column must depend on the entire primary key. To apply second normal form, you move columns that don’t depend on the entire primary key to another table and then establish a relationship between the two tables. Second normal form helps remove redundant row data, which can save storage space, make maintenance easier, and reduce the chance of storing inconsistent data. Use foreign keys to manage relationships / dependencies between tables

For a table to be in third normal form, every non-key column must depend only on the primary key. If a column doesn’t depend only on the primary key, it implies that the column is assigned to the wrong table or that it can be computed from other columns in the table. A column that can be computed from other columns contains derived data.

Data structures that are normalized to the fourth normal form and beyond typically require more joins than tables normalized to the third normal form and can therefore be less efficient. SQL statements that work with tables that are normalized to the fourth normal form and beyond are typically more difficult to code and debug. Most designers denormalize data structures to some extent, usually to the third normal form. Denormalization can result in larger tables, redundant data, and reduced performance. Only denormalize when necessary. It’s better to adhere to the normal forms unless it is clear that performance will be improved by denormalizing.

depends on the situation/company/team usually 3 rd or close to it ( )

select your names to be meaningful and communicate properly the intent of the table/column use camel casing for table/column names start with a capital letter; each word in the name will start with a capital letter as well example: StudentId, FirstName, PhoneNumber… do not use abbreviations, use whole words spell things correctly do not use underscores _, spaces or other special chars feel free to use numbers, if it makes sense