You are on page 1of 20

Lesson 1

Databases

What is a Database?
Learning Objective Success Criteria

● To understand the purpose of ● Level 4 - To be able to define


a database. the keywords: database, file,
● To understand the key words: record and field.
database, file, record and ● To know what databases are
field. used for.
● To understand the difference
between a flat file and a ● Level 5 - To be able to
relational database. explain the differences
● Create a database using MS Office between a flat file and a
Access and Delphi Embarcadero relational database.
Seattle
● explain the difference between the ● Explain the difference between the
terms security, privacy and integrity terms security, privacy and integrity
of data; of data;
What is and isn’t a
database file?
Database Not a Database

Book Filing Cabinet Catalog Questionnaire


ues
Finished? Can you think of any more Database examples of your own?
What does a
database file do?
● Define a database on your whiteboards.
Finished? Can you name 3 advantages of a database?

● Let’s come up with a class definition...

● Database:
An organised / structured set of data.
What is a Database?
What are the advantages of a
computerised database over a
paper based database?

Vs
Computerised Database Paper –Based Database

● Easier to search and find what you’re looking for


● Can’t lose it as you can make a back-up
● Can make changes to it very easily

Finished? Can you name 3 disadvantages of a database?


Amazon

● Amazon has a database of all its customers.

● What information do they hold about their


customers?
Billing Address
Name
Card Details Phone Number

E-mail address
Delivery Address
Previous Orders
Finished? What information do you think is the most important for Amazon to know?
Amazon

Billing Address
Name
Card Details Phone Number

E-mail address
Delivery Address
Previous Orders
● These are called FIELDs in a database.
● They are one piece of information about the
customer
Amazon

● All the information (fields) that is about ONE


CUSTOMER is called a RECORD.
Name Delivery Billing Phone Email Card Previous
Address Address Number Address Details Orders

Martin 1 Carr 10 High St 0121 555 m.freeman VISA Samsung


Freeman Lane 8888 @gmail.co Telly
m

● Just like a school has a RECORD about you (all


the information about you)
● Just like the police have a record of all criminals
(with their personal info with crimes committed too)
Records and Fields

● This is a record...

Name Delivery Billing Phone Email Card Previous


Address Address Number Address Details Orders

Martin 1 Carr 10 High St 0121 555 m.freeman VISA Samsung


Freeman Lane 8888 @gmail.co Telly
m

● It is made up of fields...
Review

● What kind of fields would the school hold on you?

● What kind of fields would the police hold on


criminals?

● What kind of fields would a database of games


have?

● Define a record
Difference between Flat File and
Relational
● There are 2 types of Databases:
● Flat File Database
• One big table
Table
Fields

● Relational Database
• Many tables linked together

Table Table Table


Fields Fields Fields
Vets Flat File Database
Field Name Data Type
Customer_ID AutoNumber
Title Text ● Take a database that a
Surname Text
vet might use.
Street Text
Town Text
● Every time the pet has
County Text
Phone_Number Text
an appointment all of
Pets_Name Text this information needs
Type Text to be typed in.
DOB Date/Time
Medical_Conditions Text
Date_of_Appointment Date/Time
Time_of_Appointment Date/Time
Symptoms Text
Treatment Text
Vets Flat File Database
Field Name Data Type
Customer_ID AutoNumber
Title Text ● What might be the
Surname Text
problems with this?
Street Text
● All the information isn’t
Town Text
needed every time!
County Text
● Duplicating data held in
Phone_Number Text
Pets_Name Text
the database
Type Text ● Takes too much time!
DOB Date/Time ● Can make mistakes (spell
Medical_Conditions Text the pets name wrong on
Date_of_Appointment Date/Time one occasion)
Time_of_Appointment Date/Time
Symptoms Text
Treatment Text
Vets Flat File Database
Field Name Data Type
Customer_ID AutoNumber
Title Text ● How can we solve this
Surname Text
issue?
Street Text
● Are there any other ways we
Town Text can organise this data?
County Text
Phone_Number Text ● Hint: In our example on the left,
Pets_Name Text there is data about:
Type Text ● the owner

DOB Date/Time ● i.e. name, address, phone


number
Medical_Conditions Text
● the pet
Date_of_Appointment Date/Time
● name, type of animal, date
Time_of_Appointment Date/Time
of birth
Symptoms Text ● appointments
Treatment Text
Vets Flat File Database
Field Name Data Type
Customer_ID AutoNumber
Title Text ● In our example on the
Surname Text left, there is data about:
Street Text
● the owner
Town Text
● i.e. name, address,
County Text phone number
Phone_Number Text
● the pet
Pets_Name Text
● name, type of animal,
Type Text date of birth
DOB Date/Time
● appointments
Medical_Conditions Text
Date_of_Appointment Date/Time
Time_of_Appointment Date/Time
Symptoms Text
Treatment Text
Vets Relational Database

Customer Table
Customer_ID
Appointment Table
Title
Appointment_ID
Surname
Customer_ID Pet Table
Street
Pet_ID Pet_ID
Town
Date_of_Appointment Pets_Name
County
Time_of_Appointment Type
Phone_Number
Symptoms DOB
Treatment Medical_Conditions

What are the advantages of this?


Vets Relational Database

● Data isn’t entered twice or more in the database. (no


data duplication)

● When customers book an appointment this is done in


the appointment table and the relevant Customer_ID
and Pet_ID are chosen.

● This reduces the data stored, making the database


smaller in size.

● Reduces mistakes as information doesn’t need to be


typed in again.
What’s wrong here? Why?

● A student, Paul, has written the following in his


databases assessment, can you help him to explain
what he’s done wrong?

● Relational databases are better than flat file databases


because they use only one table.

● Relational databases are bigger than flat file databases.

● Mistakes are made all the time in relational databases as you


have to type in the data again and again.

● Sometimes data is written twice or more in a relational


database.
Learning Journals

● Fill in your learning journals detailing what you’ve


done so far.

● What have you learnt today?

● Is there anything that you want to find out over


the next few lessons?

You might also like