0% found this document useful (0 votes)
5 views

14.0 Databases

The document provides an overview of databases, including types (flat file and relational), their characteristics, advantages, and disadvantages. It discusses key concepts such as primary and foreign keys, form design principles, and data types used in databases. Additionally, it covers how to perform calculations within databases and the importance of good form design for user interaction.

Uploaded by

mrubiqgro
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

14.0 Databases

The document provides an overview of databases, including types (flat file and relational), their characteristics, advantages, and disadvantages. It discusses key concepts such as primary and foreign keys, form design principles, and data types used in databases. Additionally, it covers how to perform calculations within databases and the importance of good form design for user interaction.

Uploaded by

mrubiqgro
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

CAMBRIDGE IGCSE ICT: WORKSHEETS

YOUR NOTES
IGCSE ICT CIE 

14. Databases

CONTENTS
14.1 Databases
Types of Database
Primary & Foreign Keys
Form Design
Perform Calculations
Sort Data in Databases
Search & Select Data in Databases
Present Data

1
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

14.1 Databases YOUR NOTES



Types of Database

Flat File Database & Relational Database


A database is a structured collection of data so it can be searched, sorted,
filtered and analysed quickly
Data in a database can be any type of data including text, images, videos, sound
Databases use tables to store data
Tables have records of data represented by one row
In the example below, each row represents the data stored about a single customer
(the customer’s record)
In the customer table, there are 3 records
Each record is divided into fields (CustomerID, FirstName, LastName, DOB and Phone
Number)
A Database Table Containing Customer Details

CustomerID FirstName LastName DOB PhoneNumber

1 Andrea Bycroft 05031976 0746762883


2 Melissa Langler 22012001 0756372892
3 Amy George 22111988 0746372821

Fields are represented by the columns in a table


There are 5 fields in the customer table
The first row in a table contains the field names which is the heading for the data stored
in that field
Each field in a table has a data type which defines what data can be entered into that
field

Flat File Database Relational Database

A single table of data Organises data into multiple tables


Characteristics Data separated by commas Tables linked by primary and foreign
or tabs keys

Suitable for large datasets


Ideal for small datasets
Uses Used in sectors such as healthcare and
Used in data import/export
finance

2
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

YOUR NOTES
Flat File Database Relational Database 

Reduced data redundancy due to


normalisation
All records are stored in one
Reduced inconsistency of data
place
Easier to edit records/record format
Easier to use
Easier to add/delete data/records
Advantages Sorting and filtering are
More complex queries can be carried
simpler
out
Can be used with a
Better security
spreadsheet
More ability to cater for future
requirements

Complex to set up and manage


Data redundancy with costing time and money
duplicated data Requires more processing power
Difficult to manage as compared to flat file databases
database size grows Slower extraction of meaning from
Harder to update data
Disadvantages Harder to change the data Less robust as each table requires a
format key field
Harder to produce complex and relationships to other tables
queries More developer expertise to run the
Almost no security database
More processing power is needed for
complex queries

3
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

YOUR NOTES
 Worked Example

The owner of a gardening company is planning to create a database to store the
details of all his customers. He has the choice of using a flat file database or a
relational database.
Discuss the advantages and disadvantages of using a relational database rather
than a flat file database.
[8]
Advantages of relational databases
Less data entry/data is stored only once / avoids duplication of data
Less inconsistency in data
Easier to edit data/records
Easier to edit data/record format
Easier to add/delete data/records
More complex queries can be carried out
Better security
More ability to cater for future requirements/expansion
Disadvantages of relational databases
More complex than a flat file database as more tables are required
Takes more time to set up
More of a reduction in performance if many tables are needed
Slower extraction of meaning from data
Less robust due to broken keys and records / each table requires a key field and
relationships to other tables
More developer expertise/personnel to run the database:
More expensive to create a relational database
More processing power is needed for complex queries.
Advantages of flat file databases
All records are stored in one place
Easier to understand/use
Sorting is simpler
Filtering is simpler
Can be used with a spreadsheet / single table DBMS
Disadvantages of a flat file database
Data is more likely to be duplicated / difficult to stop duplication
Records can be duplicated and the flat file will not stop this
Harder to update
Every record in the database has to have the same fields, even though many are not
used

