0% found this document useful (0 votes)
68 views9 pages

4.10 Exam Practise Questions (Qs Only)

The document outlines a relational database design for a furniture store and a magazine subscription service, detailing the necessary relations and attributes. It includes tasks related to database normalization, SQL queries for data retrieval, and modifications to accommodate new requirements. Additionally, it discusses a garage's job tracking system and the implications of database design choices on data integrity and efficiency.

Uploaded by

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

4.10 Exam Practise Questions (Qs Only)

The document outlines a relational database design for a furniture store and a magazine subscription service, detailing the necessary relations and attributes. It includes tasks related to database normalization, SQL queries for data retrieval, and modifications to accommodate new requirements. Additionally, it discusses a garage's job tracking system and the implications of database design choices on data integrity and efficiency.

Uploaded by

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

Q1.

A company sells furniture to customers of its store. The store does not keep the furniture
in stock. Instead, a customer places an order at the store and the company then orders
the furniture required from its suppliers. When the ordered furniture arrives at the store a
member of staff telephones or e-mails the customer to inform them that it is ready for
collection. Customers often order more than one type of furniture on the same order, for
example a sofa and two chairs.

Details of the furniture, customers and orders are to be stored in a relational database
using the following four relations:

Furniture(FurnitureID, FurnitureName, Category, Price, SupplierName)

CustomerOrder(OrderID, CustomerID, Date)

CustomerOrderLine(OrderID, FurnitureID, Quantity)

Customer(CustomerID, CustomerName, EmailAddress, TelephoneNumber)

(a) These relations are in Third Normal Form (3NF).

What does this mean and why is it important that the relations in a relational
database are in Third Normal Form?

Meaning: ___________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________
(2)

Why important: ______________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________
(2)

(b) On the incomplete Entity-Relationship diagram below show the degree of any three
relationships that exist between the entities.

Furniture CustomerOrder

Customer CustomerOrderLine

Page 1 of 9
(3)

(c) Complete the following Data Definition Language (DDL) statement to create the
Furniture relation, including the key field.

CREATE TABLE Furniture (

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

)
(3)

(d) A fault has been identified with the product that has FurnitureID number 10765. The
manager needs a list of the names and telephone numbers of all of the customers
who have purchased this item of furniture so that they can be contacted. This list
should contain no additional details and must be presented in alphabetical order of
the names of the customers.

Write an SQL query that will produce the list.

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________
(6)

Page 2 of 9
(e) The system requirements have changed. When an order is placed the system must
now record the name of the sales person who took the order.

Place one tick next to the correct SQL command below that should be used to
update the structure of the database so that this information can be recorded.

Correct? (Tick
Command
one)

ALTER TABLE

CREATE FIELD

INSERT COLUMN

(1)
(Total 17 marks)

Page 3 of 9
Q2.
A company manages subscriptions to thirty different magazines. Customers can subscribe
to receive one or more of the magazines.

• Each magazine has a category such as Gardening or Current Affairs.

• Each magazine has a subscription rate, which is the cost of subscribing to receive
the magazine for 12 months.

Details of the subscriptions are to be stored in a database using the following three
relations:

Magazine(MagazineID, MagazineName, Category, SubscriptionRate)

Subscription(SubscriptionID, MagazineID, CustomerID, StartDate, EndDate)

Customer(CustomerID, CustomerName, Address, Postcode, TelephoneNumber)

(a) These relations are in Third Normal Form.

What does this mean and why is it important that the relations in a database are in
Third Normal Form?

Meaning: ___________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

Why important: ______________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________
(4)

(b) Complete the Entity-Relationship diagram below to show the degree of the three
relationships that exist between the entities.

Magazine Subscription

Customer

(2)

Page 4 of 9
(c) Complete the following Data Definition Language (DDL) statement to create the
Magazine relation, including the key field.

CREATE TABLE Magazine

(__________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

__________________________________________________________________)
(2)

(d) The company wants to send letters to customers with expired subscriptions to the
magazine ‘AQA Computing Now’ to encourage them to subscribe again. The letters
must be sent to all customers for this magazine whose subscription ended before
01/06/2010. A customer’s name, address and postcode must be included in each
letter.

Write an SQL query that will find the data needed to produce the letters.

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________
(5)

