Back 

Database design questions and answers

Questions

Q1. What is meant by a ‘flat file’?
Q2. When is it appropriate to use a flat file database rather than a relational one?
Q3. What is meant by ‘data redundancy’?
Q4. What is meant by ‘data consistency’?
Q5. What is the difference between a Primary Key and a Foreign Key?
Q6. A company has to think very carefully before changing from a paper-based database system to a computerised one. List some of the things they need to think about and plan for.
Q7. What does the E and the R stand for in E-R Diagram?
Q8. Define ‘Entity’.
Q9. What exactly does an E-R diagram show you?
Q10. The manager of a shop keeps records of her customers, what they bought and who the sales person was for each purchase. She uses a flat file to store these records. Some of the records in the flat file are shown below. Suggest some of the problems that have occurred as a result of storing the records in this kind of structure.

Name

Address

Phone Number

CD_ID

CDName

Price

Staff_ID

StaffName

Mr Smith

21 Tree Rd

723144

34

Sam’s Hits

£12.99

4

John Jones

Mr Jones

7 Lorry St

435554

34

Sam’s Hits album

£12.99

6

Ali Patel

Miss Ng

43 Poppy St

344441

83

Cushion

£10.49

2

Peter Song

Miss Ng

43 Poppy St

344441

45

India

£15.99

2

Pete Song

Mr Smith

21 Tree Rd

723644

34

Sam’s Hits

£12.99

4

John Jones

When you look at a problem like this, you need to consider the problems that have been highlighted in the NoKats example we looked at in detail earlier in this section. Ask yourself if any of the data in the records in the above table have been stored more than once. If you can find examples of this then you have found examples of data redundancy. Also ask yourself if data that is supposed to be the same, has been entered into the flat file identically in all places. If you can find examples where data is supposed to be the same, but has not been entered into the flat file identically then you will have found examples of adding anomalies. You will have found examples where the data has become inconsistent. 

Answers

Q1. A flat file is a database in a single table.
Q2. Flat files are ideal if the database is very small.
Q3. Data redundancy is where data in a database has been duplicated, so one set isn’t really needed as it can be found somewhere else.
Q4. Data consistency is the relationship between input data, processing on the data and output data, where the data is correct at all stages.
Q5. A primary key is a field in a database that holds a unique value for each record. A foreign key is a field that links a record in one table to a record in another table. A foreign key in one table is a primary key in another table.
Q6. The things that need to be thought about include buying and maintaining equipment, training and retraining, dealing with software problems, how data will be backed up and complying with the Data Protection Act 1998.
Q7. E stands for Entity. R stands for Relationship.
Q8. An Entity is something about which we want to keep information. It might be a physical thing, such as a student, or an abstract thing, such as a student’s record.
Q9. An E-R diagram shows you all of the entities in a system and how they are related to each other.
Q10. Problems include data redundancy (storing 43 Poppy St twice) and data consistency (different names for the same thing e.g. Sam’s Hits and Sam’s Hits album).

Back