🎯 Learning Objectives
Developing Data & Data Representation and Information Technology learning strands, specifically:
- To see some examples of databases.
- Understand that one of the advantages of a computer-based database is the ability to search for data quickly.
- Know what data types are.
- Be able to choose the correct data types for specific items of data.
💬 Key Vocabulary
- Database
- Table
- Field
- Date types: Text, Number, Date/Time, Currency, Boolean, Autonumber.
- Record
📝 Starter Activity
- Download the Starter Worksheet below and fill in the blanks using your knowledge from the previous lesson.
📝 Silver Badge – Searching a Simple Database
- One of the advantages of a computer-based database is that they are very easy and quick to search.
- Consider this scenario:
- Professor Xavier (leader of the X-Men) is looking to recruit some new superheroes.
- The Professor wants you to search for super heroes that have particular traits such as heights and hair colour.
- You have been provided with a database of super heroes that may be suitable.
- Your job is to search the database to come up with the name of the super hero that best matches desired traits.
- Download the worksheet and the simple database below to find the superheroes.
📖 Data Types
There are many different kinds of data you might find in a database, some of them are similar to the data types you looked at in Python.
A database likes to store these different types of data in specific ways as this can speed up searching and make the size of the database as small and efficient as possible.
It is important that you can recognise the correct data type for each field.
Text
A Text data type will used for field which contain text, we called this a string in Python.
Examples could include: name, favourite food, place of birth.
This datatype will also be used for fields which contain a mixture of letters and numbers.
Examples could include: postcode (e.g. PE10 9JE) or a car registration number (e.g. EA89 YHJ).
Number
A number data type will be used for fields that only contain numbers.
They can be whole numbers (3, 780), decimal numbers (7.45, 80.9) or negative numbers (-2, -329).
Examples of fields which would use a number data type might be:
- shoe size
- height
- exam mark
Date/Time
A date/time data type will be used to store any data which is a date or which is formatted as time.
Examples include:
- Date of birth
- Date of holiday
- Time of doctor’s appointment
- Time a TV show is due to start
This data type will let you choose how the date or time is displayed, for example:
- 14th May 2021
- 14 May 21
- 14/05/2021
- 14/05/21
Currency
A currency data type will be used to store data about money.
It can be stored in Pound Sterling (£), dollars ($), euros (€) or any other world currency.
The data type will allow you to set the currency with 0, 1 or 2 decimal places e.g:
- £99
- £9.99
Boolean
A Boolean data type is sometimes known as a “Yes/No” data type.
It works in a similar way to the Boolean data type in Python. It can only be one of two options, such as:
- True/False
- Yes/No
- Hot/Cold
- On/Off
- Right/Wrong
Autonumber
An autonumber field will automatically give each record in your table a new and unique number, without you needing to do anything.
This kind of data type is unique to databases but is important in making them work correctly. This is because a database table must have a “primary key”, this is a piece of data that uniquely identifies each record.
For example each bank customer has a unique bank account number, if it was not unique you might be paying the wrong person! You also have a unique student number that the school and exam boards use to identify you, in case there is someone with the same name as you, you might not want their grades.
📝 Which data type?
Think about which data type would best suit the data below, click on them to find out which is correct.
9, South Road, Bourne
Text
10th January 2022
Date/Time
£10.70
Currency
-3190
Number
lion
Text
324.654
Number
$5.76
Currency
Enter/Exit
Boolean
📖 Keywords – Definitions
Database – collection of data or information that has been stored in an organised way.
Field – one type or one piece of information.
Record – all the data about a person or an object.
Table – collection of the database’s fields and records.
💬 Summary
In this lesson, you…
- Looked at some examples of databases.
- Understood that one of the advantages of a computer-based database is the ability to search for data quickly.
- Now know what data types are.
- Are now able to choose the correct data types for specific items of data.
In the next lesson, you will…
- Find out how to set up a database by using fields, data types and validation rules.
- See how to import data into a database.
- Be able to create a database from scratch by following a list of instructions.
🏅 Badge it
🥈 Silver Badge
- Upload your completed Superhero Search worksheet to the Silver badge task on Bourne to Learn.
🥇 Gold Badge
- Download the Data Types worksheet below, complete it and then upload to the Gold badge task on Bourne to Learn.
🥉 Platinum Badge
- Download the Data Types Extra worksheet below, complete it and then upload to the Platinum badge task on Bourne to Learn.