Relational Data Analysis. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis Feasibility Maintenance.

Slides:



Advertisements
Similar presentations
Relational Database and Data Modeling
Advertisements

Normalisation.
BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
RJP/RDA 1 /93 Relational Data Analysis (RDA) RDA organises all the system’s data items into a set of well NORMALISED relations. These should avoid: 1.
Relational Model (CB Chapter 4) CPSC 356 Database Ellen Walker Hiram College.
Systems Analysis and Design. SA&D Outline 9 Weeks of Lectures Supported by Tutorials Self Study Examples –Bushmouth –Lejk and Deeks.
1 Class Agenda (04/03 and 04/08)  Review and discuss HW #8 answers  Present normalization process Enhance conceptual knowledge of database design. Improve.
Modeling the Data: Conceptual and Logical Data Modeling
Data Modelling II. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis Feasibility Maintenance.
Data Modelling I. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis Feasibility Maintenance.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Entity-Relationship Model and Diagrams (continued)
The Relational Database Model:
Further Data Modelling …and the effect of time. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis –Further.
Systems Analysis and Design. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis Feasibility Maintenance.
Chapter 5 Normalization Transparencies © Pearson Education Limited 1995, 2005.
Relational Data Analysis II. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis Feasibility Maintenance.
Further Systems Analysis. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis –Further Data Modelling.
Normalization A337. A337 - Reed Smith2 Structure What is a database? ◦ Tables of information  Rows are referred to as records  Columns are referred.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Data Flow Modelling II. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis Feasibility Maintenance.
Database – Part 2a Dr. V.T. Raja Oregon State University.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Page 1 ISMT E-120 Introduction to Microsoft Access & Relational Databases The Influence of Software and Hardware Technologies on Business Productivity.
Database Systems Lecture 5 Natasha Alechina
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
Chapter 5 Database Processing.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Data at the Core of the Enterprise. Objectives  Define of database systems.  Introduce data modeling and SQL.  Discuss emerging requirements of database.
Week 6 Lecture Normalization
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 3 Objectives: Identifying and Eliminating Database.
Lecture 12 Inst: Haya Sammaneh
Modelling Techniques - Normalisation Description and exemplification of normalisation.Description and exemplification of normalisation. Creation of un-normalised.
CREATE THE DIFFERENCE Normalisation (special thanks to Janet Francis for this presentation)
1 Class Agenda (11/07 and 11/12)  Review HW #8 answers  Present normalization process Enhance conceptual knowledge of database design. Improve practical.
Concepts and Terminology Introduction to Database.
Normalization. 2 Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification of various types of update anomalies.
1 Database Design and Development: A Visual Approach © 2006 Prentice Hall Chapter 4 DATABASE DESIGN AND DEVELOPMENT: A VISUAL APPROACH Chapter 4 Normalization.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
Copyright Ó Oracle Corporation, All rights reserved. Normalization Use the student note section below for further explanation of the slide content.Use.
Normalization Transparencies
Module Coordinator Tan Szu Tak School of Information and Communication Technology, Politeknik Brunei Semester
1 CMPT 275 Phase: Design. Janice Regan, Map of design phase DESIGN HIGH LEVEL DESIGN Modularization User Interface Module Interfaces Data Persistance.
1.  An introduction to data modelling  The purpose of data modelling  Modelling data relationships 2.
1. Objectives At the end of this chapter you should be able to:  Discuss the use and features of a data model  Define the terms entity and attribute.
M1G Introduction to Database Development 4. Improving the database design.
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.
ITN Table Normalization1 ITN 170 MySQL Database Programming Lecture 3 :Database Analysis and Design (III) Normalization.
Relational Database. I. Relational Database 1. Introduction 2. Database Models 3. Relational Database 4. Entity-Relationship Models 5. RDB Design Principles.
Normalization Transparencies 1. ©Pearson Education 2009 Objectives How the technique of normalization is used in database design. How tables that contain.
Database Design Normalisation. Last Session Looked at: –What databases were –Where they are used –How they are used.
Lecture Nine: Normalization
Normalisation RELATIONAL DATABASES.  Last week we looked at elements of designing a database and the generation of an ERD  As part of the design and.
IST Database Normalization Todd Bacastow IST 210.
NormalisationNormalisation Normalization is the technique of organizing data elements into records. Normalization is the technique of organizing data elements.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
Logical Database Design and Relational Data Model Muhammad Nasir
Normalisation Unit 6: Databases. Just to recap  What is an Entity  What is an Attribute?
Year 12 > 13 Applied GCE ICT Unit 7 Using Database Software.
Relational Databases – Further Study I think we’ve covered all you need to know for GCSE about relational databases I’m not aware of any practical coursework.
Chapter 4 Relational Databases
Entity-Relationship Model and Diagrams (continued)
Entity relationship diagrams
Chapter 4.1 V3.0 Napier University Dr Gordon Russell
Accounting Information Systems 9th Edition
Database Normalization.
Review of Week 3 Relation Transforming ERD into Relations
Normalisation 1 Unit 3.1 Dr Gordon Russell, Napier University
Presentation transcript:

