Sample Table Standard Notation Entity name in uppercase

Slides:



Advertisements
Similar presentations
Relational Database Systems Higher Information Systems Advanced Implementation in Microsoft Access.
Advertisements

Organisation Of Data (1) Database Theory
Relational Database Systems Higher Information Systems Advanced Implementation in Filemaker Pro.
WJEC Applied ICT Databases – Attributes & Entities Normalisation It is important in Database Design to make sure that the correct attributes are grouped.
GCSE Computing#BristolMet Session Objectives# 21 MUST describe methods of validating data as it is input. SHOULD explain the use of key fields to connect.
Normalisation Ensuring data integrity in database design 1.
From Class Diagrams to Databases. So far we have considered “objects” Objects have attributes Objects have operations Attributes are the things you record.
Database Design Concepts Info1408
1 NORMALISATION. 2 Introduction Overview Objectives Intro. to Subject Why we normalise 1, 2 & 3 NF Normalisation Process Example Summary.
Database Design Concepts Info 1408 Lecture 2 An Introduction to Data Storage.
Databases and Database Management Systems
Prevalent Database Models (Advantages of a database over flat files)
Relational Databases What is a relational database? What would we use one for? What do they look like? How can we describe them? How can you create one?
Databases Tom Morgan.
Copyright © 2016 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
2.3 Organising Data for Effective Retrieval
DATA MODELLING TOOLS FOR ORGANISING DATABASES. For a database to be organised and logical, it must be well-designed and set out. In such cases, the databases.
WJEC Applied ICT Databases – Terminology and Notation DEFINITION A database is a collection of data or information which is held together in an organised.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
FatMax Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5.
BUS1MIS Management Information Systems Semester 1, 2012 Access: Creating a Database Week 6 Lecture 2.
Concepts and Terminology Introduction to Database.
Relational databases and third normal form As always click on speaker notes under view when executing to get more information!
MIS 301 Information Systems in Organizations Dave Salisbury ( )
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
CSC 240 (Blum)1 Introduction to Database. CSC 240 (Blum)2 Data versus Information When people distinguish between data and information, –Data is simply.
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
Normalization A technique that organizes data attributes (or fields) such that they are grouped to form stable, flexible and adaptive entities.
Database Normalization Lynne Weldon July 17, 2000.
CORE 2: Information systems and Databases NORMALISING DATABASES.
Data Modelling. ICT5 Introduction Historical development with most organisations Small-scale origins Individual computers bought for particular applications.
Normalisation. NoKats Dog Club A club formed since Keeps records of members and their dogs on index cards. Cards are managed by the secretary and.
1 n 1 n 1 1 n n Schema for part of a business application relational database.
1 Information Retrieval and Use Data Analysis & Data Modeling, Relational Data Analysis and Logical Data Modeling Geoff Leese September 2009.
Session 8: Databases Teaching Computing to GCSE Level with Python.
© Relational Databases. © Entities Data is stored in tables. Each table is concerned with one entity An entity is a.
Chapter 17 Creating a Database.
MS Access 2007 Management Information Systems 1. Overview 2  What is MS Access?  Access Terminology  Access Window  Database Window  Create New Database.
Database Beginnings. Scenario so far In our scenario we have people registering for training sessions. –The data about the training sessions was placed.
DATABASE What exactly is a database How do databases work? What's the difference between a spreadsheet database and a "real" database?
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Unit 4 Normalisationand Relational Database Management Systems.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Database revision.
+ Information Systems and Databases 2.2 Organisation.
Relational Databases. Relational database  data stored in tables  must put data into the correct tables  define relationship between tables  primary.
Database Design Normalisation. Last Session Looked at: –What databases were –Where they are used –How they are used.
Unit 5 Advanced Databases The Purpose and features of a relational database.
Lesson 2: Designing a Database and Creating Tables.
Chapter 56 Relational Database Design Compiled by Eddie Moorcroft.
Flat Files Relational Databases
Link tables and keys Access/IPS Walsall College of Arts & Technology.
Data modeling Process. Copyright © CIST 2 Definition What is data modeling? –Identify the real world data that must be stored on the database –Design.
* Database is a group of related objects * Objects can be Tables, Forms, Queries or Reports * All data reside in Tables * A Row in a Table is a record.
Information Systems Database Systems (H).
Databases Flat Files & Relational Databases. Learning Objectives Describe flat files and databases. Explain the advantages that using a relational database.
Databases Database Normalisation. Learning Objectives Design simple relational databases to the third normal form (3NF).
Teanna Clarke 6aQ What is a Entity-Relationship Diagram?  An Entity-Relationship Diagram (ERD) is a tool that graphically shows the connections among.
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.
Normalisation Unit 6: Databases. Just to recap  What is an Entity  What is an Attribute?
Starter Draw a mind map for topic 6 Databases. Objectives Revise topic CG3.6 Databases using various activities and ensure that topics covered are understood.
Year 12 > 13 Applied GCE ICT Unit 7 Using Database Software.
Lesson Objectives By the end of this lesson you will be able to: 1.Assign appropriate primary keys/key fields 2.Identify foreign keys in different tables/files.
Entity relationship diagrams
Database Management Concepts
Database Normalisation
Flat Files & Relational Databases
Spreadsheets, Modelling & Databases
Presentation transcript:

