Relational Databases. Objectives of the Lecture : This weeks lecture will look at how database tables/relations work. Last week we identified how we could.

Slides:



Advertisements
Similar presentations
Build a database I: Design tables for a new Access database
Advertisements

Organisation Of Data (1) Database Theory
Microsoft ® Access ® 2010 Training Design the tables for a new database.
Normalisation Ensuring data integrity in database design 1.
Databases and Processing Modes. Fundamental Data Storage Concepts and Definitions What is an entity? An entity is something about which information is.
Database Design Concepts Info 1408 Lecture 2 An Introduction to Data Storage.
Database Design Concepts INFO1408 Term 2 week 1 Data validation and Referential integrity.
Inventory and Warehouse Management Process
Databases and Database Management Systems
Week 2 Lecture 2 Structure of a database. External Schema Conceptual Schema Internal Schema Physical Schema.
Database Design Concepts Info1408
Database Design Concepts Info 1408 Lecture 2 An Introduction to Data Storage.
Business Functional Areas 1. Pre-Sales (special thanks to Geoff Leese)
Objectives of the Lecture : This weeks lecture will look at how database tables/relations work. Last week we identified how we could identify the possible.
APPENDIX C DESIGNING DATABASES
Software Development Unit 2 Databases What is a database? A collection of data organised in a manner that allows access, retrieval and use of that data.
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
Relational databases.  Retrieving data from a database requires pulling data from multiple tables  Tables relate to each other in distinct ways, modelled.
Module 3: Table Selection
Objectives of the Lecture : This weeks lecture will look at how database tables/relations work. Last week we identified how we could identify the possible.
CREATE THE DIFFERENCE Normalisation (special thanks to Janet Francis for this presentation)
Introduction to Sequence Diagrams
BUS1MIS Management Information Systems Semester 1, 2012 Access: Creating a Database Week 6 Lecture 2.
Relational databases and third normal form As always click on speaker notes under view when executing to get more information!
Contents: Sales Process Handling Issues in Sales – A/R Sales - A/R.
Relational Databases. Welcome to the module How the module is organized and assessed What YOU need to do to pass this module Database Fundamentals Summary.
Lecture 1 - Introduction Databases & module Emma-Jane Phillips Pandon 122.
Lecture 7 Integrity & Veracity UFCE8K-15-M: Data Management.
Microsoft ® Office Access ® 2007 Training Build a database I: Design tables for a new Access database ICT Staff Development presents:
Bottom Up Analysis Bottom-up Data Analysis An Example.
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.
CORE 2: Information systems and Databases NORMALISING DATABASES.
Copyrighted material John Tullis 10/17/2015 page 1 04/15/00 XML Part 3 John Tullis DePaul Instructor
Lecturer: Gareth Jones. How does a relational database organise data? What are the principles of a database management system? What are the principal.
1.NET Web Forms Business Forms © 2002 by Jerry Post.
ATADESAB. BATLE CORDER DLEIF Lesson objectives In this lesson you will learn some basic database terms and learn how a database is created.
Databases. What is a database?  A database is used to store data. The word DATA is actually Latin for FACTS. A database is, therefore, a place, or thing.
Entity-Relationship (ER) Modelling ER modelling - Identify entities - Identify relationships - Construct ER diagram - Collect attributes for entities &
Slide Chapter 5 The Relational Data Model and Relational Database Constraints.
IS 325 Notes for Wednesday August 28, Data is the Core of the Enterprise.
6.1 © 2010 by Prentice Hall 6 Chapter Foundations of Business Intelligence: Databases and Information Management.
INFO1408 Database Design Concepts Week 16: Introduction to Database Management Systems Continued.
CISB113 Fundamentals of Information Systems Data Management.
Database Design Normalisation. Last Session Looked at: –What databases were –Where they are used –How they are used.
Database Management Systems (DBMS)
CE Operating Systems Lecture 17 File systems – interface and implementation.
Database Objective Demonstrate basic database concepts and functions.
 Shopping Basket  Stages to maintain shopping basket in framework  Viewing Shopping Basket.
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.
Instructor: Pavlos Pavlikas1 How Data is Stored Chapter 8.
Excel part 5 Working with Excel Tables, PivotTables, and PivotCharts.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Sample Table Standard Notation Entity name in uppercase
CSCI 6962: Server-side Design and Programming Shopping Carts and Databases.
Databases Flat Files & Relational Databases. Learning Objectives Describe flat files and databases. Explain the advantages that using a relational database.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. A database is a collection of information organized to provide efficient retrieval. The collected information.
Microsoft Access CS 110 Fall Entity Relationship Model Entities Entities Principal data object about which information is to be collectedPrincipal.
Invoices and Service Invoices Training Presentation for Raytheon Supply Chain Platform (RSCP) April 2016.
1 Entity Relationship Approach u Top-down approach to data modeling u Uses diagrams u Normalization - confirms technical soundness u Entity Relationship.
Normalisation FORM RULES 1NF 2NF 3NF. What is normalisation of data? The process of Normalisation organises your database to: Reduce or minimise redundant.
N5 Databases Notes Information Systems Design & Development: Structures and links.
Compatible with the latest browsers; Chrome, Safari, Firefox, Opera and Internet Explorer 9 and above.
Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Database Normalization
GCSE Computing Databases.
INTRODUCING DATABASES
Database Fundamentals
Databases This topic looks at the basic concept of a database, the key features and benefits of a Database Management System (DBMS) and the basic theory.
Database Design Using Access
Presentation transcript:

