Normalization Referential Integrity

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

Database Normalization
Monash University Week 7 Data Modelling Relational Database Theory IMS1907 Database Systems.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Data Management Design
Database Design Concepts INFO1408 Term 2 week 1 Data validation and Referential integrity.
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.
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
Database Technical Session By: Prof. Adarsh Patel.
Concepts and Terminology Introduction to Database.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
RDBMS Concepts/ Session 3 / 1 of 22 Objectives  In this lesson, you will learn to:  Describe data redundancy  Describe the first, second, and third.
Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Database Design. The process of developing database structures from user requirements for data a structured methodology Structured Methodology - a number.
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
MS Access: Creating Relational Databases Instructor: Vicki Weidler Assistant: Joaquin Obieta.
DAY 12: DATABASE CONCEPT Tazin Afrin September 26,
Copyright © 2005 Ed Lance Fundamentals of Relational Database Design By Ed Lance.
CIS 210 Systems Analysis and Development Week 6 Part II Designing Databases,
Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
Database Design. The process of developing database structures from user requirements for data a structured methodology Structured Methodology - a number.
Oracle 11g: SQL Chapter 4 Constraints.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
In this session, you will learn to: Describe data redundancy Describe the first, second, and third normal forms Describe the Boyce-Codd Normal Form Appreciate.
Constraints Lesson 8. Skills Matrix Constraints Domain Integrity: A domain refers to a column in a table. Domain integrity includes data types, rules,
Session 1 Module 1: Introduction to Data Integrity
NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.
Understand Relational Database Management Systems Software Development Fundamentals LESSON 6.1.
1 CS 430 Database Theory Winter 2005 Lecture 7: Designing a Database Logical Level.
Logical Database Design and Relation Data Model Muhammad Nasir
1 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 10 Designing Databases.
Constraints Advanced Database Systems Dr. AlaaEddin Almabhouh.
Navigation in SQL Server Management Studio (SSMS) Getting started with SQL Server Management Studio.
MS Access. Most A2 projects use MS Access Has sufficient depth to support a significant project. Relational Databases. Fairly easy to develop a good user.
September 2000C.Watters1 Data & Database Management Systems (DBMS) ECMM6010.
SQL Basics Review Reviewing what we’ve learned so far…….
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
Getting started with Accurately Storing Data
Logical Database Design and the Rational Model
Understanding Data Storage
Database Design.
A Guide to SQL, Eighth Edition
Revised: 2 April 2004 Fred Swartz
Normalization Karolina muszyńska
RELATION.
A brief summary of database normalization
Navigation in SQL Server Management Studio (SSMS)
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
CIS 155 Table Relationship
CSCI-100 Introduction to Computing
Chapter 4 Relational Databases
Database Normalization
Lecturer: Mukhtar Mohamed Ali “Hakaale”
© 2011 Pearson Education, Inc. Publishing as Prentice Hall
Data Modelling Introduction
Database Management System
Database solutions The process of normalization Marzena Nowakowska Faculty of Management and Computer Modelling Kielce University of Technology rooms:
Relational Database Model
Primary key Introduction Introduction: A primary key, also called a primary keyword, is a key in a relational database that is unique for each record.
Database solutions Chosen aspects of the relational model Marzena Nowakowska Faculty of Management and Computer Modelling Kielce University of Technology.
Databases and Information Management
1st, 2nd, and 3rd Normal Forms
Copyright © 2018, 2015, 20 Pearson Education, Inc. All Rights Reserved Database Concepts Eighth Edition Chapter # 2 The Relational Model.
Relational Database Design
Design tools and techniques for a relational database system
Chapter 17 Designing Databases
INSTRUCTOR: MRS T.G. ZHOU
Presentation transcript:

Normalization Referential Integrity 20761B 12: Using Set Operators Module   Normalization Referential Integrity

Process is used to help eliminate redundant data 20761B Normalizin database 12: Using Set Operators Normalization the process of organizing data in a database that includes creating tables and establishing relationships between the tables Process is used to help eliminate redundant data Five normalization forms (NFs) 1NF: Eliminate Repeating Groups 2NF: Eliminate Redundant Data 3NF: Eliminate Columns Not Dependent on Key 4NF: Isolate Independent Multiple Relationships 5NF: Isolate Semantically Related Multiple Relationships )  

Eliminate repeating groups in individual tables First Normal Form (1NF) 12: Using Set Operators The first normal form means the data is in an entity format, which means the following conditions have been met: Eliminate repeating groups in individual tables Create separate table for each set of related data Identify each set of related data with primary key Do not use multiple fields in a single table to store similar data  

Second Normal Form (2NF) 20761B Second Normal Form (2NF) 12: Using Set Operators The second normal form ensures each attribute describes the entity Create separate tables for sets of values that apply to multiple records Relate these tables with a foreign key Records should not depend on anything other than a table’s primary key, including a compound key if necessary.  

The second normal form ensures each attribute describes the entity Third Normal Form (3NF) 12: Using Set Operators The second normal form ensures each attribute describes the entity Create separate tables for sets of values that apply to multiple records Relate these tables with a foreign key Records should not depend on anything other than a table’s primary key, including a compound key if necessary.