4
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

Harder to change the data format YOUR NOTES


Harder to produce complex queries 
Almost no security

5
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

Data Types YOUR NOTES


Import Data and Create Tables 
You can import data from existing files, like .csv or .txt
You can use specified field names to create tables

Data Types
Each field in a table has a data type
If you assigned the data type Integer to a phone number it would remove the initial 0
Common data types include text/alphanumeric, character, boolean,
integer, real and date/time
Phone numbers have to be assigned the text/alphanumeric data type because they
begin with a 0
Database Data Types

Data Type Explanation Example

This data type allows letters, special characters like spaces and
Text/Alphanumeric NG321AE
punctuation and numbers to be entered into a field
This allows single characters to be entered into a field.
Character Characters can be any alphanumeric value and can be A
lowercase or uppercase
This data type can be used in fields where there are only two
possible options. Data is stored as a 1 or 0 in the database but
Boolean True/False
can be used to represent True/False or Yes/No or
checked/unchecked
Integer Only whole numbers can be entered 15
Currency Used for monetary values £4.75
Decimal / Real Numbers including decimal numbers can be stored 30.99
Only dates or times can be entered into a field with this type. A
Date/Time 180855
format for the date/time can also be assigned to the field

6
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

YOUR NOTES

Setting Data Types and Sub-Types


You can set appropriate data types to fields
You can set sub-types of numeric data including percentages, the number of decimal
places
Setting Display Formats
You can set the display format of Boolean/logical fields to either
Yes/No
True/False
Checkbox
You can set the display format of date/time data

 Exam Tip
Make sure you're specific which type of numeric data it should be - integer,
decimal/real or currency

7
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

YOUR NOTES
 Worked Example

A farmer has purchased a computerised milking system for her cows. She has
asked a systems analyst to create a database to store details of the cows being
milked.
Examples of the details of the cows which will be stored are:

Breed Date_of_birth Weight_of_cow Average_milk_yield Passport_number

Holstein 25/02/2017 725.9 24.5 998/2017


Ayrshire 15/03/2016 715.0 20.1 972/2016
Jersey 25/02/2017 732.7 25.0 971/2016
Holstein 10/10/2016 715.0 25.0 765/2016
Complete the following table by entering the most appropriate data type for each
field. For any numeric field, specify the type of number.

Field name Data type

Breed
Date_of_birth
Weight_of_cow
Average_milk_yield
Passport_number
[5]

Field name Data type

Breed Text [1]


Date_of_birth Date [1]
Numeric:
Weight_of_cow
decimal/real [1]
Numeric:
Average_milk_yield
decimal/real [1]
Passport_number Text [1]

8
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

Primary & Foreign Keys YOUR NOTES



Primary Keys & Foreign Keys
What is a Primary Key?
Each table has a primary key field which acts as a unique identifier
Each item of data in this field is unique
Duplicate data items would be blocked if they were entered into the primary key field
Because the items of data are unique within the primary key field they can be used
to identify individual records
A Database Table Containing Customer Details

CustomerID FirstName LastName DOB PhoneNumber

1 Andrea Bycroft 05031976 0746762883


2 Melissa Langler 22012001 0756372892
3 Amy George 22111988 0746372821

In the example customer table, the primary key would be the CustomerID because each
customer’s ID is unique
If there was a customer with the same name they could be identified correctly using the
CustomerID
Creating and Editing Keys
Primary key - Uniquely identifies each record in a table
Foreign key - Used to link two tables together. The Foreign Key in one table would be the
primary key in another

9
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

YOUR NOTES

Creating Relationships Between Tables


Relational databases allow you to create relationships between different tables using
primary and foreign keys

10
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

What is a Foreign Key? YOUR NOTES


A foreign key is how we link tables together using primary keys 
Using the table above with customer details, we'll add another table showing subscriptions
that customers have
In this example CustomerID is a foreign key as it links with the CustomerID in the customer
table above

SubscriptionID CustomerID SubscriptionType

