14.0 Databases
14.0 Databases
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
2
CAMBRIDGE IGCSE TM ICT: WORKSHEETS
YOUR NOTES
Flat File Database Relational Database
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
5
CAMBRIDGE IGCSE TM ICT: WORKSHEETS
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
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
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
[5]
8
CAMBRIDGE IGCSE TM ICT: WORKSHEETS
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
10
CAMBRIDGE IGCSE TM ICT: WORKSHEETS
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
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
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
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
19
CAMBRIDGE IGCSE TM ICT: WORKSHEETS
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.
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
22
CAMBRIDGE IGCSE TM ICT: WORKSHEETS
Head to savemyexams.co.uk for more awesome resources
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