Databases and SQL – A Level Computer Science (old syllabus, to 2021) (9608)
12 questions · Clear filters
Question text
7
A driving school teaches people how to drive cars. The school has a relational database,
DRIVING_SCHOOL, to store information about instructors, students, lessons and the cars used by
instructors.
INSTRUCTOR(InstructorID, FirstName, LastName, DateOfBirth, Level)
CAR(Registration, Make, Model, EngineSize)
INSTRUCTOR_CAR(InstructorID, Registration)
STUDENT(StudentID, FirstName, LastName, DateOfBirth, Address1)
LESSON(LessonID, StudentID, InstructorID, LessonDate, LessonTime)
(a) Give two benefits to the driving school of using a relational database instead of a flat file.
1 …
…
2 …
…
[2]
(b) Complete the entity-relationship diagram for the database DRIVING_SCHOOL.
INSTRUCTOR
INSTRUCTOR_CAR
CAR
LESSON
STUDENT
[4]
(c) The table shows some sample data for the table INSTRUCTOR.
InstructorID
FirstName
LastName
DateOfBirth
Level
Ins01
Jayden
Han
05/06/1974
1
Ins02
Freda
Choi
06/02/1978
2
Ins03
Kelly
Kim
01/12/1966
1
Ins04
Santana
Thompson
09/09/1985
3
Complete the Data Definition Language (DDL) statement to create the table INSTRUCTOR.
… TABLE INSTRUCTOR(
InstructorID VARCHAR(5),
FirstName VARCHAR(15),
LastName VARCHAR(15),
DateOfBirth DATE,
Level … ,
… (InstructorID)
);
[3]
(d) The table STUDENT needs an additional field to store the student’s telephone number, for
example 012-3456.
Write a Data Definition Language (DDL) statement to add the new field to the table STUDENT.
…
…
…
… [2]
(e) Write a Data Manipulation Language (DML) statement to return the date and time of all future
lessons booked with the instructor whose InstructorID is Ins01.
…
…
…
…
…
…
… [4]
Question text
6
A software development company has a relational database, SOFTWARE_MANAGEMENT. The
database stores details of the customers who have purchased software, as well as the software
and licences that customers have purchased.
The SOFTWARE_MANAGEMENT database has the following tables:
CUSTOMER_DETAILS(CustomerID, CompanyName, Address1, Address2, City)
SOFTWARE_PURCHASED( SoftwareName, SoftwareDescription, CustomerID,
LicenceType, LicenceCost, RenewalDate)
(a) Explain why this database is not in Third Normal Form (3NF). Refer to the tables in your
answer.
Do not attempt to normalise the tables.
…
…
…
…
…
… [2]
(b) Give an example from the database SOFTWARE_MANAGEMENT for each of the following
database terms.
Term
Example
Entity
Foreign key
Attribute
[3]
(c) The company also develops computer games. They extend the relational database
SOFTWARE_MANAGEMENT by adding a new table. The new table, GAME_DEVELOPMENT,
stores details about the games and the software development teams creating them.
The table shows example data in GAME_DEVELOPMENT.
GameName
Genre
TeamNumber
DevelopmentStage
ManagerID
Bunny Hop
Platform
4
Analysis
23KP
Fried Eggs
Retro
2
Programming stage 1
9RTU
Create‑a‑game
Action
1
Acceptance testing
11TF
(i)
Complete the Data Definition Language (DDL) statement to create the table
GAME_DEVELOPMENT.
CREATE …
… (
GameName VarChar,
Genre VarChar,
…
… ,
DevelopmentStage VarChar,
ManagerID VarChar,
… (GameName)
);
[5]
(ii)
Another table, PRODUCT_MANAGER, is created.
PRODUCT_MANAGER(ManagerID, FirstName, LastName)
Complete the Data Manipulation Language (DML) statement to return the game name,
genre and team number of all games managed by the product manager with the first
name ‘James’ and the last name ‘Fitz’.
… GameName, Genre, TeamNumber
FROM GAME_DEVELOPMENT, PRODUCT_MANAGER
WHERE PRODUCT_MANAGER.FirstName = "James"
AND PRODUCT_MANAGER.LastName = "Fitz"
AND …
= … ;
[3]
Question text
6
Sheila creates a relational database for her hotel using a Database Management System (DBMS).
(a) Draw one line from each database term to its most appropriate description.
Database Term
Description
A field in one table that links to a primary key in another table
Primary key
A collection of records and fields
Attribute
The type of data that is being stored
A unique identifier for each tuple
Foreign key
A data item, represented as a field within a table
Entity
The concept or object in the system that we want to model
and store information about
[4]
(b) Identify three tasks that Sheila can perform using the DBMS developer interface.
1 …
2 …
3 …
[3]
(c) Sheila creates the database HOTEL with the following table structure:
ROOM(RoomNumber, RoomType)
BOOKING(BookingID, RoomNumber, CustomerID, StartDate)
CUSTOMER(CustomerID, FirstName, LastName, Address, Tel_Num)
(i)
The following table shows some sample data for the table ROOM.
RoomNumber
RoomType
1
Standard
2
Double
3
Executive
4
Standard
Complete the Data Definition Language (DDL) statement to create the table ROOM.
… TABLE ROOM(
RoomNumber Integer,
RoomType … ,
… (RoomNumber)
);
[3]
(ii)
Room number 5 is a Double room.
Complete the Data Manipulation Language (DML) statement to add the details for room
number 5 to the table ROOM.
INSERT … ROOM
VALUES( … );
[2]
(iii)
The table BOOKING needs an additional field to store the number of nights (for example,
3) a customer is staying.
Write a Data Definition Language (DDL) statement to add the new field to the table
BOOKING.
…
…
…
…
… [2]
Question text
2
A software company produces software and distributes it under different software licences.
(a) Four descriptions of software licences are given.
Write the type of software licence that best fits each description. Use a different type of licence
for each description.
1. The software can be legally used, only after a fee has been paid.
Licence type …
2. The source code comes with the software. If the software is modified, the edited source
code must be released under the same conditions as the original software.
Licence type …
3. The software is free for a trial period and then a fee is requested, or expected, if the user
wants to continue to use the software.
Licence type …
4. The source code comes with the software. The software is free to be downloaded, edited,
and distributed, possibly without restriction.
Licence type …
[4]
(b) The software company stores information about customers and the software licences they
have purchased. The company considers a file-based approach for the storage and retrieval
of data.
(i)
Give three limitations of a file-based approach to store the data.
1 …
…
2 …
…
3 …
…
[3]
(ii)
The software company decides to use a database to overcome the limitations of a
file-based system. Some of these limitations are addressed through the logical schema.
Name and describe two levels of the schema of a database.
Name 1 …
Description …
…
Name 2 …
Description …
…
[4]
(c) The database has the following tables:
CUSTOMER(CustomerID, CompanyName)
SOFTWARE(SoftwareID, SoftwareName, OperatingSystem, Description)
LICENCE( LicenceID, CustomerID, SoftwareID, DateOfPurchase,
LicenceType, Cost, ExpiryDate)
(i)
Identify the type of relationship that exists between the tables CUSTOMER and LICENCE.
…
…
Question text
5
Moheem is creating a relational database to store data about his customers.
(a) Moheem has been told a relational database addresses some of the limitations of a file-based
approach by reducing data redundancy.
(i)
State what is meant by the term data redundancy.
…
… [1]
(ii)
Explain how a relational database can help to reduce data redundancy.
…
…
…
…
…
… [3]
(b) Moheem uses a Database Management System (DBMS) to ensure the security and integrity
of the data.
(i)
Explain the difference between security and integrity.
…
…
…
… [2]
(ii)
Name and describe two security features provided by a DBMS.
Feature 1 …
…
…
…
Feature 2 …
…
…
…
[4]
(iii)
The DBMS provides software tools for the database developer.
Fill in the names of the missing software tools in the following statements.
A … allows a developer to extract data from a
database.
A … enables a developer to create user-friendly
forms and reports.
[2]
Question text
3
A company uses a relational database, EMPLOYEES, to store data about its employees and
departments.
(a) The company uses a Database Management System (DBMS).
(i)
The DBMS has a data dictionary.
Describe what the data dictionary stores.
…
…
…
… [2]
(ii)
The DBMS has a query processor.
Describe the purpose of a query processor.
…
…
…
… [2]
(b) Relationships are created between tables using primary and foreign keys.
Describe the role of a primary and a foreign key in database relationships.
…
…
…
… [2]
(c) In the company:
•
An employee can be a manager.
•
A department can have several managers and several employees.
•
An employee can only belong to one department.
The EMPLOYEES database has three tables:
EMPLOYEE_DATA( EmployeeID, FirstName, LastName, DateOfBirth, Gender,
DepartmentNumber)
DEPARTMENT(DepartmentNumber, DepartmentName)
DEPARTMENT_MANAGER(DepartmentNumber, EmployeeID, role)
Complete the entity-relationship (E-R) diagram for the EMPLOYEES database.
EMPLOYEE_DATA
DEPARTMENT_MANAGER
DEPARTMENT
[3]
(d) Give three reasons why the EMPLOYEES database is fully normalised.
1 …
…
2 …
…
3 …
…
[3]
(e) Part of the EMPLOYEE_DATA table is shown.
EmployeeID
FirstName
LastName
DateOfBirth
Gender
DepartmentNumber
156FJEK
Harvey
Kim
12/05/1984
Male
S1
558RRKL
Catriona
Moore
03/03/1978
Female
F2
388LMDV
Oscar
Ciao
01/01/1987
Male
F2
(i)
Write a Data Definition Language (DDL) statement to create the EMPLOYE
Question text
7
A social media website has a relational database, WEBDATA, that stores the site’s information.
The database has three tables to store users’ details, and details of the images and text that they
post.
USER(UserName, FirstName, SecondName, DateOfBirth)
PHOTO(PhotoID, UserName, Comment, UploadDate)
TEXTPOST(PostID, UserName, DateOfPost, TheText)
(a) (i)
Explain how the relationship between the tables USER and PHOTO has been implemented.
…
…
…
… [2]
(ii)
Draw the entity-relationship (E-R) diagram to show the relationships between the three
tables.
[2]
(b) A database administrator decides to enforce referential integrity.
Use an example from the database WEBDATA to explain what is meant by referential
integrity.
…
…
…
…
…
… [3]
(c) The database has been normalised to Third Normal Form (3NF).
Define the three stages of database normalisation.
1NF …
…
2NF …
…
3NF …
…
[3]
(d) The following shows sample data from the USER table.
UserName
FirstName
SecondName
DateOfBirth
gem123
John
Smith
01/01/1995
purpleSky
Muhammed
Ali
23/02/1956
OpenWindow
Sunny
Amir
03/03/1997
bluebird127
Raziya
Bello
04/03/1982
(i)
Write an SQL script to create the USER table.
…
…
…
…
Question text
2
A company writes applications (apps) for smartphones. The company has a relational database,
PURPLEGAME, which stores the information for one of its online game apps.
The database has three tables to store player’s details, dates when they have logged into the app
and in-app purchase details.
LOGIN(LoginID, PlayerID, Date)
PURCHASE(PurchaseID, PlayerID, PurchaseDate, Cost)
PLAYER(PlayerID, PlayerName, SkillLevel)
(a) Draw the entity-relationship (E-R) diagram to show the relationships between the three tables.
[2]
(b) The database manager is concerned about data integrity.
State what is meant by data integrity. Give an example of how the manager can ensure data
integrity in the PURPLEGAME database.
…
…
…
… [2]
(c) The database designer states that the PURPLEGAME database is in Third Normal Form (3NF).
Tick (3) one box to indicate whether this statement is true or false.
True
False
Justify your choice.
…
…
…
…
…
… [3]
(d) (i)
The following table shows some sample data for the PLAYER table.
PlayerID
PlayerName
SkillLevel
fly918
Kylie
3
elephant11
Mehrdad
9
candy22
Suzi
15
greenGrass
Jason
22
Write an SQL script to create the PLAYER table.
…
…
…
…
…
…
…
…
…
…
Question text
1
A hospital is divided into two areas, Area A and Area B. Each area has several wards. All the ward
names are different.
A number of nurses are based in Area A. These nurses always work on the same ward. Each
nurse has a unique Nurse ID of STRING data type.
A-NURSE
A-WARD
(a) Describe the relationship shown above.
…
… [1]
(b) A relational database is created to store the ward and nurse data. The two table designs for
Area A are:
A-WARD(WardName, NumberOfBeds)
A-NURSE(NurseID, FirstName, FamilyName, … )
(i)
Complete the design for the A-NURSE table.
[1]
(ii)
Explain how the relationship in part (a) is implemented.
…
…
…
… [2]
(c) In Area B of the hospital, there are a number of wards and a number of nurses.
Each Area B ward has a specialism.
Each Area B nurse has a specialism.
A nurse can be asked to work in any of the Area B wards where their specialism matches with
the ward specialism.
The relationship for Area B of the hospital is:
B-NURSE
B-WARD
(i)
Explain what the degree of relationship is between the entities B-NURSE and B-WARD.
…
… [1]
(ii)
The design for the Area B data is as follows:
B-NURSE(NurseID, FirstName, FamilyName, Specialism)
B-WARD(WardName, NumberOfBeds, Specialism)
B-WARD-NURSE( … )
Complete the attributes for the third table. Underline its primary key.
[2]
(iii)
Draw the relationships on the entity-relationship (E-R) diagram.
B-NURSE
B-WARD
B-WARD-NURSE
[2]
(d) Use the table designs in part (c)(ii).
(i)
Write an SQL query to display the Nurse ID and family name for all Area B nurses with a
specialism of ‘THEATRE’.
…
…
… [3]
(ii)
Fatima Woo is an Area B nurse with the nurse ID of 076. She has recently married, and
her new family name is Chi.
Write an SQL command to update her record.
UPDATE …
SET …
WHERE …
[3]
Question text
1
Some shops belong to the Rainbow Retail buying group. They buy their goods from one or more
suppliers.
Each shop has:
•
a unique shop ID
•
a single retail specialism (for example, food, electrical, garden).
Each supplier has:
•
a unique supplier ID
•
a similar single specialism recorded.
Rainbow Retail creates a relational database to record data about the shops and their suppliers.
The entity-relationship (E-R) diagram for the relationship between the SHOP and SUPPLIER tables
is shown.
SHOP
SUPPLIER
(a) Explain what the degree of relationship is between the entities SHOP and SUPPLIER.
…
… [1]
The database design is as follows:
SHOP(ShopID, ShopName, Location, RetailSpecialism)
SUPPLIER(SupplierID, SupplierName, ContactPerson, RetailSpecialism)
SHOP-SUPPLIER(ShopID, SupplierID)
The SHOP–SUPPLIER table stores the suppliers that each shop has previously used.
Primary keys are not shown.
(b) (i)
Label the entities and draw the relationships to complete the revised E-R diagram.
SUPPLIER
[3]
(ii)
Complete the following table to show for each database table:
•
the primary key
•
the foreign key(s) (if any):
° Each table may contain none, one or more foreign key(s).
° For a table with no foreign key, write ‘None’.
•
an explanation for the use of any foreign key.
Table
Primary key
Foreign key(s)
Explanation
(if any)
SHOP
SUPPLIER
SHOP–SUPPLIER
[5]
(iii)
The database designer has implemented SUPPLIER.ContactPerson as a secondary
key.
Describe the reason for this.
…
…
…
… [2]
(c) (i)
Write an SQL query to display the shop ID and location of all shops with a ‘GROCERY’
specialism.
…
…
… [3]
(ii)
The existing shop with ID 8765 has just used the existing supplier SUP89 for the first
time.
Write an SQL script to add this data to the database.
…
…
… [3]
Question text
8
A school stores a large amount of data. This includes student attendance, qualification, and
contact details. The school’s software uses a file-based approach to store this data.
(a) The school is considering changing to a DBMS.
(i)
State what DBMS stands for.
… [1]
(ii)
Describe two ways in which the Database Administrator (DBA) could use the DBMS
software to ensure the security of the student data.
1 …
…
…
…
2 …
…
…
… [4]
(iii)
A feature of the DBMS software is a query processor.
Describe how the school secretary could use this software.
…
…
…
… [2]
(iv)
The DBMS has replaced software that used a file-based approach with a relational
database.
Describe how using a relational database has overcome the previous problems
associated with a file-based approach.
…
…
…
… [3]
(b) The database design has three tables to store the classes that students attend.
STUDENT(StudentID, FirstName, LastName, Year, TutorGroup)
CLASS(ClassID, Subject)
CLASS-GROUP(StudentID, ClassID)
Primary keys are not shown.
There is a one-to-many relationship between CLASS and CLASS–GROUP.
(i)
Describe how this relationship is implemented.
…
…
… [2]
Describe the relationship between CLASS-GROUP and STUDENT.
(ii)
…
Question text
5
(a) A Database Management System (DBMS) provides the following features.
Draw a line to match each feature with its description.
Feature
Description
A file or table containing all the details of the
database design
Data dictionary
Data design features to ensure the validity
of data in the database
Data security
A model of what the database will look like,
although it may not be stored in this way
Data integrity
Methods of protecting the data including
the uses of passwords and different access
rights for different users of the database
[3]
A school stores a large amount of data that includes student attendance, qualification and contact
details. The school is setting up a relational database to store these data.
(b) The school needs to safeguard against any data loss.
Describe three factors to consider when planning a backup procedure for the data.
Justify your decisions.
1 …
…
…
2 …
…
…
3 …
…
… [6]
(c) The database design has three tables to store the qualifications and grades each student has
attained. The following is a sample of the data from each table.
STUDENT
StudentID
FirstName
LastName
Tutor
001AT
Ahmad
Tan
11A
003JL
Jane
Li
11B
011HJ
Heather
Jones
10A
QUALIFICATION
QualCode
Level
Subject
CS1
IGCSE
Computer Science
MT9
IGCSE
Maths
SC12
IGCSE
Science
STUDENT-QUALIFICATION
QualCode
StudentID
Grade
DateOfAward
SC12
011HJ
A
31/8/2014
SC12
003JL
C
31/8/2014
CS1
003JL
B
31/8/2014
(i)
Draw an Entity-Relationship (E-R) diagram to show the relationships between these
three tables.
[2]
State the type of relationship that exists between STUDENT and
(ii)
STUDENT-QUALIFICATION.
… [1]
Describe how the relationship between QUALIFICATION and
(iii)
STUDENT-QUALIFICATION is implemented.
…
…
…
… [2]
(d) (i)
The database will store each student’s date of birth.
Write an SQL script to add a date of birth attribute to the appropriate table.
…
…