1 2 Annual
2 1 Monthly
3 3 Quarterly

 Exam Tip
If the answer to a question is the name of a field, ensure you copy it exactly from
the question. The examiner is looking for an exact answer with the correct
capital letters and underscores where they're included

 Worked Example
A systems analyst has created a new computer system to keep records in a
medical centre. She has created a relational database to store the medical records
of patients.
The database uses primary and foreign keys. Explain the difference between a
primary key and a foreign key.
[4]
4 of:
The primary key holds unique data [1]
The primary key identifies the record [1]
The primary key can be automatically indexed [1]
Each table has one primary key whereas a table can contain several foreign keys [1]
A foreign key is used to link with the primary key of another table [1]

11
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

Form Design YOUR NOTES



Form Design
Characteristics of Good Form Design
Simplicity - The design should be clean and straightforward, not cluttered
Ease of use - Users should be able to understand how to fill out the form quickly
Intuitive layout - Related fields should be grouped together, and the sequence of fields
should follow a logical order
Clear labels - Each field should have a clear, concise label indicating what information is
expected
Appropriate controls - Use controls like radio buttons, checkboxes, and drop-down
menus where appropriate

Creating a Data Entry Form


You need to specify the fields required for data input
Choose the appropriate font styles and sizes. Aim for consistency and readability
Keep adequate spacing between fields for clarity and ease of use

Fine-Tuning Form Design


Appropriate Spacing
The spacing between individual characters in fields should be adjusted for readability
The use of white space is crucial - it improves readability and reduces cognitive load

Control Elements
Radio Buttons - Used when there is a list of two or more options that are mutually exclusive

12
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

Check Boxes - Used when the user can select multiple options from a list YOUR NOTES
Drop Down Menus - Used when you want to provide many options but conserve space 

 Exam Tip
Always focus on simplicity and user-friendliness in form design
Make sure your form uses clear labels, logical field grouping, and intuitive
sequence

13
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

YOUR NOTES
 Worked Example

A school is setting up a new computerised system to manage many aspects of the
school administration. The data from the registration system is saved in the school
administration database. The headteacher will need to check the attendance
records for any student for any semester. She will type in the Student_ID and the
Semester (Autumn, Spring or Summer). After she has done this the following data
will appear on the same screen.

Field name

Student_name
Days_present
Number_of_lates
Number_absences
Parents_phone_number
Tutor_group
Design a suitable screen layout to display one record. It must have appropriate
spacing for each field, navigation aids and a space to type in search data. Do not
include examples of students.
[6]
4 of:
Appropriate spacing for each field [1]
Forward/backward buttons [1]
Submit/search button [1]
Information attempts to fill the page AND the design looks appropriate to scenario
[1]
Box/boxes to enter Semester or Student_ID [1]
Drop down for the Semester or Student_ID // radio button for semester [1]
Suitable title [1]
Instructions/help [1]
2 marks for all six fields
1 mark for three to five fields
0 marks for less than three fields

14
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

Perform Calculations YOUR NOTES



Perform Calculations
Use of Arithmetic Operations or Numeric Functions
In a database, you can use arithmetic operations or numeric functions to perform
calculations
Calculated Fields are fields that carry out a calculation based on other number fields in the
database
Let's say you have a products table with Price and Quantity fields. You could create a
TotalCost a calculated field like this:
TotalCost = Price * Quantity
This calculation multiplies the price of each item by its quantity to find the total cost
Calculated Controls are objects you place on forms or reports to display the result of an
expression
You might have a form in a sales database where you input the QuantitySold and UnitPrice. A
calculated control could be used to display the TotalSale:
TotalSale = QuantitySold * UnitPrice
This displays the total sale on the form without storing it in the database
Using Formulae and Functions to Perform Calculations
Databases allow you to use formulae and functions to perform calculations at run time
This can include basic arithmetic operations: addition, subtraction, multiplication, and
division
Suppose you have a discount field and you want to subtract it from the total cost, you
could use a subtraction operation like this:
FinalCost = TotalCost - Discount

