You are on page 1of 1

Homework 4 Defining a database table

Unit 8 System design and databases

Homework 4: Defining a database table


1. A database table for a newsagent has the following fields:

Field name Data type Comment


Text but might be What’s the
PaperID number(depending on whats in the number/barcode of this
id) newspaper?
Is it the Sun, The Times?
NewspaperName Text What newspaper
company is it from?
How many pounds is it?
Price Number/Real
Is it below a pound?
Frequency Number/Integer Daily, weekly or monthly
SundayDelivery Text Is it a Sunday paper?

2. (a) Suggest an appropriate data type for each of the fields. [5]
(b) (i) Which field would you suggest should be the Primary Key field?
PaperID
(b) (ii) What is special about a primary key field? [2]
Each record in this field must have a different value so it uniquely identifies all
items in this field

Suggest two different validation rules that could be applied to fields in this database. [2]

Field name: Validation type:


Validation 1:
PaperID Format Check
Validation rule:
All values must be confined to a particular format, whether they are all the same length,
or whether they have groups of 4 numbers like 1923-2314-3465-7832

Field name: Validation type:


Validation 2:
NewspaperName Presence Check
Validation rule:
There must be data present here

[Total 10 marks]

You might also like