Relational Databases

Objectives of the Lecture : This weeks lecture will look at how database tables/relations work. Last week we identified how we could identify the possible tables and contents and this week we are taking this in more detail, looking at how a table/relation works (set theory) and then looking at how this set approach relates to the way data is clustered.

The relational model that underpins the relational database is based on mathematical sets. We looked at tables already containing collections of related data (patient details, student records, programmes etc) Definition : “A set is a collection of things”.  A set has two main characteristics :  It has no sequence or structure.  It has no duplicates. Example :{ 2, 7, 5, 4 }  { 7, 5, 4, 2 } They are the same set because sets have no order. Example : { 2, 2, 7, 5, 4, 8, 8 } is not a set because it has duplicates. A database table/relation should hold data in an order where the value of the data is NOT dependent on the order it is retrieved in.

First NameSurnameLocationJobMarital Status SamVinesAnkh-MorporkWatch Commander Married WilliamDe WordeAnkh-MorporkNewspaper Editor Single JasonOggLancreBlacksmithMarried EsmeraldaWeatherwaxLancreWitchSingle ThomasSilverfishAnkh-MorporkAlchemistSingle First NameSurnameLocationJobMarital Status SamVinesAnkh-MorporkWatch Commander Married EsmeraldaWeatherwaxLancreWitchSingle ThomasSilverfishAnkh-MorporkAlchemistSingle WilliamDe WordeAnkh-MorporkNewspaper Editor Single JasonOggLancreBlacksmithMarried First NameSurnameLocationJobMarital Status SamVinesAnkh-MorporkWatch Commander Married EsmeraldaWeatherwaxAnkh-MorporkWitchSingle ThomasSilverfishAnkh-MorporkAlchemistSingle WilliamDe WordeLancreNewspaper Editor Single JasonOggAnkh-MorporkBlacksmithMarried Table A and B are the same because even though the data is in a different order it is still the same data in each table. Table C is different because the data in the location column is different, this changes the data on a row by row comparison. ABCABC

The data in the relation/table should NOT hold any duplicate, duplicated data can lead to errors in any calculation. There are ways to ensure that each row of data is unique by having one or more columns/attributes in the table that is unique to each row (an extra column/attribute can be added if required) student record number NHS number NI number etc. Alternative is to have an attribute/column that indicate multiple records for example a ‘quantity’ attribute

ProductBrandSizePrice RippleGalaxySingle unit£0.79 MalteesersNestle300g£1.55 MalteesersNestle100g£.066 RippleGalaxySingle unit£0.79 RippleGalaxySingle unit£0.79 Sour mixHarribo200g£1.00 The above data has duplicated records, we need to remove duplicates but we can’t just delete the records because we need to consider the nature of the data, if the data relates to the products a shop sells then we may be able to simply remove the duplicates because retaining a single record will still reflect that the store sells ripple bars but if the tables relates to stock then to remove the duplicates will change the data and make it invalid, the store will need to know they have 3 ripples in stock.

