Notes. Information Systems. Higher Still. Higher. www.hsn.uk.net. HSN31010 Database Systems First Normal Form. Contents



Similar documents

Normalisation to 3NF. Database Systems Lecture 11 Natasha Alechina

COMHAIRLE NÁISIÚNTA NA NATIONAL COUNCIL FOR VOCATIONAL AWARDS PILOT. Consultative Draft Module Descriptor. Relational Database

Normalisation 1. Chapter 4.1 V4.0. Napier University

Unit 3.1. Normalisation 1 - V Normalisation 1. Dr Gordon Russell, Napier University

C# Cname Ccity.. P1# Date1 Qnt1 P2# Date2 P9# Date9 1 Codd London Martin Paris Deen London

Files. Files. Files. Files. Files. File Organisation. What s it all about? What s in a file?

Developing Entity Relationship Diagrams (ERDs)

G Barnaby Electronics Ltd case Study - Comparison of Entity-Relationship and Normalisation Database Designs

SAMPLE FINAL EXAMINATION SPRING SESSION 2015

Entity/Relationship Modelling. Database Systems Lecture 4 Natasha Alechina

Database Concepts II. Top down V Bottom up database design. database design (Cont) 3/22/2010. Chapter 4

Mathematical goals. Starting points. Materials required. Time needed

DATABASE SYSTEMS. Chapter 7 Normalisation

Normalisation 6 TABLE OF CONTENTS LEARNING OUTCOMES

Chapter 3. Data Analysis and Diagramming

Introduction to normalization. Introduction to normalization

Benefits of Normalisation in a Data Base - Part 1

Creating Tables ACCESS. Normalisation Techniques

Fundamentals of Database System

Hospital Database. Hospital Clinic Appointments Date of Clinic Consultant Hospital

DATABASE INTRODUCTION

Introduction to Computing. Lectured by: Dr. Pham Tran Vu

Higher National Unit specification: general information. Relational Database Management Systems

DATABASE DESIGN: Normalization Exercises & Answers

Copyright 2013 wolfssl Inc. All rights reserved. 2

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

COSC344 Database Theory and Applications. Lecture 9 Normalisation. COSC344 Lecture 9 1

Jordan University of Science & Technology Computer Science Department CS 728: Advanced Database Systems Midterm Exam First 2009/2010

Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases

Chapter 6. Database Tables & Normalization. The Need for Normalization. Database Tables & Normalization

Databases -Normalization III. (N Spadaccini 2010 and W Liu 2012) Databases - Normalization III 1 / 31

CA IDMS. Database Design Guide. Release , 2nd Edition

Relational Data Analysis I

Normalization. Reduces the liklihood of anomolies

BCS THE CHARTERED INSTITUTE FOR IT BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT. September 2013 EXAMINERS REPORT

Databases What the Specification Says

Database Design Basics

Chapter 5: Logical Database Design and the Relational Model Part 2: Normalization. Introduction to Normalization. Normal Forms.

CSCI-GA Database Systems Lecture 7: Schema Refinement and Normalization

Oracle Database Development Standards For DNR Staff and Contractors. Table of Contents

Data Modelling and E-R Diagrams

DBMS. Normalization. Module Title?

The structure of accounting systems: how to store accounts Lincoln Stoller, Ph.D.

14 Databases. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

C HAPTER 4 INTRODUCTION. Relational Databases FILE VS. DATABASES FILE VS. DATABASES

Database Design and Normalization

Database Normalization. Mohua Sarkar, Ph.D Software Engineer California Pacific Medical Center

Database Fundamentals: 1

Graham Kemp (telephone , room 6475 EDIT) The examiner will visit the exam room at 15:00 and 17:00.

Database Design and the Reality of Normalisation

RELATIONAL DATABASE SYSTEMS (HIGHER)

Normalization of Database

Job Cost Report JOB COST REPORT

Chapter 9: Normalization

