❖ Relational Design Theory |
The aim of studying relational design theory:
❖ Relational Design and Redundancy |
A good relational database design:
In database design, redundancy is generally a "bad thing":
❖ 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.
❖ 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 |
... | ... | ... | ... | ... | ... |
❖ 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? |
... | ... | ... | ... | ... | ... |
❖ Relational Design and Redundancy (cont) |
If we close account A-101 ...
accountNo | balance | customer | branch | address | assets |
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?
❖ Relational Design and Redundancy (cont) |
Insertion anomaly:
❖ Database Design (revisited) |
To avoid these kinds of update problems:
ER → SQL mapping tends to give non-redundant schemas
Produced: 1 Nov 2020