ProductBrandSizePriceQuantity in stock RippleGalaxySingle unit£0.793 MalteesersNestle300g£1.551 MalteesersNestle100g£.0661 Sour mixHarribo200g£1.001 The way we handle the duplicated data depends on the nature of the data and how we are using it. A database developer must understand the data they are working with and its use. ProductBrandSizePrice RippleGalaxySingle unit£0.79 MalteesersNestle300g£1.55 MalteesersNestle100g£.066 Sour mixHarribo200g£1.00

 This section will be covered in more detail throughout the course as your understanding develops more complexity to this procedure (known as normalisation). At a basic level, converting the data gathered in analysis 1. Data elements are collected and ‘grouped’ Look at related data, cluster things 2. Identify the data types that are needed and consider what size they should be Varchar, numbers, dates, 50 characters etc 3. Do you need extra data to give meaning? Analysis should indicate if the data currently held is sufficient or if more are needed 4. Does the data need to be given more granularity? Name = Surname, forename, middle initial etc

A company currently takes orders over the phone or by sales staff, the orders are noted on paper order forms and these are used to raise picking notes, invoices etc. The company wants to put these orders into a database so that they can use the data to analyse sales and do some sales forecast and target marketing (send relevant promotions to interested customers rather than a blanket mail shot). The paper system records the following information: Order number order line invoice address delivery address customer name customer id cost of order delivery cost Vat discount code additional notes picking note id pallet number warehouse id checked by, product details product id unit cost Quantity line cost (these are repeated values for each item on order)

Order number order line invoice address delivery address customer name customer id cost of order delivery cost Vat discount code additional notes picking note id pallet number warehouse id checked by product details product id unit cost Quantity line cost (these are repeated values for each item on order) Order customer name customer id delivery address product details product id unit cost Quantity line cost VAT discount code total cost invoice address Invoice customer name customer id product details product id unit cost Quantity line cost VAT discount code total cost invoice address The new elements come from different documents (invoice & order form for simplification) the source documents can be used to indicate possible relations/tables Note: that some data is duplicated cumbersome (do we need the customer name and number?)

Order customer name, customer id, delivery address, product details, product id, unit cost, quantity, line cost, VAT, discount code, total cost, invoice address Invoice customer name, customer id, product details, product id, unit cost, quantity, line cost, VAT, discount code, total cost, invoice address 1.Consider the data, instead of duplicating the data. We could include a reference to where the data is, if the invoice data has the order data on it then why not simply hold something that links to the order row? 2.The order data has 2 elements, there is the information that relates to the order in general and there is data that is repeated, the order data therefore breaks down into the order header info and the order line detail. 3.The above changes mean that we have all the data held but the structure of the data is changed from the paper systems to a more RELATIONAL format.

1. To relate the data we need to add a reference element 2. Breaking the data down gives a greater granularity 3. Consider renaming elements so it is clear which table they belong to (the reason for this is apparent in later elements)  The outcome of the relations/table could result in: These are not definitive tables but you should see how they evolve. Each of these relations/tables SHOULD have a unique element that prevents duplication of data (PRIMARY KEY) if a relation references another relation there needs to be a referencing element within the relation (FORIGN KEY (f)) OrderHeader ord_id ord_date ord_custid ord_value ord_vat ord_deladdr Orderline OL_ordrid (f) OL_ordline_no OL_prod OL_quant OL_unitprice Invoice In_vid inv_date inv_orderid (f) inv_custid (f) inv_comments Customer ????

Order Orderline Invoice An order has 1 or more order lines (you may order many different product) Each order will have one or more invoices associate with them (think about when you order something from Amazon, dispatched in a number of parcels) If you have added a customer relation then a customer can place many orders but each order is only associated with one customer customer

1. Regardless of the data that is currently in use within an organisation’s paper system, data held in a database should not be duplicated. 2. Data should be re-organised so that duplications are removed, links between relations are identified so that the chain of data is clear and accessible. 3. Additional elements that are not in the paper system will need to be added to make a computer based system 4. The translation from paper systems to computer/database systems require extensive understanding of the way the data is to be used 5. Each record in a relation should have a unique identifier 6. Related relations must have a common attribute that is the same datatype and size but not necessarily name.

1. Students should read through the notes on BB and these slides 2. Write up the notes you have made so that you can understand them when you come to review and revise them 3. Ensure that you can follow the example gone through today and ask yourself the following questions: Do you understand why the information that is held on the paper system CANNOT simply be transferred onto a database system Why does each record have to be unique and how do you ensure it is unique? Why do we break the data into smaller subsets (orderheader and orderline tables/relations) Why do we ‘add’ extra attributes