Sample Table Standard Notation Entity name in uppercase Accession Number DeweyCode Title Author Date Published 88 121.9 Let’s Cook Chan, C 1992 123 345.440 Electricity Glendenning, V 1995 300 Riders Cooper, J 657 200.00 Greek in 3 weeks Stavros, G 1990 etc… Standard Notation BOOK(AccessionNo, DeweyCode, Title, Author,DatePublished) Entity name in uppercase Key field (unique identifier) is underlined All attributes are shown in brackets, separated by commas ANS ( Normaliziation)

Primary Keys This is a field that is used to uniquely define a particular record or line in a table. Since text fields e.g. surname can be repeated, primary keys are nearly always numeric fields. They can include: Membership number, product number, employee number, catalogue number, account number. SECONDARY KEY A secondary key is a field or attribute that is not necessarily unique but is used for example to sort or order the data. An example above might be the supplier name in the supplier table. ANS ( Normaliziation)

Foreign Keys Video Table Video Rentals Table This is a field in one table which is also the primary key of another table. Foreign keys are used to establish a relationship between the main table and other subsidiary tables. Customer Table Customer ID First Name Surname Address Telephone number E-mail Age Gender Video Table Video ID Video title Rating Film Genre Date Released Length of film Rental price Video Rentals Table Video_Rental ID Customer ID Video ID Date Rented Date Returned ANS ( Normaliziation)

Relational database A RELATIONAL database. A relational database is one which allows more than one individual table (also called a relation) to be connected together. ANS ( Normaliziation)