Aggregate Functions
You can also use aggregate functions to calculate statistical information about a set of records.
Some examples include:
Sum - Adds together all the numbers in a column
To find the total cost of all products sold, you could use the SUM function on the
TotalCost field:
SUM(TotalCost)
Average - Computes the average of a set of numbers in a column
To find the average price of all products, you could use the AVERAGE function:
AVERAGE(Price)
Maximum - Finds the highest number in a column
To find the most expensive product, you could use the MAX function on the Price field:
MAX(Price)
Minimum - Finds the lowest number in a column
To find the least expensive product, you could use the MIN function:
MIN(Price)
Count - Counts the number of rows in a column

15
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

To find the number of products in the database, you could use the COUNT function: YOUR NOTES
COUNT(ProductID)

Remember that the actual syntax and function names might differ slightly depending on the
specific database system being used.

16
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

Sort Data in Databases YOUR NOTES



Sorting Data in Databases
Sorting is a crucial function in databases. It helps organise and present data in a meaningful
way.
Using a Single Criterion to Sort Data
You can sort data based on a single criterion - such as by name, date, or numerical value
For example, you might sort a list of students in ascending order by their last names
To sort the customer's tables by LastName in either ascending or descending order:
1. Open the table in Datasheet View
2. Click on the column header for the field to be sorted. For example, a table of customers to
be sorted by LastName, click on the LastName column header
3. Click on the "Sort Ascending" or "Sort Descending" button in the toolbar at the top of the
screen

Using Multiple Criteria to Sort Data


You can also sort data based on multiple criteria
For instance, you might want to sort a list of products first by category (ascending), and
within each category, by price (descending)
To sort the customer's table first by City, and then by LastName within each city:
1. Open the table in Datasheet View
2. Click on the column header for the first field to be sorted. For example, sorting by City
and then by LastName within each city, first, click on the City column header

17
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

3. Click on the "Sort Ascending" or "Sort Descending" button in the toolbar YOUR NOTES
4. Next, hold down the Shift key and click on the column header for the second field to be 
sorted by (LastName in this example)
5. While still holding down the Shift key, click on the "Sort Ascending" or "Sort
Descending" button again
Ascending and Descending Order
Ascending Order - Data is sorted from smallest to largest (e.g., from A to Z, or from 1 to
100)
Descending Order - Data is sorted from largest to smallest (e.g., from Z to A, or from 100 to
1)

 Exam Tip
Remember, when sorting by multiple criteria, the data is first sorted by the first
criterion. Within each group of the first criterion, it is sorted by the second
criterion, and so on

18
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

Search & Select Data in Databases YOUR NOTES



Search & Select Data in Databases
Searching and selecting data in databases is typically done using queries. These queries can be
based on a single criterion or multiple criteria.
Using a Single Criterion to Select Subsets of Data
You can use a single criterion to select specific data. For example, you might want to select
all customers from a specific city
E.g. to return all customers from London:
1. Open the Query Design View
2. Add the table you want to query
3. Drag the field you want to query to the QBE grid. For instance, if you're looking for
customers from a specific city, drag the City field
4. In the Criteria row under this field, type the value you're looking for (e.g., 'London')

Using Multiple Criteria to Select Subsets of Data


You can also use multiple criteria to select data. For instance, you might want to select all
customers from a specific city who have also purchased in the last month
E.g. to return all customers from London who purchased in the last 30 days:
1. Follow the steps above to start a new query and add the City field with 'London' as the
criteria
2. Drag another field you want to query to the QBE grid. For example, if you're looking for
customers who purchased in the last month, drag the LastPurchaseDate field
3. In the Criteria row under this field, type Date()-30
Using Operators to Perform Searches
AND - Returns true if both conditions are met

19
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

OR - Returns true if at least one condition is met YOUR NOTES


NOT - Returns true if the condition is not met 
LIKE - Returns true if the value matches a pattern (used with wildcards)
>, <, =, >=, <=, <> - These are comparison operators. They return true if the comparison
between the values is correct
Using Wildcards to Perform Searches
Wildcards are used with the LIKE operator to search for patterns. The most common
wildcard characters are:
% - Represents zero, one, or multiple characters
_ - Represents a single character
E.g. to return all customers whose names start with 'J':
1. Start a new query and drag the field you want to query to the QBE grid. For example, if
you're looking for customers whose names start with 'J', drag the Name field
2. In the Criteria row under this field, type J*

 Exam Tip
