December
1998 QUESTION 5 Total Marks: 20 Marks |
Click here to access other
questions
SUGGESTED SOLUTIONS
|
(a) | What is an index, and why are indexes often used in large database systems? | [2] | ||||||||||||||||||||||||||||||
Index: a table or data
structure used to determine the location of rows in a table (or tables) (1 mark). They are
used to improve performance (1 mark).
|
[2] | |||||||||||||||||||||||||||||||
(b) | There are several guidelines to help in choosing what indexes to define for a relational database. For each of the following guidelines, explain the reasons why it is often given: | |||||||||||||||||||||||||||||||
(i) Specify an unique index for the primary key attribute of each table. | [3] | |||||||||||||||||||||||||||||||
To ensure
uniqueness of primary key (1 mark) and to speed up retrievals (1 mark).
|
||||||||||||||||||||||||||||||||
(ii) Specify an index for foreign keys that are used in joining tables. | [2] | |||||||||||||||||||||||||||||||
To speed up
multiple-table queries (1 mark).
|
[3]
|
|||||||||||||||||||||||||||||||
(c) | For which non-key attributes might it be useful to specify an index? | [2] | ||||||||||||||||||||||||||||||
Those which
are referred to in sorting (1 mark) or grouping (1 mark) commands.
|
[2] | |||||||||||||||||||||||||||||||
(d) | Under what circumstances would the designer of a large database decide not to use any indexes? | [2] | ||||||||||||||||||||||||||||||
Where there
are many updates to the database (1 mark), since this may involve decreased performance (1
mark).
|
[2] | |||||||||||||||||||||||||||||||
(e) | What is meant by 'referential
integrity' in a database? Referential integrity: database must not contain any unmatched foreign key values. (1 mark), i.e., all foreign key values must occur as primary keys in the relevant target relation (1 mark).
|
[2]
[2] |
||||||||||||||||||||||||||||||
|
[2]
[2] |
|||||||||||||||||||||||||||||||
|
[2]
[2] |
|||||||||||||||||||||||||||||||
With reference to the tables below,
give an example of an insertion and a deletion which are forbidden by these rules Course
Tutor
Insertion example: any example insertion in Course table, where Tutor-code does not appear in Tutor table. Deletion example: can't delete 21, 45 or 63 rows in Tutor table.
|
[1] [1] |
|||||||||||||||||||||||||||||||
(f) | How might referential integrity constraints be enforced in a database? | [3] | ||||||||||||||||||||||||||||||
There are
two possible methods of enforcement:
The second option is more reliable and therefore preferred (1 mark).
|
[3] |