0% found this document useful (0 votes)
8 views14 pages

A1 Database 2025

The document discusses various aspects of relational databases, including normalization processes, SQL scripts for database operations, and entity-relationship diagrams. It provides examples of database structures for managing student data, customer orders, and plant sales, along with tasks related to database design and querying. Additionally, it addresses the advantages of relational databases over file-based systems and the characteristics of databases in Third Normal Form (3NF).

Uploaded by

darsmunali144
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views14 pages

A1 Database 2025

The document discusses various aspects of relational databases, including normalization processes, SQL scripts for database operations, and entity-relationship diagrams. It provides examples of database structures for managing student data, customer orders, and plant sales, along with tasks related to database design and querying. Additionally, it addresses the advantages of relational databases over file-based systems and the characteristics of databases in Third Normal Form (3NF).

Uploaded by

darsmunali144
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

PAGE 986

(c) The following database table is not normalised.

StudentName DateOfBirth TutorGroup Subject SubjectCode


English, Maths,
Yuwei Chen 01/09/2004 SMH EN, MA, CS
Computer Science
Claudia Raj 23/02/2005 JMB Maths, Physics, Art MA, PY, AR
Art, Design, English
Aamil Akram 24/01/2005 KMB AR, DE, EN
language
English language,
Areeba Faraz 21/12/2004 SMH EN, CH, DE
Chemistry, Design

Explain how to modify the table to put it into First Normal Form (1NF).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

