Relational Design

COMP3311 20T3 ♢ Relational Design ♢ [0/8]
❖ Relational Design Theory

The aim of studying relational design theory:

What we study here: Functional dependencies
COMP3311 20T3 ♢ Relational Design ♢ [1/8]
❖ Relational Design and Redundancy

A good relational database design:

Minimal stored information no redundant data.

In database design, redundancy is generally a "bad thing":

But ... redundancy may give performance improvements
COMP3311 20T3 ♢ Relational Design ♢ [2/8]
❖ Relational Design and Redundancy (cont)

Consider the following relation defining bank accounts/branches:

accountNo balance customer branch address assets
A-101 500 1313131 Downtown Brooklyn 9000000
A-102 400 1313131 Perryridge Horseneck 1700000
A-113 600 9876543 Round Hill Horseneck 8000000
A-201 900 9876543 Brighton Brooklyn 7100000
A-215 700 1111111 Mianus Horseneck 400000
A-222 700 1111111 Redwood Palo Alto 2100000
A-305 350 1234567 Round Hill Horseneck 8000000
... ... ... ... ... ...

Careless updating of this data may introduce inconsistencies.

COMP3311 20T3 ♢ Relational Design ♢ [3/8]
❖ Relational Design and Redundancy (cont)

If we add $300 to account A-113 ...

accountNo balance customer branch address assets
A-101 500 1313131 Downtown Brooklyn 9000000
A-102 400 1313131 Perryridge Horseneck 1700000
A-113 900 9876543 Round Hill Horseneck 8000300
A-201 900 9876543 Brighton Brooklyn 7100000
A-215 700 1111111 Mianus Horseneck 400000
A-222 700 1111111 Redwood Palo Alto 2100000
A-305 350 1234567 Round Hill Horseneck 8000000
... ... ... ... ... ...

COMP3311 20T3 ♢ Relational Design ♢ [4/8]
❖ Relational Design and Redundancy (cont)

If we add a new account A-306 at the Round Hill branch ...

accountNo balance customer branch address assets
A-101 500 1313131 Downtown Brooklyn 9000000
A-102 400 1313131 Perryridge Horseneck 1700000
A-113 900 9876543 Round Hill Horseneck 8000300
A-201 900 9876543 Brighton Brooklyn 7100000
A-215 700 1111111 Mianus Horseneck 400000
A-222 700 1111111 Redwood Palo Alto 2100000
A-305 350 1234567 Round Hill Horseneck 8000000
A-306 500 7654321 Round Hill Horseneck 8000500?
... ... ... ... ... ...

COMP3311 20T3 ♢ Relational Design ♢ [5/8]
❖ Relational Design and Redundancy (cont)

If we close account A-101 ...

accountNo balance customer branch address assets
A-101 500 1313131 Downtown Brooklyn 9000000
A-102 400 1313131 Perryridge Horseneck 1700000
A-113 900 9876543 Round Hill Horseneck 8000300
A-201 900 9876543 Brighton Brooklyn 7100000
A-215 700 1111111 Mianus Horseneck 400000
A-222 700 1111111 Redwood Palo Alto 2100000
A-305 350 1234567 Round Hill Horseneck 8000000
A-306 500 7654321 Round Hill Horseneck 8000500?
... ... ... ... ... ...

What is the address of the Downtown branch?

COMP3311 20T3 ♢ Relational Design ♢ [6/8]
❖ Relational Design and Redundancy (cont)

Insertion anomaly:

Update anomaly: Deletion anomaly:
Insertion/update anomalies can be handled, e.g. by triggers
COMP3311 20T3 ♢ Relational Design ♢ [7/8]
❖ Database Design (revisited)

To avoid these kinds of update problems:

Such schemas have little/no redundancy


ER → SQL mapping tends to give non-redundant schemas

The methods we describe in this section
COMP3311 20T3 ♢ Relational Design ♢ [8/8]


Produced: 1 Nov 2020