Linking Database Tables One-to-many Tables may be linked through the use of a common field. This field must be a key field of one of the tables and is known as foreign key in the second table. In a Library database two tables book and Borrower and makes a relationship Borrower Book borrows If there is another table of Loan which attributes as below LOAN( Association number, Borrower id, datedue Borrower Book has Loan consisting of ANS ( Normaliziation)

Linking Database ANS ( Normaliziation) Prepared by: Mazhar Javed Awan

Normalisation Normalisation is a process used to come up with the best possible design for a relational database. Tables should be organised in such a way that: No data is unnecessarily duplicated Data is consistent throughout the database Structure of each table is flexible enough to allow you to enter as many / few items as you want to The structure should enable a user to make all kinds of complex queries relating data from different tables ANS ( Normaliziation)

Sample data to be held in a database Student number Student name Date of birth Sex Course number Course name Lecturer number Lecturer name 12345 Heathcote,R 20-08-77 M EC6654,EC9011 EC4521 A Level Computing, Math A level, Physics T345267 T223459 T318743 Glover,T Todd,M Chapman 22433 Head,J 13-02-77 F EC6654 AD6611 BM7634 A Level Computing Art French T886554 T165555 Lowry,B Burke,D 128867 Hargrave,R 13-09-54 This data should be split into two tables, STUDENT and COURSE, in standard database notation: STUDENT(StudentNumber, StudentName, DateOfBirth,Sex) COURSE(CourseNumber,CourseName,LecturerNumber,LecturerName) Consider the problems of creating a relationship between these two tables. A link has to made between common fields ANS ( Normaliziation)

First normal form Definition: A table is in first normal form if it contains no repeating attributes or groups of attributes. Let’s look at a simple example of two entities STUDENT and COURSE. A student can take several courses, and each course has several students attending. The relationship can be represented by the entity-relationship diagram: STUDENT COURSE attends There is a many-to-many relationship between entities STUDENT and COURSE ANS ( Normaliziation)

Creating the relationship We need a common field, but the problem is that because this is a many-to-many relationship, whichever table we put the link field into, there needs to be more than one field. e.g. STUDENT (student number, student name, date of birth, sex, course number) is no good because the student is doing several courses, so which one would be mentioned? Similarly, COURSE (course number, course name, lecturer number, lecturer name, student number) is no good either because each course has a number of students taking it. How about allowing space for 3 courses on each student record? STUDENT (student number, student name, date of birth, sex, course1, course2, course3) Why is this not a good idea? ANS ( Normaliziation)

Creating the relationship What we have engineered is a repeating attribute – unacceptable in 1st normal form. In other words, the field course number is repeated 3 times The table is therefore NOT in first normal form. It would be represented in standard notation with a line over the repeating attribute: STUDENT (student number, student name, date of birth, sex, course number) To put the data into first normal form, the repeating attribute must be removed. ANS ( Normaliziation)

Creating the relationship In its place, the field course number becomes part of the primary key in the student table. The tables are now as follows: STUDENT (student number, student name, date of birth, sex, course number) COURSE (course number, course name, lecturer number, lecturer name) Discussion: What is a primary key? Why does course number have to be part of the primary key? ANS ( Normaliziation)

The situation so far: STUDENT COURSE student no. student name D.O.B. sex course no. 12345 Heathcote,R 20-08-77 M EC6654 22433 Head,J 13-02-77 F HM7756 AD1121 66688 Hargrave,R 13-09-54 BM3390 STUDENT course no. course name Lecturer no. lecturer name EC6654 A-Level Computing T345267 Glover,T HM7756 A-Level Music T773351 Reader,B AD1121 Pottery T876541   BM3390 HNC Business T666758 Newman,P COURSE ANS ( Normaliziation)

Second Normal Form Only applicable if table has a compound key A table is second normal form (2NF) if it is in first normal form and no column that is not part of the primary key is dependent on a portion of the primary key: This may be said as: A table in 2NF contains no partial dependencies The tables on the previous slide are not in 2NF because, for example, student name is dependent only on student number and not on course number To put the tables in 2NF we need to introduce a third table to link the two entities ANS ( Normaliziation)

The tables in 2nd Normal Form STUDENT (student number, student name, date of birth, sex) STUDENT_TAKES (student number, course number) COURSE (course number, course name, lecturer number, lecturer name) What we had with the two entities was a many-to-many relationship This situation will always need a link table to create two one-to-many relationships ANS ( Normaliziation)

Third Normal Form A table in third normal form (3NF) contains no non-key dependencies The COURSES table contains an attribute for lecturer number and also one for lecturer name. Lecturer name is dependent on lecturer number (not on course number) Therefore a new table should be created for LECTURER ANS ( Normaliziation)

Normalised Files STUDENT (student number, student name, date of birth, sex) STUDENT_TAKES (student number, course number) COURSE (course number, course name, lecturer number) LECTURER (lecturer number, lecturer name) This is the optimum way of holding this data, with no duplication. The tables in Relational Databases should be in Third Normal Form ANS ( Normaliziation)

Comparing flat-files with RDB A relational database is able to create links between tables representing different entities such as STUDENT and COURSE, through the use of foreign keys. A flat file system is not able to link tables It is only useful for very simple databases which contain information about just one entity. It is impossible to ‘normalise’ a database in a flat file system, since this involves correctly establishing links between tables Flat-file systems do not have any of the sophisticated features of a full DBMS such as the ability to set individual user-access rights, or allow several people to access the database at the same time ANS ( Normaliziation)