2.3 Database Workbook by Inqilab Patel
2.3 Database Workbook by Inqilab Patel
Page | 3
Contents
Syllabus content & assessment at a glance ...................................................................................................................... 4
About the developer of this workbook ............................................................................................................................. 5
Disclaimer.......................................................................................................................................................................... 6
Introduction ....................................................................................................................... Error! Bookmark not defined.
Algorithm ........................................................................................................................... Error! Bookmark not defined.
Structure Chart................................................................................................................... Error! Bookmark not defined.
Flowchart ........................................................................................................................... Error! Bookmark not defined.
Finding Output from flowchart ...................................................................................... Error! Bookmark not defined.
Algorithm pseudo code ...................................................................................................... Error! Bookmark not defined.
Errors in Pseudo code and Program .................................................................................. Error! Bookmark not defined.
Finding output from pseudo code ................................................................................. Error! Bookmark not defined.
Finding output from pseudo code ................................................................................. Error! Bookmark not defined.
Database ......................................................................................................................................................................... 20
Introduction to Logo .......................................................................................................... Error! Bookmark not defined.
2.2 Programming................................................................................................................ Error! Bookmark not defined.
Arrays: Data Structure & Pre-Release Materials................................................................ Error! Bookmark not defined.
Page | 4
Assessment at a glance
Components Weighting
Paper 1 Theory 1 hour 45 minutes 60%
This written paper contains short-answer and structured questions. All
questions are compulsory.
No calculators are permitted in this paper. 75 marks
Externally assessed.
Paper 2 Problem-solving and Programming 1 hour 45 minutes 40%
This written paper contains short-answer and structured questions. All
questions are compulsory. 20 of the marks for this paper are from questions
set on the pre-release material. 1
No calculators are permitted in this paper. 50 marks
Externally assessed.
Page | 5
His entire career path revolves around computer science; either he was a student or a
teacher. He got a chance to polish his skills of teaching and studying more about computers
at various levels which has given him great confidence in presenting himself for any senior
level position of transferring his knowledge to the youth.
He has not stopped, he is continuing with his education at the higher levels. It is his second
semester of MPhil computer studies from a well-known university of Pakistan; The Institute of
Business & Technology.
Inqilab Patel knows a lot of methods of teaching computers and has developed tutorial notes,
worksheets and assignments for my students. He also maintains a website
(www.inqilabpatel.com) which is specifically designed for the support of those who want to
excel in GCSE computer science. He also regularly contributes material to CIE teacher
support website, for which he receives appreciation from different people across the world.
He has also received various training in innovative and special methods of teaching this
subject.
Page | 6
Disclaimer
This workbook is developed by combining different materials related to Cambridge IGCSE &
O Level Computer Science 0478 & 2210. It is combination of work developed by me and the
resources, which are available in different web sites, books, magazines, past papers and
guides, just to facilitate students and teachers in preparation for examinations.
Examination questions and marking schemes used in this workbook are taken from CIE
(Cambridge International Examinations)
Note
Study of at least one of the following books, is compulsory for solving this workbook.
Page | 7
Testimonials
Page | 8
Page | 9
Page | 10
Page | 11
Page | 12
Page | 13
yasirraza
Such a benevolent hearted teacher with extra-terrestrial professionalism and dedication. Perfect in his
profession and thing I like about him the most is the sea of knowledge He possesses. Illuminating our minds by
giving us his heart and hard work to ensure well being of his students.A classy, inch perfect and a shining star in
Awais Ahmed
One of the best teachers in the world i have ever witnessed.He show faith in me when i was totally weak.He is
the one of the most hardworking and most devoted teachers from my site.
ShabnamManzoor
AzfarGardezi
A dedicated and hardworking teacher with great vision. Sir surely helped me a lot in
becoming capable of scoring well in O Level Computer Science.
Gamonics
the most dedicated teacher ever . supporting and inspirational teacher that everycan can look upto as a role
model. would 10/10 recommend
SudaisJawwadMansoor
SajidSalim
Muhammad Noman
Telingueur AWE
Just for the short time I’ve been in contact with Mr Patel and the computer teacher’s family ☺ , I can affirm that
I met a great man and the best computer science teacher so far. From your high standard you always show
humility and concern. Thanks a lot sir. You are our mentor.
Usman Imran
The user didn't write a review, and has left just a rating.
Kashif Ahmed
A wonderful human being and an excellent teacher of O and A levels. Who have very vast experience of
syedrayyan
Sir inqilab Patel is a very dedicated and determined teacher.... the only teach from whom I could talk frankly
....❤❤ The best teacher I met ❤❤ I wish he succeeds in this life and hereafter.
Syed TahirRaza
An extra ordinary teacher , an excellent educationist , a truly legend and my computer science guru
Mr.InqilabPatail. I would highly recommend to join him to excel in computing knowledge and grades.
Raaed Ali
Sir Inqilab has been a great teacher and is very qualified in his profession. To say that he is a
good teacher would ... More
SadafYousuf
SobiaZeeshan
HammadAsif
ZarafshanJabeen
WaheedAslam
block gamer
Syed Alay
Om Jagdish
"""The best teacher in town... "" this dialogue you might have heard for every teacher but believe me this
dialogue suits. """" Sir Inqilab Patel """""" Gives you worksheets (absolutely free). Plans many different N difficult
test, clears your doubt any time you want.. This teacher has a separate fan base.. Have troubled him so many
times but this teacher has always corrected me. . ¤ Matlabyr teacher best hai at the end..¤ Thanks sir. . P.S---:
Aur sorry jitnabhiaapko tang kiya. . Peecheye class meinaawazeinnikalneye se late class meinaaneyetak..
+++++++++ SORRY
Page | 18
YousufShahzad
The best teacher of computer science I've had so far. Sir Inqilab teaches with immense dedication and has such
an abundance of knowledge that anybody will be awed by him in matter of days. Looking forward to more years
Umar Zubairi
Sir Inqilab is the best computer science teacher I have ever got , thank you sir for teaching us so well
Munawar Khan
One of the most dedicated and Excellent teacher I have ever met... My mentor and inspiration... Sir Inqilab Patel
poolite
Page | 19
Database
Practical Problem-solving and Programming
Page | 20
Chapter 14
Database
2.3 Database
• definea single-table database from given data storage requirements
• choose and specify suitable data types
• choose a suitable primary key for a database table
• perform a query-by-example from given search criteria
The collected information could be in any number of formats (electronic, printed, graphic, audio,
statistical, combinations). There are physical (paper/print) and electronic databases.
Examples:
phone book
address book
Census Bureau data
Database record
Data in a database table is organised into rows (records) and columns (fields). Each record in a
relational database table corresponds to an entity. In the example table of 'Students' above there
are 5 records. Each record corresponds to an individual student. Note that although there are two
students called Philip Barker with the same date of birth, they have different Student IDs and are
different students.
Database field
An attribute is a piece of information or a characteristic of an entity. Attributes of entities are
represented in database tables by fields (columns). A field stores one item of data for a record. In
the table above, each student is represented in the relational database by a record and the
student attributes are stored in the following fields:
Student ID
Forename
Surname
Date of Birth
Fields have the following characteristics:
Each field in a table has a unique name. Note, however, that the same field name can occur in
other tables of the same relational database.
Each field stores a single item of data - For example, a field called Date of Birth would store no
more than one date of birth value.
Each field has a particular data type – for example, text, Boolean, integer, date/time, etc.
Each field can have its own validation rules - these ensure that data recorded in the field is of the
right type and format.
Page | 22
Data types
Different data types are identified so that a computer can store and process the data appropriately.
Data types include:
text (or string)
number (numeric) may include:
o Auto number
o Currency
date/time
Boolean (or Yes/No).
Primary Keys
Each table has a primary key. This is a field chosen so that it can uniquely identify each record.
Sometimes an existing attribute can be used because it is unique but most of the time some sort
of ID is created. Primary keys can be used to link to foreign keys in other tables. A foreign key is
the primary key in a different table and it is not necessarily unique.
Example Question:
A picture gallery owner has decided to set up a database to keep information about the pictures he
has for sale. The database table, PICTURE, will contain the following fields:
Title; Artist; Description; Catalogue Number; Size (area in square centimeters); Price; Arrived (date
picture arrived at gallery); Sold (whether picture is already sold)
(a) (i) State what data type you would choose for each field.
Title: ....................................................................................................................................................
Artist: ..................................................................................................................................................
Description: ........................................................................................................................................
Catalogue Number: ............................................................................................................................
Size: ...................................................................................................................................................
Price: ..................................................................................................................................................
Arrived: ...............................................................................................................................................
Sold: ..............................................................................................................................................[4]
(ii) State which field you would choose for the primary key
………………………………………………………………………………...........................................[1]
Page | 23
Query
The prime function of a relational database is to store data in an organised way so that users can
interrogate (search) and manipulate (sort) the data. The interrogation of a database is called
querying the database and a question used to interrogate the data is called a query.
Query by Example (QBE) is a database query language for relational databases. It was devised
by Moshé M. Zloof at IBM Research during the mid-1970s, in parallel to the development of SQL.
It is the first graphical query language, using visual tables where the user would enter commands,
example elements and conditions.
Databaseuser-interface in which the user fills out a form to retrieve data. The database makes the
search on the basis of the example(s) provided by the user.
The query to find students in form 10B
A complex query looks for data in two or more fields and uses the logical operators OR, AND or
NOT.
The following example uses a complex query to find all of the pupils in Form 10B who were born
before 1995. This query uses the logical operator AND:
(Form = “10B”) AND (Date of Birth < 01/01/1995).
Operators can be used to refine search results.
Operator Meaning
= Equals
The query design is shown below. Note that this time there are two entries in the search criteria
Page | 24
row Also note that this time the query has been given a meaningful name (“Select Query –
Pupils in 10B born before 1995”). This saves other database users from unnecessarily creating
the same query.
Below is a new complex query that uses the logical operator OR to find pupils who are in Form
10A or Form 10C: (Form = “10A” OR “Form = “10C”) this time, in the query definition there will be
two criteria lines. The query and its results are shown below:
Wildcards in Queries
Wildcard characters can be used in database queries. For example you may want a list of all
pupils born in November, or all of the pupils whose surname starts with a ‘C’. Wildcard searches
allow you to specify the part of the data that you know and leave the data handling software to fill
in the blanks.
Surname Like “C*” would find all records where the surname begins with a C.
Page | 25
Quick Revision Questions:
Q 1) Define following terms:
Database: ...........................................................................................................................................
............................................................................................................................................................
Entity: .................................................................................................................................................
............................................................................................................................................................
Table: .................................................................................................................................................
............................................................................................................................................................
Field/ Attribute: ..................................................................................................................................
............................................................................................................................................................
Record/Tupple: ...................................................................................................................................
............................................................................................................................................................
Primary Key: ......................................................................................................................................
...........................................................................................................................................................
Query: ................................................................................................................................................
............................................................................................................................................................
Q 2) Describe benefits of using database.
............................................................................................................................................................
............................................................................................................................................................
...................................................................................................................................................... [2]
Winter 2015 P21 & 22
Q 3) A picture gallery owner has decided to set up a database to keep information about the
pictures he has for sale. The database table, PICTURE, will contain the following fields:
Title; Artist; Description; Catalogue Number; Size (area in square centimetres); Price; Arrived (date
picture arrived at gallery); Sold (whether picture is already sold)
(a) (i) State what data type you would choose for each field.
Title .....................................................................................................................................................
Artist ..................................................................................................................................................
Description ........................................................................................................................................
Catalogue Number ............................................................................................................................
Size ...................................................................................................................................................
Price ..................................................................................................................................................
Arrived ...............................................................................................................................................
Sold ............................................................................................................................................... [4]
(ii) State which field you would choose for the primary key.
....................................................................................................................................................... [1]
Page | 26
(b) Give a validation check that you can perform on each of these fields. Each validation check
must be different.
Catalogue Number ............................................................................................................................
Size ....................................................................................................................................................
Price ...................................................................................................................................................
Arrived ............................................................................................................................................[4]
(c) Complete the query-by-example grid below to select and show the Catalogue Number, Title
and Price of all unsold pictures by the artist ‘Twister’.
Q 6) A survey of motorways was carried out and a database table MOTORWAYS was produced.
(a) How many fields and how many records are shown?
(i) number of fields .............................................................................................................................
(ii) number of records .................................................................................................................... [2]
(b) Suggest a field which can be used as primary key and justify your answer.
............................................................................................................................................................
...................................................................................................................................................... [2]
(b) Complete the query-by-example grid below to show Motorway ID and Lanes if the following
search condition was used? (Length (km) > 100) AND (Number of lanes > 3)
7 A database ELEMENTS was set up to show the properties of certain chemical elements. Part of
the database is shown below.
6 A database, MARKS, was set up to record the test results for a class of students. Part of the
database is shown below.
(d) Complete the query-by-example grid below to select and show the student names only of all
students with less than 40 marks in both Maths and English. [3]
(b) Give a validation check that you can perform on each of these fields. Each validation check
must be different.
Catalogue Number ............................................................................................................................
Size ....................................................................................................................................................
Price ...................................................................................................................................................
Arrived ............................................................................................................................................[4]
(c) Complete the query-by-example grid below to select and show the Catalogue Number, Title
and Price of all unsold pictures by the artist ‘Twister’.
(c) Complete the query-by-example grid below to select and show the Boat Name, Model and Day
Price of a day’s hire for all boats with 4 seats and an Engine Power of more than 100 hp.
Page | 42
14.14 Summer 2016 P21 &P23
6 A database, STAFFPHONE, was set up to show the telephone extension numbers for members
of staff working in a department store.
Name Department Extension number
Jane Smith Toys 129
Sue Wong Books 124
David Chow Toys 129
Amy Tang Household 123
Joe Higgs Books 124
Jane Smith Shoes 125
Adel Abur Shoes 125
Peter Patel Toys 129
(a) Explain why none of the fields in the database can be used as a primary key.
............................................................................................................................................................
............................................................................................................................................................
........................................................................................................................................................[2]
(b) State a field that could be added as a primary key.
...........................................................................................................................................................
Give a reason for choosing this field.
............................................................................................................................................................
...................................................................................................................................................... [2]
(c) Use the query-by-example grid below to provide a list of all members of staff, in alphabetical
order, grouped by department. [5]
Page | 43
14.15 Summer 2016 P22
7 A database, SOFASELECT, was set up to show the prices of suites, sofas and chairs for sale from an
online furniture warehouse. Part of the database is shown below.
......................................................................................................................................[1]
(b) State which field you would choose for the primary key.
...........................................................................................................................................................................
Give a reason for choosing this field.
...........................................................................................................................................................................
.......................................................................................................................................................................[2]
(c) State the data type you would choose for each of the following fields.
Number of Seats ..............................................................................................................
Price in $ ......................................................................................................................[2]
(d) The query-by-example grid below selects all the furniture in cream leather.
Field
Table
Sort
Show:
Criteria
or
Page | 45
(c) The query-by-example grid below selects all the productions with more than 100 seats left in
either the stalls or the circle.
(b) Complete the query-by-example grid below to select all Desktop devices that were either
purchased before 31/12/2016 or cost under $1000. Only show the Device ID and DeviceType.
Page | 48
14.19 Summer 2017 P21
7 A television (TV) store has a database table, TVSTOCK, for its new range of televisions. The
table stores the screen size of each TV, whether it will show 3D, whether the screen is curved or
flat, if the internet is available on the TV, if it has a built-in hard disk drive and the price. Part of the
database table is shown below.
5 A database table, SHEEP, is used to keep a record of the sheep on a farm. Each sheep has a
unique ear tag, EARnnnn; n is a single digit. The farmer keeps a record of the date of birth, the
gender and the current weight of each sheep in kilograms.
(a) Identify the four fields required for the database. Give each field a suitable name and data
type. Provide a sample of data that you could expect to see in the field. [8]
Field 1 name.......................................................................................................................................
Data type ............................................................................................................................................
Data sample .......................................................................................................................................
Field 2 name........................................................................................................................................
Data type ............................................................................................................................................
Data sample .......................................................................................................................................
Field 3 name........................................................................................................................................
Data type ............................................................................................................................................
Data sample .......................................................................................................................................
Field 4 name.......................................................................................................................................
Data type ...........................................................................................................................................
Data sample ......................................................................................................................................
(b) State the field that you would choose as the primary key.
......................................................................................................................................................[1]
(c) Using the query-by-example grid below, write a query to identify the ear tags of all male sheep
weighing over 10 kilograms. Only display the ear tags. [3]
Page | 50
14.21 Winter 2017 P21
6 A wildlife park has a database table, called LIVESTOCK, to classify and record its animal
species. Part of the database table is shown.
Species Classification Diet Legs
Giraffe Mammal Herbivore 4
Elephant Mammal Herbivore 4
Crocodile Reptile Carnivore 4
Ostrich Bird Omnivore 2
Gorilla Mammal Herbivore 2
Bear Mammal Omnivore 4
Rhinoceros Mammal Herbivore 4
Hippopotamus Mammal Herbivore 4
Flamingo Bird Omnivore 2
Lion Mammal Carnivore 4
Turtle Reptile Omnivore 4
Penguin Bird Carnivore 2
(a) Suggest another appropriate field that could be added to this database by stating its name and
data type. State its purpose and give an example of the data it could contain.
Field name ................................................................................................................................
Data Type .................................................................................................................................
Purpose ....................................................................................................................................
...................................................................................................................................................
Example of data ...................................................................................................................[2]
(b) Use the query-by-example grid below to provide a list of all four legged mammals that are
herbivores, sorted alphabetically by species, with only the species displayed.
Page | 51
14.22 Winter 2017 P22
6 A database table, TRAIN, is to be set up for a railway company to keep a record of the engines
available for use. Each engine has a unique number made up of 5 digits, nnnnn. The engines are
classified as freight (F) or passenger (P) together with a power classification that is a whole
number between 0 and 9, for example F8. The railway company keeps a record of the date of the
last service for each engine.
(a) Identify the three fields required for the database. Give each field a suitable name and data
type. Provide a sample of data that you could expect to see in the field.
Field 1 Name ............................................................................................................................
Data type ..................................................................................................................................
Data sample .............................................................................................................................
Field 2 Name ............................................................................................................................
Data type ..................................................................................................................................
Data sample .............................................................................................................................
Field 3 Name ............................................................................................................................
Data type ..................................................................................................................................
Data sample .........................................................................................................................[6]
(b) State the field that you should choose as the primary key.
...............................................................................................................................................[1]
(c) Using the query-by-example grid below, write a query to identify all passenger engines that
have not been serviced in the past 12 months. Only display the engine numbers. [3]
Page | 52
14.23 March 2018 P22 (India)
6 A database table, JEWEL, is used to keep a record of jewellery for sale in a shop. Each item of
jewellery can be made of silver, platinum or gold metal. The shop stocks rings, bracelets and
necklaces. The number in stock and the price is also stored.
(a) Identify the four fields required for the database. Give each field a suitable name and data
type. Explain why you chose the data type for each field.
Comments on Question 6
(a) Nearly all candidates identified some appropriate fields and could also provide a suitable data
type and explanation. Many candidates provided excellent answers worth full marks.
(b) Nearly all candidates gave a correct explanation as to why none of the fields were suitable use
as a primary key.
(c) Nearly all candidates correctly identified the fields required in the query-by-example grid. Most
candidates correctly identified which fields to show. Many candidates provided suitable criteria
to identify that only details of silver bracelets were required.
Page | 53
14.24Summer 2018 P21
6 A database table, PERFORMANCE, is used to keep a record of the performances at a local
theatre.
Show Sold
Type Title Date
Number Out
SN091 Comedy An Evening at Home 01 Sept Yes
SN102 Drama Old Places 02 Oct No
SN113 Jazz Acoustic Evening 03 Nov No
SN124 Classical Mozart Evening 04 Dec Yes
SN021 Classical Bach Favourites 01 Feb Yes
SN032 Jazz 30 Years of Jazz 02 Mar Yes
SN043 Comedy Street Night 03 Apr No
SN054 Comedy Hoot 04 May No
(b) Give two validation checks that could be performed on the Show Number field.
Validation check 1 .....................................................................................................................
...................................................................................................................................................
Validation check 2 .....................................................................................................................
............................................................................................................................................... [2]
(c) Using the query-by-example grid, write a query to identify jazz performances that are not sold
out. Only display the date and the title. [4]
Page | 54
14.25Summer 2018 P21
6 A database table, TREES, is used to keep a record of the trees in a park. Each tree is given a
unique number and is examined to see if it is at risk of dying. There are over 900 trees; part of the
database table is shown.
Tree
Type Map Position Age in Years At Risk
Number
TN091 Acacia A7 250 Y
TN172 Olive C5 110 N
TN913 Cedar B9 8 N
TN824 Banyan A3 50 Y
TN021 Pine D5 560 Y
TN532 Teak C8 76 Y
TN043 Yew B1 340 N
TN354 Spruce D4 65 N
TN731 Elm B10 22 Y
TN869 Oak C9 13 N
TN954 Pine E11 3 N
(a) State the number of fields in the table.
...............................................................................................................................................[1]
(b) The tree numbering system uses TN followed by three digits. The numbering system will not
work if there are over 1000 trees.
Describe, with the aid of an example, how you could change the tree numbering system to allow
for over 1000 trees. Existing tree numbers must not be changed.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
......................................................................................................................................................[2]
(c) Using the query-by-example grid, write a query to identify at risk trees over 100 years old.
Display only the type and the position on the map. [4]
Page | 55
14.26 Winter 2018 P21
6 A database table, PORTRAIT, is used to keep a record of the portraits available from a
photographic studio. Each portrait has a unique reference number PICnnn, where n is a single
digit, for examplePIC123. The studio keeps a record of the size (for example 20 × 15), the type
(black and white or colour), and the price in dollars.
(a) Complete the table to show the most appropriate data type for each of the fields.[4]
Field Data type
Reference Number
Size
Type
Price in $
(b) The results from the query-by-example grid should show the reference number, price, type
and size of all portraits under $50. Identify the three errors in the query-by-example grid.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
.....................................................................................................................................................[4]
(d) Using the following query-by-example grid, write a query to identify all types of the fruit trees
that are out of stock for all three sizes. Make sure the type of the tree and the various ‘in stock’
fields are shown. The trees should be listed in alphabetical order by type.
Field:
Table:
Sort:
Show:
Criteria:
or:
Page | 58
14.28 March 2019 P22
6 A database table, BIKETYRES, is used to keep a record of tyres for sale in a cycle shop.
Tyres are categorised by width and diameter in millimetres, whether they have an inner tube and
the type of terrain for which they are designed.
Tyre Code Width Diameter Tube Terrain Stock Level
SLTT 23 700 YES Asphalt 18
MLNT 24 700 NO Asphalt 23
LLNT 28 700 NO Asphalt 19
SLTM 23 700 YES Mixed 22
MLTM 24 700 YES Mixed 14
LLTM 28 700 YES Mixed 12
SLTH 23 700 YES Hard 10
MLTH 24 700 YES Hard 5
LLNH 28 700 NO Hard 7
SLNM 23 700 NO Mixed 12
MLNM 24 700 NO Mixed 22
LLNM 28 700 NO Mixed 18
SSNT 23 650 NO Asphalt 10
MSNT 24 650 NO Asphalt 8
SSTM 23 650 YES Mixed 5
MSNM 24 650 NO Mixed 4
The query-by-example grid below displays the tyre code and the stock level of all 28mm widthtyres
suitable for mixed terrain.
Field: Tyre Code Stock Level Width Terrain
Table: BYKETYRES BYKETYRES BYKETYRES BYKETYRES
Sort:
Show:
Criteria: =28 =’Mixed’
or:
Alter the query to show the tyre code and stock level in ascending order of stock level for all
24mm asphalt terrain tyres. Write the new query in the following query-by-example grid.
Field:
Table:
Sort:
Show:
Criteria:
or:
Page | 59
14.29 Summer 2019 P21
5 The table, BEVERAGES, shows the number of calories in 100ml of a range of popular
beverages. It also shows the availability of these drinks in a can, a small bottle and a large bottle.
Calorie Ca Small Large
BevNo BevName
s n Bottle Bottle
Bev01 Cola 40 Yes Yes Yes
Bev02 Lime 45 Yes No Yes
Bev03 Energy Drink 1 52 Yes Yes No
Bev04 Energy Drink 2 43 Yes No No
Bev05 Mango 47 Yes No Yes
Bev06 Lemon Iced Tea 38 Yes No Yes
Bev07 Lemonade 58 Yes Yes Yes
Bev08 Orange Juice 46 Yes Yes No
Bev12 Apple Juice 50 Yes Yes No
Bev15 Chocolate Milk 83 Yes Yes No
(a) Give a reason for choosing BevNo as the primary key for this table.
...................................................................................................................................................
............................................................................................................................................. [1]
(b) State the number of records shown in the table BEVERAGES.
............................................................................................................................................. [1]
(c) List the output that would be given by this query-by-example.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
Page | 60
(d) Complete the query-by-example grid to output a list showing just the names and primary keys
of all the beverages with a calorie count greater than 45. The list should be in alphabetical
order of names. [4]
Field:
Table:
Sort:
Show:
Criteria:
or:
Page | 61
14.30 Summer 2019 P22
6 A database table, FLIGHT, is used to keep a record of flights from a small airfield. Planes can
carry passengers, freight or both. Some flights are marked as private and only carry passengers.
Departure
Flight number Plane Notes Passengers
time
FN101 Caravan 1 Private passenger flight 08:00 Y
CN101 Caravan 2 Freight only 08:30 N
CN102 Piper 1 Freight only 09:00 N
FN104 Piper 2 Passengers only 09:20 Y
FN105 Piper 1 Freight and passengers 10:00 Y
FN106 Caravan 1 Passengers only 10:30 Y
CN108 Caravan 2 Freight only 08:00 N
CN110 Lear Private passenger flight 08:00 Y
(a) State the field that could have a Boolean data type.
Field .................................................................................................................................... [1]
(b) A query-by-example has been written to display just the flight numbers of all planes leaving
after 10:00 that only carry passengers.
Field: Departure
Flight number Passengers
time
Table: FLIGHT FLIGHT FLIGHT
Sort:
Show:
Criteria: =Y = 10:00
or:
Explain why the query-by-example is incorrect, and write a correct query-by-example. [7]
Explanation .........................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
Field:
Table:
Sort:
Show:
Criteria:
or:
Page | 62