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.

Slides:



Advertisements
Similar presentations
Organisation Of Data (1) Database Theory
Advertisements

Relational Database Systems Higher Information Systems Advanced Implementation in Filemaker Pro.
Relationships Relational Database. Identifying Entities… In the previous tutorial you learnt about identifying entities in a flat file database. Also.
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.
Microsoft Access Removing Redundancy in a Database.
Database PowerPoint Guy Wade Comm 165 Guy Wade Comm 165.
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?
Database Software Application
Dr Derek Peacock14/08/20151 Database Design 1:1 Relationships Dr Derek Peacock.
Databases. Objectives Define what a database is. Understand the difference between a flat and relational database Design and create a relational database.
2.3 Organising Data for Effective Retrieval
WJEC Applied ICT Databases – Terminology and Notation DEFINITION A database is a collection of data or information which is held together in an organised.
Driving School Database
Year 7 WBGS Understanding Databases. What is a Database? Information that is organisedInformation that is organised Allows user to search Database.
Database Normalization Lynne Weldon July 17, 2000.
Complete theory from last lesson… Put today’s date in the front of your book Read pages 46 and 47 of the textbook…
GCSE Computing#BristolMet Session Objectives# 20 MUST describe a database and discuss the legal implications of storing personal information SHOULD explain.
G045 Lecture 09 ERD Diagrams (Entity Relationship Diagrams) Mr C Johnston ICT Teacher
1 n 1 n 1 1 n n Schema for part of a business application relational database.
Databases ©
© Relational Databases. © Entities Data is stored in tables. Each table is concerned with one entity An entity is a.
Databases. Data can be: Numbers Words Images Sound Video ICT Department2.
Databases. What do you think the word ‘database’ means?
Unit 4 Normalisationand Relational Database Management Systems.
Database revision.
Computers in the Library A database application. Input and Output Devices Input Keyboard Mouse Scanner / light pen Output VDU / screen / monitor Printer.
Relational Databases. Relational database  data stored in tables  must put data into the correct tables  define relationship between tables  primary.
Quiz questions. 1 A data structure that is made up of fields and records? Table.
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.
Use of ICT in Data Management AS Applied ICT. Back to Contents Back to Contents.
Databases 101 © Dolinski What you will learn How relational databases work What are the components that make up a database How to create each component.
Do it now activity Activity: A travel agent is trying to create a database to collect information about people who are booking a flight. He is having a.
Sample Table Standard Notation Entity name in uppercase
Lesson 13 Databases Lesson Objective: Understand the main features of database software Learning Outcome: Clearly identify the uses of database software.
DATA SCIENCE MIS0855 | Spring 2016 Designing Data
Normalisation Unit 6: Databases. Just to recap  What is an Entity  What is an Attribute?
Database Presentation BIM, Mrs. Bailey. **Database Notes** Use new sheet of paper! Microsoft Access - known as a database management system or DBMS Database.
Database (Microsoft Access). Database A database is an organized collection of related data about a specific topic or purpose. Examples of databases include:
© All Rights Reserved Databases.
Year 12 > 13 Applied GCE ICT Unit 7 Using Database Software.
Data Base Design Steps 1.Define Entity Classes (Relations/Tables) and Keys. 2.Define Relationships between Entity Classes. Normalization Steps Eliminate.
28 Database Theory 28. Database Theory We have looked at the basics of how databases work: Database Tables A A Relational Databases C C Types of Data.
2b. Create an Access Database Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets 1.
Our world depends on databases
Databases Key Revision Points.
SQL Relational Database Project
Databases.
Creating a Database Microsoft Access.
Databases Chapter 16.
Relational Databases.
Databases.
Database Relationships
GCSE COMPUTER SCIENCE Topic 3 - Data 3.5 Databases.
Database Management  .
Databases A brief introduction….
Database Fundamentals
Database Design ERD and Normalisation
GCSE Computing Databases.
Normalization and Databases
Starter You’ve witnessed a crime.
Database Theory.
Databases.
Databases.
Spreadsheets, Modelling & Databases
Relational Databases.
GCSE COMPUTER SCIENCE Topic 3 - Data 3.11 Databases.
Introducing a Database
Presentation transcript:

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 3.Describe the key term relationships

Student number SurnameFirst name D.O.B.AddressPhone number IllnessesAllergiesDoctor 1042JonesEmma05/04/95123 High Street NutsDr. Brown 1043SmithLouise12/08/9545 Low Road DiabetesDr. Green 1044WhiteSimon26/06/9567 Middle Lane Wasp stings Dr. Yellow Recap of Key Terms… File – collection of related records Record – all data relating to one thing or person Field – a single item of data