Relational Data Analysis

Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis Feasibility Maintenance

Relational Data Analysis Prepares Business’ data for representation using the relational model The relational model is implemented in a number of popular database systems –Access –Oracle –MySQL –DB2

The Relational Model A relation is a table of data A relational database is therefore one in which tables are used to store data –This implies that there are other ways of storing data Tables will be related to each other in some way –Because the data held in them is related –The context of the system we are developing governs which data items are related and how they are related

Relational Data Analysis Relational data analysis therefore involves –Building related tables of data –Retrieval of data from one or more related tables –Inserting, Updating and Deleting data from related tables

Relational Data Analysis Relational data analysis is quite formal –Based on set theory –Uses Relational Algebra to define operations on tables We will take a less formal approach

Definitions A relation corresponds to a table A tuple is a row in a table An attribute is a column in a table A Primary Key is the attribute by which we uniquely identify each row The number of rows in a table is called the cardinality The number of attributes in a table is called the degree

Example Relation (Table) Student IDStudent NameCourseModule CodeModule NameGrade Peter StringfellowBSc Basket WeavingW1001Flower ArrangingA Terrence HalfwitBA Surfing StudiesS2003Hazardous FishesB Big JohnBSc BusinessB3333Selling StuffE Big JohnBSc BusinessB3334Buying StuffA Student

Example Relation (Table) The table can also be described without its data as follows: –Student (Student ID, Student Name, Course, Module Code, Module Name, Grade)

Example Relation (Tuple) Student IDStudent NameCourseModule CodeModule NameGrade Peter StringfellowBSc Basket WeavingW1001Flower ArrangingA Terrence HalfwitBA Surfing StudiesS2003Hazardous FishesB Big JohnBSc BusinessB3333Selling StuffE Big JohnBSc BusinessB3334Buying StuffA Student

Example Relation (Attribute) Student IDStudent NameCourseModule CodeModule NameGrade Peter StringfellowBSc Basket WeavingW1001Flower ArrangingA Terrence HalfwitBA Surfing StudiesS2003Hazardous FishesB Big JohnBSc BusinessB3333Selling StuffE Big JohnBSc BusinessB3334Buying StuffA Student

Example Relation (Table) Our example has a cardinality of 4 and a degree of 6 The primary key will be student ID as this will uniquely identify each row –We cannot know this without having an understanding of the data If there is no existing primary key then we must invent one

Exercise NameNumberTownNo of contractsDepot Tom Manchester2 Dick Leeds1Manchester Harry Manchester3Stoke Sue Oxford1Reading Frieda Cardiff7 Imran Manchester1Stoke Yue Manchester7London

Exercise What is the cardinality of the table? What is the degree of the table? Identify the Primary Key of the table?

Exercise NameNumberTownNo of contractsDepot Tom Manchester2 Dick Leeds1Manchester Harry Manchester3Stoke Sue Oxford1Reading Frieda Cardiff7 Imran Manchester1Stoke Yue Manchester7London

Exercise What is the cardinality of the table? –How many rows? 7 What is the degree of the table? –How many attributes? 5 Identify the Primary Key of the following table? –Number –But how do we know? Why not Name?

Tables and Entities Each table is equivalent to an entity in an ERD Each attribute is equivalent to an attribute in an ERD Each tuple is an occurrence of an entity in an ERD The primary key is equivalent to the key attribute in an ERD entity

Rules No two rows in a table are identical –i.e. there are no duplicate tuples/rows Every relation has a Primary Key attribute The sequence of the rows should not be significant The sequence of the columns should not be significant Each attribute must have a unique name

Problems with Tables Problems with tables can be classified into three groups: –Insert Anomalies – Problems caused when inserting new information –Update Anomalies – Problems caused when updating existing data –Delete Anomalies – Problems caused when deleting data

Problems with Tables For the student table in the handout: –The primary key doesn’t uniquely describe each row Insert anomaly –We cannot add new courses unless we have a student ID Perhaps we chose the wrong primary key? Try using a different one to see if it helps

Problems with Tables Update Anomaly –Big John Changes his name –We now have to find all instances of Big John and change them –This could take some time –We could miss one –What if there is more than one Big John? Can we be sure we are changing the right one?