(e) The magazine named ‘AQA Gardening Monthlyߣ is to be renamed ‘AQA Garden
Newsߣ.

Complete this SQL statement to update the data in the Magazine table to reflect this
change.

UPDATE ___________________________________________________________

SET _______________________________________________________________

WHERE ____________________________________________________________
(2)
(Total 15 marks)

Page 5 of 9
Q3.
A garage services and repairs cars. It uses a relational database to keep track of the jobs
that customers have booked for it to carry out. The database includes jobs that have been
completed and jobs that are waiting to be done.

The details of the jobs that the garage does, together with the parts that it stocks and uses
are stored in the database using the four relations shown in Figure 1.

Figure 1

Job (JobID, CarRegNo, JobDate, InGarage, JobDuration)

Car (CarRegNo, Make, Model, OwnerName, OwnerEmail,


OwnerTelNo)

Part (PartID, Description, Price, QuantityInStock)

PartUsedForJob (JobID, PartID, QuantityUsed)

• Each car has a unique CarRegNo.


• A type of car can be uniquely identified by the combination of its Make and Model.
Different Makes may use the same Model name and a particular manufacturer
(Make) will produce several different car Models.
• A booking made for a car on a particular date counts as one job, regardless of how
many different tasks are completed upon it.
• A job might require the use of any number of parts, including zero.
• Some of the details are stored in the database as soon as a booking is made and
others are only added when a job has been completed.

The attribute JobID is the Entity Identifier (Primary Key) of the Job relation.

(a) If the JobID attribute were not included in the Job relation, which other attribute or
attributes that are currently in the relation could probably be used as an Entity
Identifier (Primary Key) instead?

___________________________________________________________________
(1)

It has been suggested that the owner details (OwnerName, OwnerEmail,


OwnerTelNo) should not be stored in the Car relation and that a new relation should
be created to store owner details separately from car details.

(b) Explain why storing the owner details separately would improve the design of the
database.

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________
(2)

Page 6 of 9
(c) On the incomplete Entity-Relationship diagram below show the degree of any three
relationships that exist between the entities.

Job Car

Part PartUsedForJob
(2)

When an appointment is made for a job, this is represented in the Job relation. At the time
of booking, the InGarage attribute is set to False and the JobDuration attribute is set to
0:00. When the car arrives at the garage the value of the InGarage attribute is changed to
True. When the job is finished the value of the JobDuration attribute is updated to indicate
how long the job took and details of the parts used are recorded in the database.

The Job with JobID 206 has been completed. The job took 1 hour 30 minutes (1:30) and
used two of the parts with PartID 12.

(d) Write the SQL commands that are required to record the amount of time that the job
took in the database.

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________
(3)

(e) Write the SQL commands that are required to record in the database the fact that
two of the parts with PartID 12 were used.

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________
(2)

Page 7 of 9
Figure 1 is repeated below.

Job (JobID, CarRegNo, JobDate, InGarage, JobDuration)

Car (CarRegNo, Make, Model, OwnerName, OwnerEmail,


OwnerTelNo)

Part (PartID, Description, Price, QuantityInStock)

PartUsedForJob (JobID, PartID, QuantityUsed)

A mechanic needs to produce a list of all of the parts used on the job with JobID 93 for a
customer.

This list must include the PartID, Description, Price (each) and QuantityUsed of each part,
and no other details. The parts in the list should be ordered by PartID with the parts with
the lowest PartIDs nearest to the top of the list.

(f) Write an SQL query to produce the list.

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________
(5)

Page 8 of 9
There are restrictions on which parts can be fitted to which cars. For example:

• The driver’s door mirror with PartID 104 can only be fitted to one particular make
and model of car.
• The ignition switch with PartID 27 can be fitted to any model of car for one particular
make as the maker uses the same ignition switch in all models.
• The tyre with PartID 97 can be fitted to a wide range of cars of different makes and
models as it is a standard size.

If the information about which parts could be fitted to which makes and models of
cars were represented in the database, it could be used to help a mechanic identify
the correct parts to use for a job.

(g) Explain how the database design could be modified to represent which makes and
models of car a part can be fitted to.

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________

___________________________________________________________________
(3)
(Total 18 marks)

Page 9 of 9

You might also like