Databases.

Slides:



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

Data Modeling. What are you keeping track of? You begin to develop a database by deciding what you are going to keep track of. Each thing that you are.
WHAT D IS RAW, UNPROCESSED FACTS AND FIGURES COLLECTED, STORED AND PROCESSED BY COMPUTERS.
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.
Data modelling uses two main techniques Entity relationship (E-R) modelling: a top- down approach Normalisation: a bottom-up approach.
Database Design Concepts INFO1408 Term 2 week 1 Data validation and Referential integrity.
Database – Part 2a Dr. V.T. Raja Oregon State University.
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 Relationships Objective 5.01 Understand database tables used in business.
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.
Database Management System Lecture 6 The Relational Database Model – Keys, Integrity Rules.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
CSE 441: Systems Analysis & Design
Driving School Database
FatMax Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 LicenseCreative Commons Attribution-NonCommercial-ShareAlike 2.5.
Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1.
ICT IGCSE.  Understand a wide range of work-related ICT applications and their effects, including applications in libraries (such as records of books.
G045 Lecture 09 ERD Diagrams (Entity Relationship Diagrams) Mr C Johnston ICT Teacher
DAY 12: DATABASE CONCEPT Tazin Afrin September 26,
1 n 1 n 1 1 n n Schema for part of a business application relational database.
Information Systems & Databases 2.2) Organisation methods.
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.
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.
Unit 4 Normalisationand Relational Database Management Systems.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. Adding a new field 1Right click the table name and select design view 2Type the field information at the end.
1 The Information School of the University of Washington Dec 1fit advdatabases © 2006 University of Washington Advanced Database Concepts INFO/CSE.
IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling.
ERD ( Conceptual data model From the statement of data requirements a conceptual data model is produced. This describes.
+ 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.
Quiz questions. 1 A data structure that is made up of fields and records? Table.
Lesson 2: Designing a Database and Creating Tables.
Information Systems Today: Managing in the Digital World TB3-1 3 Technology Briefing Database Management “Modern organizations are said to be drowning.
Sample Table Standard Notation Entity name in uppercase
Howard Paul. Sequential Access Index Files and Data File Random Access.
Information Systems Database Systems (H).
Data Modeling AND ER MODELS.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. A database is a collection of information organized to provide efficient retrieval. The collected information.
CSCI-235 Micro-Computers in Science Databases. Database Concepts Data is any unorganized text, graphics, sounds, or videos A database is a collection.
DATA SCIENCE MIS0855 | Spring 2016 Designing Data
Normalisation Unit 6: Databases. Just to recap  What is an Entity  What is an Attribute?
G057 - Lecture 05 From Scenario To Design Mr C Johnston ICT Teacher
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.
Database Design Chapters 17 and 18.
Database Relationships
Our world depends on databases
Lesson 10 Databases.
Databases Chapter 9 Asfia Rahman.
SQL Relational Database Project
Databases.
Database Relationships
CSCI-100 Introduction to Computing
Lecture # 13 (After 1st Exam)
Databases A brief introduction….
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Data Modelling Introduction
ERD’s REVIEW DBS201.
Entity relationship diagrams
Database Design ERD and Normalisation
G061 - Entity Relationship Diagrams
Database Relationships
Flat Files & Relational Databases
Advanced Database Concepts: Reports & Views
DCT 2053 DATABASE CONCEPT Chapter 2.2 CONTINUE
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.
Presentation transcript:

Databases

Learning Objectives: By the end of this topic you should be able to: describe the terms used in a relational database identify primary keys and foreign keys define relationships between entities using an entity relationship diagram for a given scenario Define

What is a database? What information would you record about a customer of a supermarket? What information would you record about a book in a library?

What is a database? a collection of data organised into a structured format.

What is a database? Surname: James First name: Samantha Date of Birth: 20.12.89 Address: 16 Poppy Close Town: Southam County: Warwickshire a collection of data organised into a structured format.

What is a database? Surname: James First name: Samantha Date of Birth: 20.12.89 Address: 16 Poppy Close Town: Southam County: Warwickshire Surname: Brown First name: David Date of Birth: 20.12.89 Address: 16 Poppy Close Town: Southam County: Warwickshire a collection of data organised into a structured format.

What is a database? Surname: James First name: Samantha Date of Birth: 20.12.89 Address: 16 Poppy Close Town: Southam County: Warwickshire Surname: Brown First name: David Date of Birth: 20.12.89 Address: 16 Poppy Close Town: Southam County: Warwickshire Surname: Lastler First name: David Date of Birth: 20.12.89 Address: 16 Poppy Close Town: Southam County: Warwickshire a collection of data organised into a structured format.

What is a database? Surname: James First name: Samantha Date of Birth: 20.12.89 Address: 16 Poppy Close Town: Southam County: Warwickshire Surname: Brown First name: David Date of Birth: 20.12.89 Address: 16 Poppy Close Town: Southam County: Warwickshire Surname: Lastler First name: David Date of Birth: 20.12.89 Address: 16 Poppy Close Town: Southam County: Warwickshire Surname: Whitefield First name: Nina Date of Birth: 21.02.76 Address: 16 Poppy Close Town: Southam County: Warwickshire a collection of data organised into a structured format.

Tables

Tables aka: an entity a collection of data about a certain ‘thing’ a collection of records in a relational database tables contain: rows (each row contains a record) columns (each column is a field) a relational database is made up of a number of tables a library database will have tables for Books, Members, …. the name of a table is usually capitalised: CUSTOMER(CustomerID, Forename, Surname,……, …..) Relationships

Records a record is a row in a database table, contains all the data about a single item or event a customer file record will store the data about a customer records are made up of a number of fields each record contains individual items of data (in fields)

Fields aka: an attribute an individual data item within a record a column in a database record, each record will be made up of a series of fields e.g. name, address etc. BOOK entity of a library will usually contain the attributes: ISBN, Title, AuthorForename, AuthorSurname, Publisher, …..

Primary Key every record in a table needs to be able to be identified primary key is the field that identifies a record uniquely e.g. account number, part number, membership number hint: often has ID, Number, No, or Code at the end of the field name often underlined e.g. MEMBER(MemberID, Forename, Surname, TelNo, ….) used to create a relationship between tables used to prevent data duplication Foreign Key

Standard Notation e.g. for a library database: MEMBER(MemberID, Forename, Surname, ….) BOOK(BookID, Title, Author ….) LOANS(LoanNo, MemberID, BookID, DateOut, …) Entities are written in capital letters Attributes are written with an initial capital Primary keys are underlined or labelled PK Foreign keys are overlined for OCR board or labelled FK

Databases A database consists of a number of t*****.

Databases A database consists of a number of tables.

Databases A database consists of a number of tables. A table consists of a number of r******.

Databases A database consists of a number of tables. A table consists of a number of records.

Databases A database consists of a number of tables. A table consists of a number of records. A record consists of a number of f*****.

Databases A database consists of a number of tables. A table consists of a number of records. A record consists of a number of fields.

Databases A database consists of a number of tables A table consists of a number of records A record consists of a number of fields The most important field is the p****** k**.

Databases A database consists of a number of tables A table consists of a number of records A record consists of a number of fields The most important field is the primary key.

Databases A database consists of a number of tables A table consists of a number of records A record consists of a number of fields The most important field is the primary key A primary key contains data u***** to a record.

Databases A database consists of a number of tables A table consists of a number of records A record consists of a number of fields The most important field is the primary key A primary key contains data unique to a record. Foreign Key

Library Database Members of a library are loaned books

Library Database Members of a library are loaned books Entities:

Library Database Members of a library are loaned books Entities:

Library Database Members of a library are loaned books Entities:

Library Database Members of a library are loaned books Entities: LOANS Relationships

Library Database Members of a library are loaned books Entities: MEMBERS(MembersID, Forename, Surname, …...) BOOKS LOANS Relationships

Library Database Members of a library are loaned books Entities: MEMBERS(MembersID, Forename, Surname, …...) BOOKS(BookID, ISBN, Title, Author, …..) LOANS Relationships

Library Database Members of a library are loaned books Entities: MEMBERS(MembersID, Forename, Surname, …...) BOOKS(BookID, ISBN, Title, Author, …..) LOANS(LoanID, Relationships

Library Database Members of a library are loaned books Entities: MEMBERS(MembersID, Forename, Surname, …...) BOOKS(BookID, ISBN, Title, Author, …..) LOANS(LoanID, MembersID, Relationships

Library Database Members of a library are loaned books Entities: MEMBERS(MembersID, Forename, Surname, …...) BOOKS(BookID, ISBN, Title, Author, …..) LOANS(LoanID, MembersID, BookID, Relationships

Library Database Members of a library are loaned books Entities: MEMBERS(MembersID, Forename, Surname, …...) BOOKS(BookID, ISBN, Title, Author, …..) LOANS(LoanID, MembersID, BookID, LoanDate, …) Relationships

Foreign Key used to link the tables in a relational database. a field in one table that is also the primary key in another often overlined (or labelled FK): MEMBERS(MembersID, Forename, Surname, …...) BOOK(BookID, ISBN, Title, Author, …..) LOANS(LoanID, MembersID, BookID, LoanDate, ….)

Entity Relationship Diagrams New slideshow: ERD ERD

Driving School Database

Driving School Database Customers

Driving School Database Customers book

Driving School Database Customers book lessons

Driving School Database Customers book lessons in a

Driving School Database Customers book lessons in a car

Driving School Database Customers book lessons in a car with an

Driving School Database Customers book lessons in a car with an instructor.

Driving School Database Customers book lessons in a car with an instructor. Entities:

Driving School Database Customers book lessons in a car with an instructor. Entities: CUSTOMERS

Driving School Database Customers book lessons in a car with an instructor. Entities: CUSTOMERS LESSONS

Driving School Database Customers book lessons in a car with an instructor. Entities: CUSTOMERS LESSONS CAR

Driving School Database Customers book lessons in a car with an instructor. Entities: CUSTOMERS LESSONS CAR INSTRUCTOR

Restaurant Database Customers make reservations. Orders are made of menu items and are given to the waiter. Entities: CUSTOMERS RESERVATION ORDER MENU_ITEMS WAITER

Foreign Key used to link the tables in a relational database. a field in one table that is also the primary key in another often overlined: MEMBER(MemberID, Forename, Surname, …...) BOOK(BookID, ISBN, Title, …..) LOANS(LoanID, MemberID, BookID, LoanDate, ….)

Relationships Members of a library are loaned books Entities: MEMBERS LOANS

Relationships MEMBERS

Relationships MEMBERS LOANS

Relationships MEMBERS LOANS

Relationships MEMBERS LOANS BOOKS

Relationships MEMBERS LOANS BOOKS

Relationships MEMBERS MemberID LOANS LoanID BOOKS BookID

Relationships MEMBERS MemberID LOANS LoanID MemberID BOOKS BookID

Relationships MEMBERS LOANS BOOKS MemberID LoanID MemberID BookID

Relationships MEMBERS LOANS BOOKS MemberID Forename Surname PostCode LoanID MemberID BookID DateOut BOOKS BookID Title Author ISBN

Relationships MEMBERS LOANS BOOKS MemberID Forename Surname PostCode LOANS LoanID MemberID BookID DateOut BOOKS BookID Title Author ISBN MEMBERS(MemberID, Forename, Surname, PostCode) BOOKS(BookID, Title, Author, ISBN) LOANS(LoanID, MemberID, BookID, DateOut) Relationships Primary Key

Foreign Key used to link the tables in a relational database. a field in one table that is also the primary key in another often overlined: MEMBER(MemberID, Forename, Surname, …...) BOOK(BookID, ISBN, Title, …..) LOANS(LoanID, MemberID, BookID, LoanDate, ….)

Relationships (SBD 2012) Outlets have visits for different types of inspection Entities: OUTLET INSPECTIONTYPES INSPECTIONVISITS

Exam question:

Exam question:

Exam question:

Exam question:

Relationships

Relationships A primary key is a ***** that contains a ****** item of **** that identifies a particular ******.

Relationships A primary key is a ***** that contains a ****** item of **** that identifies a particular ******. A foreign key is the ******* *** from another e***** and is used to l*** the t****s together forming a ************.

Relationships the links between entities in a relational database:

Relationships the links between entities in a relational database:

Relationships the links between entities in a relational database: there are three degrees of relationship between entities:

Relationships the links between entities in a relational database: there are three degrees of relationship between entities: one-to-one,

Relationships the links between entities in a relational database: there are three degrees of relationship between entities: one-to-one, one-to-many,

Relationships the links between entities in a relational database: there are three degrees of relationship between entities: one-to-one, one-to-many, many-to-many.

Relationships

One-to-One Relationship

One-to-Many Relationship

Many-to-Many Relationship

Many-to-Many Relationship usually broken down into two 1:many relationships using a link table

Many-to-Many Relationship

Exam question: A company stores details of customers and bookings in a database. Two of the entities in the database are CUSTOMER and BOOKING. What is the relationship between CUSTOMER and BOOKING? [1]

Exam question:

Exam question:

Exam Question: A company manufactures electronic tills for use in shops. The company has decided to write a database to store information about its sales. The entities that will be used in the database are: CUSTOMER: A list of the customers that have purchased tills from them TILL: A list of tills that are produced by the company SALESPERSON: The member of the company who was responsible for the sale ORDER: The details of the orders placed by the company ORDER_LINES: The details of the individual tills that make up each order Draw the Entity Relationship Diagram (ERD) making sure that the degree of each relationship is identified. [6]

Relationships to link records in different tables making sure data is not duplicated by ensuring referential integrity reduces storage space required since data is not duplicated

Entity-Relationship diagrams E-R diagram (ERD),

Entity-Relationship diagrams E-R diagram (ERD), a graphical representation of the entities and the relationships between them,

Entity-Relationship diagrams E-R diagram (ERD), a graphical representation of the entities and the relationships between them, from Access

Entity-Relationship diagrams E-R diagram (ERD), a graphical representation of the entities and the relationships between them, from Access manually drawn CUSTOMER BOOKINGS STAFF

Entity Relationship diagram Members of a marching band who are loaned instruments and attend events:

Standard Notation Entities are written in capital letters Attributes are written with an initial capital Primary keys are underlined or labelled PK Foreign keys are overlined for OCR board or labelled FK

Standard Notation Entities are written in capital letters Attributes are written with an initial capital Primary keys are underlined or labelled PK Foreign keys are overlined for OCR board or labelled FK e.g. for a library database: MEMBER(MemberID, Forename, Surname, ….) BOOK(BookID, Title, Author ….) LOANS(LoanNo, MemberID, BookID, DateOut, …)

Referential Integrity every foreign key must have a related primary key value e.g. for a customer ID in a hire table there must be the same customer (ID) in the customer table you can’t hire something to a non-existent customer! if a customer record is deleted then all ‘hires’ by the deleted cusomer are removed. ensures no redundant data is stored

Duplicate Data more than 1 copy of a data record e.g. customer’s data entered & stored twice data taking up more storage space than necessary possible data inconsistency 2 different copies of the data

Entity Relationship Diagram (SBD 2012)