Remember, the exact steps and symbols used for wildcards may vary
depending on the specific DBMS and its version. In Microsoft Access, the
asterisk (*) is used as the wildcard character to represent multiple characters,
while the question mark (?) represents a single character
When referring to field names from the exam question, make sure you copy it
exactly the way it appears in the question
Make sure you give the information asked for in the question and not a different
field

20
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

YOUR NOTES
 Worked Example

A student is setting up a database of information about volcanoes for a Geography
project. The following is part of the database.

Name_of_volcano Country Height State Last_eruption Volcano_type

Use Japan 731 Active 2001 Stratovolcano


Tor Zawar Pakistan 2237 Dormant 2010 Fissure
Datong China 1882 Extinct 450 Cinder Cone
Changbaishan China 2744 Active 1903 Stratovolcano
Stromboli Italy 926 Active 2016 Stratovolcano
Pyroclastic
Tengchong China 2865 Dormant 1609
cone
Wudalianchi China 597 Dormant 1721 Multi-coned

Operators such as AND, OR, NOT, LIKE, >, >=, <, <=, =, <> can be used to search the
volcano database. The search criteria for all the dormant volcanoes with a height of
less than 1000 metres would look like this:
State = “Dormant” AND Height < 1000
Use only the given operators and data to:
a. write down the search criteria that will produce a list of all the volcanoes that are
not extinct in China that also last erupted before the year 1900.
[6]
State = NOT ‘Extinct’ AND Country = ‘China’ AND Last_eruption < 1900
State = – 1 mark or State <> [1]
NOT ‘Extinct’ – 1 mark or <> ‘Extinct’ [1]
AND Country [1]
= ‘China’ [1]
AND Last_eruption [1]
< 1900 [1]
b. write down the names of the volcanoes that match the requirements of part (a).
[2]
Tengchong [1]
Wudalianchi [1]
c. The data is sorted into ascending order of height. Write down the name of the
volcano which would now be in the first record.
[1]

21
CAMBRIDGE IGCSE TM ICT: WORKSHEETS

Wudalianchi [1] YOUR NOTES


22
CAMBRIDGE IGCSE TM ICT: WORKSHEETS
Head to savemyexams.co.uk for more awesome resources

Present Data YOUR NOTES



Present Data
Data presentation in databases is often done through reports. These reports can be formatted
and customised to display data in a user-friendly manner.
Producing Reports to Display Data
Reports should display all the required data and labels in full. For example, if you're creating
a sales report, it should include all relevant fields, like product name, quantity sold, and total
sales
Using Appropriate Headers and Footers
Report Header: This appears at the beginning of the report. This is typically where you
would put the report title and other introductory information
Report Footer: This appears at the end of the report. This is where you might put summary
or conclusion information
Page Header: Appears at the top of each page. This might contain the page number and
the date
Page Footer: Appears at the bottom of each page. This might also contain the page
number and the date
Setting Report Titles
The report title should be set in the report header. It should be clear, concise, and accurately
reflect the contents of the report
Producing Different Output Layouts
You can control the display of data and labels in your report. For example, you might
choose a tabular format, where data is arranged in rows and columns, or a columnar format,
where each data field is listed vertically

Aligning Data and Labels

Page 23 of 24

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

23
CAMBRIDGE IGCSE TM ICT: WORKSHEETS
Head to savemyexams.co.uk for more awesome resources

Data and labels should be aligned appropriately. For example, numeric data is often right- YOUR NOTES
aligned, and decimal points should be aligned for easy comparison 
Controlling the Display Format of Numeric Data
You can control the number of decimal places displayed, the use of a currency symbol, and
the display of percentages. For example, a total sales field might be displayed with two
decimal places and a currency symbol

Page 24 of 24

© 2015-2023 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers

24

You might also like