Problems with Tables Delete anomaly –Terrence Halfwit decides he no longer wishes to take Module S2003 –If we delete this from Terrence’s row we lose all information about Module S2003 as no one else is taking it at the moment

The Solution? To remove these anomalies we must re- arrange the data and create new tables The process for doing this is called Normalisation

Normalisation First Three Stages –First Normal Form (1NF) –Second Normal Form (2NF) –Third Normal Form (3NF) 1NF can be considered as Normalised –But there will still be problems –All common problems are solved by 3NF –Further Normalisation will solve rarer problems

First Normal Form All data in a table must be dependant on the key In order to do this we must remove “repeating groups” This is done by analysing the relationship between the primary key and the rest of the data

Example 1 - Students Student ID Student Name Course Course ID Module Code Module Name Grade Attributes are moved if there is more than one for each instance of the primary key

Example 1 - Students Student ID Student Name Course Course ID Module Code Module Name Grade For each Student ID How many Student names are there? 1 or Many?

Example 1 - Students Student ID Student Name Course Course ID Module Code Module Name Grade For each Student ID How many Courses are there? 1 or Many?

Example 1 - Students Student ID Student Name Course Course ID Module Code Module Name Grade For each Student ID How many Course IDs are there?

Example 1 - Students Student ID Student Name Course Course ID Module Code Module Name Grade For each Student ID How many Module Codes are there?

Example 1 - Students Student ID Student Name Course Course ID –Module Code Module Name Grade For each Student ID How many Module Codes are there?

Example 1 - Students Student ID Student Name Course Course ID –Module Code Module Name Grade For each Student ID How many Module Names are there?

Example 1 - Students Student ID Student Name Course Course ID –Module Code –Module Name Grade For each Student ID How many Module Names are there?

Example 1 - Students Student ID Student Name Course Course ID –Module Code –Module Name Grade For each Student ID How many Grades are there?

Example 1 - Students Student ID Student Name Course Course ID –Module Code –Module Name –Grade For each Student ID How many Grades are there?

Example 1 - Students Student ID Student Name Course Course ID –Module Code –Module Name –Grade Indented data is a repeating group We need to put it into a new table This table will describe the module a student is taking We will call it Student Module

Example 1 - Students Student ID Student Name Course Course ID Student ID Module Code Module Name Grade We now have two tables Student details –Primary Key = Student ID Student’s module details –PK = Student ID, Module Code –Called a compound Key

Does this help? Insert –We can now add students who have no modules Delete –We can now keep students when they leave modules –We can keep Terrence’s details even if he leaves the module Update –We now only need to change student details once –Big John’s Name could be changed easily without error

Yes… But… No… But… There are still Anomalies… Update –If Creative Accounting name is changed… Insert –Cannot add a new module unless we have a student enrolled Delete –When a student leaves we could lose module information These are dealt with by later Normal Forms

Example 2 - Library Student ID Name Faculty Book ID Title Author Return Date Put this data into First Normal Form

Example 2 - Library Student ID Name Faculty –Book ID –Title –Author –Return Date Identify Repeating group

Example 2 - Library Student ID Name Faculty Student ID Book ID Title Author Return Date Create a New table Remember to keep the original PK in that of the new table This maintains the relationship between the two tables

Example 3 Customer ID Customer Name Address Branch No Branch Manager Stock ID Title Format Put this data into First Normal Form

Example 3 Customer ID Customer Name Address Branch No Branch Manager –Stock ID –Title –Format Identify Repeating group

Example 3 – Borrowing Videos Customer ID Customer Name Address Branch No Branch Manager Customer ID Stock ID Title Format Create New table

Remember 1NF can be considered as Normalised But it doesn’t solve all of our problems Need to go through second and third Normal Forms in Tutorials and next week

Second Normal Form Only Applies to tables with compound keys Data in a table must depend on the whole key We must remove any partial dependencies

References Whiteley, D. (2004) Introduction to Information Systems, Palgrave, Lejk, M. and D. Deeks (2002) Systems Analysis Techniques, Addison Wesley 2002 Mason, D. and L. Willcocks (1994), Systems Analysis, Systems Design, Alfred Waller, 1994.

References Yeates, D. and T. Wakefield (2004) Systems Analysis and Design, FT/Prentice Hall 2004 Gane, C. and T. Sarson (1979) Structured Systems Analysis, Prentice Hall, 1979 Eva, M (1994) SSADM Version 4: A users guide, McGraw hill, 1994

References DeMarco, T. (1979) Structured Analysis and System Specification, Yourdon, 1979 Royce, W. (1970) Managing the development of large software systems, In: Proceedings of IEEE WESCON, 1970 pp1-9. Connolly, T. and C. Begg (2000) Database Solutions, Addison-Wesley, 2000