Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Lectures / LECTURE 3

.pdf
Скачиваний:
23
Добавлен:
14.10.2016
Размер:
198.39 Кб
Скачать

LECTURE 3

Normalization

IITU, ALMATY, 2016 DATABASE DESIGN

Lyudmila Kozina, senior lecturer

Review of last lecture

Previously, we looked at designing databases using ER models

There was one question that this process leads to:

what constitutes a “good” database design?

Today’s lecture

We’ll discuss the criteria used to evaluate a database design.

We will also formalize our definition of a “good” database design using the concept of functional dependencies.

Finally, we will look at how to fix a “bad” database design using the process of normalization.

“Good” database design

What criteria would you say constitutes a good database design?

Good database design

We can show that a good database design exhibits the following characteristics:

Tables group only related data

Tables store no redundant data

NULL values are minimized

A bad database design

Consider the following table storing part and order information for an online computer parts store:

A bad database design

Clearly, this relation is a bad design because it stores redundant data, which is one of our criteria for evaluating database design.

Data redundancy, such as in this relation, leads to three types of update anomalies:

-Modification anomaly

-Insertion anomaly

-Deletion anomaly

Modification anomalies

If a relation suffers a modification anomaly, it is possible that not all data that needs to be changed will always be changed.

A modification anomaly typically leads to inconsistent data because of missed updates.

In the example suppose Vince moved from Pittsburgh

to Washington D.C. To make this change, we must alter each row where Vince is referenced. If we don’t alter one of the rows, then Vince will live in two places (Pittsburgh and Washington D.C.), which is incorrect.

Insertion anomaly

An insertion anomaly occurs when we are prevented from inserting some data into a relation until other data can be supplied.

Suppose the computer parts store wishes to add

LCD screens to their inventory. Given the current schema, a LCD screen cannot be added until a customer orders one. Clearly, this is not correct – the company should be able to add the screen as soon as they are available to be sold.

Deletion anomaly

A deletion anomaly occurs when a deletion leads to an unintended loss of data.

Suppose Ron canceled his order at the

computer parts store. When the order is deleted, all information about the parts he has ordered, 512 Mb Ram, is also be lost. Clearly, we don’t want this to happen. Only his order should be removed from the system.

Соседние файлы в папке Lectures