LSP 121. LSP 121 Math and Tech Literacy II. Simple Databases. Today s Topics. Database Class Schedule. Simple Databases

A Short Tutorial on Using Visio 2010 for Entity-Relationship Diagrams

UNIVERSITY OF CAMBRIDGE INTERNATIONAL EXAMINATIONS International General Certificate of Secondary Education

Database Design Overview. Conceptual Design ER Model. Entities and Entity Sets. Entity Set Representation. Keys

Normalization. CIS 3730 Designing and Managing Data. J.G. Zheng Fall 2010

Microsoft Office 2010

Ken Goldberg Database Lab Notes. There are three types of relationships: One-to-One (1:1) One-to-Many (1:N) Many-to-Many (M:N).

CS143 Notes: Normalization Theory

Database Dictionary. Provided by GeekGirls.com

CSC 742 Database Management Systems

Interpreting and Translation Policy and Procedures

INTRODUCTION TO MICROSOFT ACCESS MINIMAL MANUAL

Module 5: Normalization of database tables

The 3 Normal Forms: Copyright Fred Coulson 2007 (last revised February 1, 2009)

DATABASE DESIGN. - Developing database and information systems is performed using a development lifecycle, which consists of a series of steps.

Explain the role of the database administrator.


AREA RICERCA Ufficio Dottorati di Ricerca Nazionali ed Internazionali

Normalization in OODB Design

Overview. Physical Database Design. Modern Database Management McFadden/Hoffer Chapter 7. Database Management Systems Ramakrishnan Chapter 16

Part 6. Normalization

Normalisation. Why normalise? To improve (simplify) database design in order to. Avoid update problems Avoid redundancy Simplify update operations

SQA Higher Information Systems Unit 2: Relational Database Systems

CPS352 Database Systems: Design Project

Normalization. Normalization. First goal: to eliminate redundant data. for example, don t storing the same data in more than one table

7.1 The Information system

PREPARATION GUIDE FOR WRITTEN TESTS

Exercise 1: Relational Model

Announcements. SQL is hot! Facebook. Goal. Database Design Process. IT420: Database Management and Organization. Normalization (Chapter 3)

Normalization. Functional Dependence. Normalization. Normalization. GIS Applications. Spring 2011

Topic 5.1: Database Tables and Normalization

Analysis Design Coding Testing. Figure 3.1: Basic Waterfall Model

Appointment Scheduler