Other Normalization Forms 20761B Other Normalization Forms 12: Using Set Operators The fourth normal form is also called the Boyce Codd Normal Form (BCNF) and fifth normal form exists, but are rarely considered in practical design Disregarding these two additional normalization rules may result in a less than perfect database design but shouldn’t affect functionality  

Example of Normalization 20761B Example of Normalization 12: Using Set Operators Un-normalized table Student# Advisor Adv-Room Class1 Class2 Class3 1022 Jones 412 101-07 143-01 159-02 4123 Smith 216 201-01 211-02 214-01   First Normal Form: No Repeating Groups Student# Advisor Adv-Room Class# 1022 Jones 412 101-07 143-01 159-02 4123 Smith 216 201-01 211-02 214-01

Example of Normalization 20761B Example of Normalization 12: Using Set Operators Second Normal Form: eliminate redundant data Students: Registration: Student# Advisor Adv-Room 1022 Jones 412 4123 Smith 216   Student# Class# 1022 101-07 143-01 159-02 4123 201-01 211-02 214-01

Example of Normalization 20761B Example of Normalization 12: Using Set Operators Third Normal Form: eliminate data not dependent on the key Students: Faculty: Registration:   Student# Class# 1022 101-07 143-01 159-02 4123 201-01 211-02 214-01 Name Room Dept Jones 412 42 Smith 216 Student# Advisor 1022 Jones 4123 Smith

Referential Integrity 20761B Referential Integrity 12: Using Set Operators Referential Integrity (RI) is a database concept used to ensure that the relationships between your database tables remains synchronized during data modifications. RI can be used to ensure the data is clean, may be helpful in optimizing your database environment and can assist in early detection of errors. A combination of PRIMARY KEY and FOREIGN KEY constraints can be used to help enforce referential integrity of your database. In addition to a foreign key referencing a primary key constraint, a foreign key can also reference a UNIQUE constraint to help maintain referential integrity. Triggers can also be used to enforce referential integrity, however being triggers require code they don’t execute as quickly as table properties such as a primary key constraint.  

Referential Integrity 20761B Referential Integrity 12: Using Set Operators There are several methods available in SQL Server to help maintain database integrity: Primary key constraint Foreign key constraint Unique constraint Indexes Triggers Any of these methods can be created as a composite key which is an index or constraint created using more than one column. It may be necessary to use more than one column to create a unique value for each row in a table.  

Methods of enforcing referential integrity 20761B Methods of enforcing referential integrity 12: Using Set Operators There are several methods available in SQL Server to help maintain database integrity: Primary key constraint Foreign key constraint Unique constraint Indexes Triggers Any of these methods can be created as a composite key which is an index or constraint created using more than one column. It may be necessary to use more than one column to create a unique value for each row in a table.  

Primary key constraint 20761B Primary key constraint 12: Using Set Operators An important concept of designing a database table is the use of a PRIMARY KEY — an attribute or set of attributes used to uniquely identify each row A table can only have one primary key which is created using a primary key constraint and enforced by creating a unique index on the primary key columns A column that participates in the primary key constraint cannot accept null values  

Foreign key constraint 20761B Foreign key constraint 12: Using Set Operators A FOREIGN KEY is a column or combination of columns that are used to establish a link between data in two tables. The columns used to create the primary key in one table are also used to create the foreign key constraint and can be used to reference data in the same table or in another table A foreign key does not have to reference a primary key, it can be defined to reference a unique constraint in either the same table or in another table A column that participates in the foreign key constraint can accept null values, but if it contains a null value, the verification process is skipped.  

Relational structure with keys 20761B Relational structure with keys 12: Using Set Operators  

20761B Summary 12: Using Set Operators Normalization is the process of organizing data in a database that includes establishing relationships between the tables First normal form – no repeating groups Second normal form – eliminate redundant data Third normal form – eliminate data not dependent on the key Disregarding the fourth and fifth normalization rules may not result in a perfect database design but shouldn’t affect functionality  

Tools that can be used to help with referential integrity include Summary 12: Using Set Operators Referential Integrity is used to ensure the data contained in the database remains consistent. Tools that can be used to help with referential integrity include Primary key constraint Foreign key constraint Unique constraint Unique Indexes Triggers  

20761B Summary 12: Using Set Operators Primary key constraint— an attribute or set of attributes used to uniquely identify each row Foreign key constraint – a column or combination of columns used to establish a link between data in two tables Unique constraint - allows you to enforce uniqueness in columns other than the primary key Unique Index - ensures the index key contains no duplicate values and that every row in the table or view is unique in someway Triggers - complex T-SQL statements used to provide data integrity when table data modified  

20761B Summary 12: Using Set Operators Primary key constraint— an attribute or set of attributes used to uniquely identify each row Foreign key constraint – a column or combination of columns used to establish a link between data in two tables Unique constraint - allows you to enforce uniqueness in columns other than the primary key Unique Index - ensures the index key contains no duplicate values and that every row in the table or view is unique in someway Triggers - complex T-SQL statements used to provide data integrity when table data modified