Continued… What is a key field? A unique piece of data in a record also known as a primary key. What is a flat file database? A database which consists of only one table. What is a relational database? A database which consists of more than one table.

Primary Key IDTitleDirectorLead ActorCertificate 01The Shawshank RedemptionFrank DarabontTim Robbins15 02The GodfatherFrancis Ford CoppolaMarlon Brando15 03InceptionChristopher NolanLeonardo DiCaprio12A 04Pulp FictionQuentin TarantinoJohn Travolta18 05Schindler's ListSteven SpielbergLiam Neeson15 Primary Key A field in the table which allows each record to be uniquely identified. Databases only work if each record is different. Primary Keys sort this out! E.g. ID, Car Number Plate, National Insurance Number.

Suitable or Not… In your books write down whether or not each of the following would be suitable primary keys? Date of Birth – Employee Number – Student ID – Surname – Postcode – Car Number Plate – Suitable Not Suitable Suitable

Example – A Flat File Database Student Student Number Surname Forename Date of Birth Tutor Group Staff Number Staff Title Staff Initial Staff Surname Which is the primary key? If students are in the same tutor group which fields would contain data that would be repeated? See Student Flat File Database Example

Linking Tables In relational databases the same data is stored more efficiently in more than one table. These tables are linked together. This helps save time as you no longer need to type in the same data over and over again known as reducing data redundancy. Students Student Number Surname Forename Date of Birth Tutor Group Tutor Groups Tutor Group Staff Number Tutors Staff Number Staff Title Staff Initial Staff Surname Student Student Number Surname Forename Date of Birth Tutor Group Staff Number Staff Title Staff Initial Tutor Surname

Relationships To link tables together there needs to be the same field in each table, which is usually the primary key. Students Student Number Surname Forename Date of Birth Tutor Group Tutor Groups Tutor Group Staff Number Tutors Staff Number Staff Title Staff Initial Staff Surname Which are the primary keys?

Foreign Keys A foreign key is a field that is a primary key of another table. Foreign keys are used to establish relationships between tables. In the example – the field Tutor Group would be the key field or primary key in the Tutor Groups table and a foreign key in the Students table. Students Student Number Surname Forename Date of Birth Tutor Group Tutor Groups Tutor Group Staff Number Primary Key Foreign Key

Relationships To link the Students table to the Tutor Groups table we can use the Tutor Group field as it is in both tables. Similarly, the Tutor Groups table and Staff table can be linked through the Staff ID field. Students Student Number Surname Forename Date of Birth Tutor Group Tutor Groups Tutor Group Staff ID Staff Staff ID Staff Title Staff Initial Staff Surname Which are the foreign keys? Primary Keys See Student Relational Database Example

Task Create the database structure for a DVD Rental Shop. You will need to store the following information and assign appropriate primary and foreign keys. Length of FilmForename Year ReleasedFilm Title Date Rented RatingAddress Rental PriceAge SurnameDate Returned Phone NumberFilm Genre GenderPostcode Step 1 – Divide the fields up into separate categories – there will be 3 tables.

The Tables Customer Surname Forename Address Postcode Telephone Number Age Gender Film Film Title Rating Film Genre Date Released Length of Film Rental Price Rentals Date Rented Date Returned Step 2 – Add a primary key to each table. What would be appropriate primary keys? Customer CustomerID Surname Forename Address Postcode Telephone Number Age Gender Film FilmID Film Title Rating Film Genre Date Released Length of Film Rental Price Rentals RentalID Date Rented Date Returned

Linking the Tables Customer CustomerID Surname Forename Address Postcode Telephone Number Age Gender Film FilmID Film Title Rating Film Genre Date Released Length of Film Rental Price Rentals RentalID Date Rented Date Returned Step 3 – Link the tables together by assigning appropriate foreign keys.

Linking the Tables Customer CustomerID Surname Forename Address Postcode Telephone Number Age Gender Film FilmID Film Title Rating Film Genre Date Released Length of Film Rental Price Rentals RentalID Date Rented Date Returned CustomerID FilmID This now means the DVD shop can clearly identify which films have been rented by each of their customers without having to repeat the same information.

The same but different… Looking at these two structures which one is better and why? Customer CustomerID Surname Forename Address Postcode Telephone Number Age Gender Date Rented Date Returned Film Title Rating Film Genre Date Released Length of Film Rental Price Customer CustomerID Surname Forename Address Postcode Telephone Number Age Gender Film FilmID Film Title Rating Film Genre Date Released Length of Film Rental Price Rentals RentalID Date Rented Date Returned CustomerID FilmID

Exam Question