Databases Model the Real World. The Entity- Relationship Model. Conceptual Design. Steps in Database Design. ER Model Basics. ER Model Basics (Contd.

Outline. Data Modeling. Conceptual Design. ER Model Basics: Entities. ER Model Basics: Relationships. Ternary Relationships. Yanlei Diao UMass Amherst

Normalization. CIS 331: Introduction to Database Systems

Data Analysis 1. SET08104 Database Systems. Napier University

Transcription:

Higher Information Systems First Normal Form Contents Normalising to First Normal Form 1 What is Normalising? 1 Normal Forms 1 The Process 1 Worked Example 2 Why do we Normalise? 4 These notes were created specially for the website, and we require that any copies or derivative works attribute the work to us. For more details about the copyright on these notes, please see http://creativecommons.org/licenses/by-nc-sa/1.0/

Higher Information Systems Normalising to First Normal Form What is Normalising? Normalising is a process carried out on the entities of a database in order to make the database system more efficient. In particular, normalising will help with setting up a relational database (a part of the Higher coursework), so it is important to know what to do. As well as this, there is a question on normalising in the exam, worth 10 marks. Normal Forms Normalising is a very logical process, and there are several stages which we must go through. Each stage improves the efficiency of the database system. The stages are called Normal Forms, and for the purposes of the Higher course, there are three you need to be aware of: First Normal Form (1NF) To achieve 1NF, we must remove repeating groups of data. Second Normal Form (2NF) To achieve 2NF, partial dependencies on the primary key must be removed. Third Normal Form (3NF) To achieve 3NF, dependencies on non-key fields must be removed. In most cases, you will only be expected to produce a model in 1NF (although it may be necessary to go further to achieve the best solution to the coursework). In the exam, you should only be asked to work to 1NF, but there may be questions requiring some knowledge of 2NF or 3NF. The Process The process for normalising to 1NF is generally straightforward, and can be tackled in much the same way for every question. The process for producing the 1NF data model is as follows: 1. Identify all the data items 2. Identify any repeating groups 3. Identify the key(s) 4. Remove any repeating groups into separate entities 5. Identify keys, add foreign key(s) to represent the relationships Most exams will roughly require this procedure to be followed, although you may be guided through the process. Page 1

Higher Information Systems Worked Example To illustrate the application of the process for 1NF, we will work through the following example, in which a company keeping paper records of staff in its shops wishes to computerise the database. Some sample data is shown below: Shop ID Staff ID Post 7262 Edinburgh 0131 4349816 5242AB Karen Wilson Manager 7262DG Harry Jones Supervisor 9928 Glasgow 0141 5726481 9882UY Gina Ross Manager 4433QW Lesley Pugh Supervisor 6523GC Fred Kinder Sales Assistant The company has also explained that a member of staff only ever works in one shop at a time; each Staff ID is unique to a member of staff and each Shop ID is unique to a shop. 1. Identify all the data items This will also involve identifying the primary entities. In this simple example, there is only one entity, with data items as follows (reading the headings of the table): Staff ID 2. Identify any repeating groups The repeating group is the set of data items Staff ID, and Post, since these have more than one value in each instance. This can be shown on the primary entity: ( Staff ID ) 3. Identify the key(s) Because there is only one entity, there can be no foreign keys. However, we must establish the primary key of the entity. The primary key is the field(s) which are unique in every instance. Looking at the sample data, it would seem that could be the primary key there are no two staff with the same name. However, this would mean no new member of staff could have the same name as an existing member of staff. Page 2

Higher Information Systems We are in fact told that Staff ID is a unique code for each person, so it follows that it will be unique in every instance of the entity. Staff ID is the primary key: ( Staff ID ) We have now modelled the un-normalised system. The next step will begin the normalisation. 4. Remove any repeating groups into separate entities The repeating group in Staff can be removed to a new entity, which we will call Staff: Staff ( Staff ID The existing entity is renamed Shop: Shop ( Shop ID ) 5. Identify keys, add foreign key(s) to represent the relationships We know from the original data that one shop has many staff; a one-to many relationship between shop and staff. The foreign key is always placed at the many end of the relationship, so we have to add a foreign key to Staff. The data item we add comes from the primary key of Shop, Shop ID. Shop ( Shop ID ) Staff ( * Shop ID Staff ID In addition, you will usually be asked to draw an entity relationship (ER) diagram. In these diagrams, a box represents an entity and a diamond describes the relationship between them: 1 M Shop employs Staff The 1 and M show the nature of the relationship between the entities. Page 3

Higher Information Systems Why do we Normalise? It might seem that there is no real benefit in normalising entities, since we still have the same data items, only now we have more entities. While it might seem confusing, it actually makes the database much simpler to use on the computer. There are three general problems with un-normalised data models: 1. Adding Records If we want to add a new shop which has not yet appointed staff, we would have to insert a record leaving fields blank. In the un-normalised model, this would involve omitting the primary key, which we cannot do. 2. Deleting Records If all the members of staff in a particular shop decide to leave, their entries would be deleted. This would also delete the only record of the shop s location and telephone number, which we do not want to do. 3. Modifying Records If a shop changes its telephone number, we would have to change every instance containing the old number. In the un-normalised system, this would amount to the number of staff employed in that shop. When retyping so many values, it is clear mistakes could be made, and perhaps not all the instances will be corrected. This would compromise the integrity of the data. Page 4