0% found this document useful (0 votes)
7 views

Homework Questions Design

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

Homework Questions Design

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

Database Homework – Introduction & Design 1

1. Describe two advantages of using an electronic database instead of


a manual database. 2
Two advantages include being easier to access information, as well
as being more organized. The data on the database is also stored
safely.

2. State the difference between a flat file database and a relational


database. 2
A flat file database contains 1 table to store data, while a relational
database uses 2 or more linked tables to store data.

3. Scot Cars (a second-hand car company) has branches located in five


different Scottish towns and cities. They maintain a database of all
cars they have in stock. Some of the records from the relational
database are shown below.

(a) Scot Car’s relational database contains primary and foreign keys.

i) Identify a suitable field for the Primary Key in the Car table.
1 Registration
ii) Identify a suitable key for the Primary Key in the Branch
table. 1

Postcode

iii) Identify the Foreign Key in the Car table.


1
Database Homework – Introduction & Design 1

BranchNumber

iv) Identify the type of data that would be stored in the mileage
field.

1
Number/Integer

(b) State the purpose of a foreign key in a relational database. 1

A foreign key is used to link one table to the other.

(c) State the output from the following SQL statement.


3

It will only select the make, model, and registration from


the table ‘car’ if the colour of the car is black. It will order
the data in make in ascending order.

(d) Customers often visit Scot Cars looking for a particular make and
model of car.

Write the SQL for a search that would provide customers with an ordered
list of cars, as shown below. 5

(Hint: you will need to join the 2 tables in this query).


Database Homework – Introduction & Design 1

SELECT Model, Colour, Town, Mileage


FROM Branch, Car
WHERE Model=Ka

ORDER BY Mileage;

Total = 17

You might also like