© UCLES 2023 9618/12/O/N/23 [Turn over


PAGE 964

3 A shop manager has designed a relational database to store customer orders.

The database will have the following tables:

CUSTOMER(CustomerID, FirstName, LastName, Town)

SHOP_ORDER(OrderNo, CustomerID, OrderDate)

SUPPLIER(SupplierID, EmailAddress, TelephoneNumber)

ITEM(ItemNumber, SupplierID, Description, Price)

ORDER_ITEM(ItemNumber, OrderNo, Quantity)

(a) Complete the entity-relationship (E-R) diagram for the relational database.

SHOP_ORDER CUSTOMER

ORDER_ITEM SUPPLIER

ITEM

[3]

(b) Identify three advantages of a relational database compared to a file-based approach.

1 ................................................................................................................................................

...................................................................................................................................................

2 ................................................................................................................................................

...................................................................................................................................................

3 ................................................................................................................................................

...................................................................................................................................................
[3]

© UCLES 2023 9618/11/O/N/23


PAGE 965

(c) (i) Write a Structured Query Language (SQL) script to define the database called SHOP.

...........................................................................................................................................

..................................................................................................................................... [1]

(ii) Write the SQL script to return the total quantity of items that the customer with the ID of
HJ231 has ordered.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [4]

© UCLES 2023 9618/11/O/N/23 [Turn over


PAGE 942

(c) The database Lessons has the following tables:

HORSE(HorseID, Name, Height, Age, HorseLevel)

STUDENT(StudentID, FirstName, LastName, RiderLevel, PreferredHorseID)

LESSON(LessonID, Date, Time, StudentID, HorseID, LessonContent)

Dates in this database are stored in the format #DD/MM/YYYY#.

The fields RiderLevel and HorseLevel can only have the values: Beginner,
Intermediate or Advanced.

(i) Describe two methods of validating the field RiderLevel.

1 ........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

2 ........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................
[2]

(ii) Write a Structured Query Language (SQL) script to return the names of all the horses
that have the horse level intermediate or beginner.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [4]

© UCLES 2023 9618/12/M/J/23


PAGE 943

(iii) The following SQL script should return the number of riders that have the rider level
beginner and have a lesson booked on 09/09/2023.

SELECT SUM(STUDENT.RiderLevel) AS NumberOfRiders

FROM STUDENT, LESSON

WHERE StudentID = StudentID

OR Date = #09/09/2023#

AND STUDENT.RiderLevel = Beginner;

There are four errors in the script.

Identify and correct each error.

1 ........................................................................................................................................

...........................................................................................................................................

2 ........................................................................................................................................

...........................................................................................................................................

3 ........................................................................................................................................

...........................................................................................................................................

4 ........................................................................................................................................

...........................................................................................................................................
[4]

© UCLES 2023 9618/12/M/J/23 [Turn over


MUHAMMAD ALI KHAN
PAGE 899

5 A relational database, GARDEN, has the following tables:

OWNER(OwnerID, FirstName, TelephoneNo, TreeID, TreePosition)

TREE(TreeID, ScientificName, MaxHeight, FastGrowing)

(a) The database is not in Third Normal Form (3NF).

Explain how the database can be normalised to 3NF.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(b) Write the Structured Query Language (SQL) script to add a new record in the table TREE to
store the following data:

Attribute Value

TreeID LOW_1276

ScientificName Salix_Alba

MaxHeight 30.00

FastGrowing TRUE

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(c) State what is meant by a candidate key in a relational database.

...................................................................................................................................................

............................................................................................................................................. [1]

© UCLES 2022 9618/12/O/N/22 [Turn over


MUHAMMAD ALI KHAN
PAGE 871

4 A photographer creates a relational database to store data about photographs taken at birthday
parties.

The database, PHOTOGRAPHS, stores details of the customer, the party, the photographs taken
and the cameras used.

The photographer has several cameras that are used for taking the photographs at the parties.

Each camera has a specific lens type (for example, XY32Z) and lighting type (for example, F1672).

Data about each photograph is stored in the database including the party at which it was taken,
the time it was taken and the camera used.

The database has these four tables:

CUSTOMER(CustomerID, FirstName, LastName, Telephone)

PARTY(PartyID, CustomerID, PartyDate, StartTime)

PHOTO_DATA(PhotoID, PartyID, TimeTaken, CameraID)

CAMERA_DATA(CameraID, LensType, LightingType)

(a) Complete the entity-relationship (E-R) diagram for the database PHOTOGRAPHS.

PARTY CUSTOMER

PHOTO_DATA CAMERA_DATA

[3]

© UCLES 2022 9618/11/O/N/22


PAGE 872

(b) The database is normalised and is in Third Normal Form (3NF).

Describe the characteristics of a database that is in Third Normal Form (3NF).

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(c) The table shows some sample data for the table PHOTO_DATA.

PhotoID PartyID TimeTaken CameraID

ST23-56 BD987 08:34 NIK-02

ST23-57 BD987 08:55 NIK-02

ST23-60 BC08 09:01 CAN-01

ST23-61 BC08 10:23 CAN-12

ST23-62 BC08 10:56 NIK-01

(i) State what is meant by a tuple. Give an example of a tuple from PHOTO_DATA.

Tuple .................................................................................................................................

...........................................................................................................................................

Example ............................................................................................................................

...........................................................................................................................................
[2]

(ii) Complete the Structured Query Language (SQL) script to display the total number of
photographs that have been taken using a camera with a camera ID starting with CAN.

SELECT ........................................................ (................................................................)

FROM .........................................................................................

WHERE CameraID LIKE .................................................................................. ;


[4]

© UCLES 2022 9618/11/O/N/22 [Turn over


PAGE 828

4 A teacher uses a relational database, MARKS, to store data about students and their test marks.

The database has the following structure:

STUDENT(StudentID, FirstName, LastName)

TEST(TestID, Description, TotalMarks)

STUDENT_TEST(StudentID, TestID, Mark)

(a) Describe the advantages of using a relational database compared to a file-based approach.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [4]

(b) Give the highest level of Normal Form (NF) the database MARKS is in and justify your choice.

Normal Form .............................................................................................................................

Justification ...............................................................................................................................

...................................................................................................................................................

...................................................................................................................................................
[3]

© UCLES 2022 9618/11/M/J/22 [Turn over


MUHAMMAD ALI KHAN
PAGE 829

(c) (i) Sample data to be stored in the table STUDENT_TEST is shown.

StudentID TestID Mark

12 A1 50

12 P10 100

13 A1 75

14 P10 60

Write a Structured Query Language (SQL) script to create the table STUDENT_TEST.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [5]

(ii) Write a Structured Query Language (SQL) script to find the average mark of students in
test A7.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [3]

© UCLES 2022 9618/11/M/J/22


MUHAMMAD ALI KHAN
PAGE 805

10

6 A shop sells plants to customers. The shop manager has a relational database to keep track of the
sales.

The database, PLANTSALES, has the following structure:

PLANT(PlantName, QuantityInStock, Cost)

CUSTOMER(CustomerID, FirstName, LastName, Address, Email)

PURCHASE(PurchaseID, CustomerID)

PURCHASE_ITEM(PurchaseID, PlantName, Quantity)

(a) The database is normalised.

(i) The table lists the following three stages of normalisation:

• The first stage is from a database that is not normalised (0NF) to First Normal Form
(1NF).
• The second stage is from 1NF to Second Normal Form (2NF).
• The third stage is from 2NF to Third Normal Form (3NF).

Tick ( ) one box in each row to identify the appropriate stage for each task.

Normalisation stage
Task
0NF to 1NF 1NF to 2NF 2NF to 3NF

Remove any partial key dependencies

Remove any repeating groups of attributes

Remove any non-key dependencies

[2]

(ii) Draw an entity-relationship (E-R) diagram for the database PLANTSALES.

PLANT CUSTOMER

PURCHASE_ITEM PURCHASE

[3]
© UCLES 2021 9618/12/O/N/21
PAGE 806

11

(b) The shop manager uses a Database Management System (DBMS).

Describe the purpose and contents of the data dictionary in the DBMS.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [3]

(c) The shop manager uses both Data Definition Language (DDL) and Data Manipulation
Language (DML) statements to create and search the database.

(i) Complete the DML statements to return the total number of items purchased with the
purchase ID of 3011A.

SELECT SUM(..................................................)

FROM ..................................................

WHERE .................................................. = ..................................................;


[4]

(ii) Write DDL statements to include a field in the table PURCHASE to store the date of the
order.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [3]

© UCLES 2021 9618/12/O/N/21 [Turn over


MUHAMMAD ALI KHAN
PAGE 747

(c) Example data from the table RENTAL are given:

RentalID CustomerID HouseID MonthlyCost DepositPaid


1 22 15B5L 1000.00 Yes
2 13 3F 687.00 No
3 1 12AB 550.00 Yes
4 3 37 444.50 Yes

(i) Complete the following Data Definition Language (DDL) statement to define the table
RENTAL.

CREATE ...................................... ...................................... (

RentalID INTEGER NOT NULL,

CustomerID INTEGER NOT NULL,

HouseID ...................................... (5) NOT NULL,

MonthlyCost ...................................... NOT NULL,

DepositPaid BOOLEAN NOT NULL,

.......................................................... (RentalID)

);
[4]

(ii) Write a Data Manipulation Language (DML) script to return the first name and last name
of all customers who have not paid their deposit.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [4]

© UCLES 2021 9618/12/M/J/21 [Turn over


MUHAMMAD ALI KHAN
PAGE 747

(c) Example data from the table RENTAL are given:

RentalID CustomerID HouseID MonthlyCost DepositPaid


1 22 15B5L 1000.00 Yes
2 13 3F 687.00 No
3 1 12AB 550.00 Yes
4 3 37 444.50 Yes

(i) Complete the following Data Definition Language (DDL) statement to define the table
RENTAL.

CREATE ...................................... ...................................... (

RentalID INTEGER NOT NULL,

CustomerID INTEGER NOT NULL,

HouseID ...................................... (5) NOT NULL,

MonthlyCost ...................................... NOT NULL,

DepositPaid BOOLEAN NOT NULL,

.......................................................... (RentalID)

);
[4]

(ii) Write a Data Manipulation Language (DML) script to return the first name and last name
of all customers who have not paid their deposit.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

..................................................................................................................................... [4]

© UCLES 2021 9618/12/M/J/21 [Turn over

You might also like