You are on page 1of 39

2

(1NF Minimal Form)



.
1NF
.

.
. 1NF: 1NF
.
.



1NF.

1: Domains and values



.
:
Customer
Customer ID

First Name

Surname

Telephone
Number

123

Robert

Ingram

555-861-2025

456

Jane

Wright

555-403-1659

789

Maria

Fernandez

555-808-9633

.

"Telephone
Number"
:
Customer
Customer ID

First Name

Surname

Telephone
Number

123

Robert

Ingram

555-861-2025

456

Jane

Wright

555-403-1659
555-776-4100

789

Maria

Fernandez

555-808-9633

2:

Telephone Number
:
Customer
Customer ID

First Name

Surname

Tel. No. 1

123

Robert

Ingram

555-861-2025

456

Jane

Wright

555-403-1659

789

Maria

Fernandez

555-808-9633

Tel. No. 2
555-776-4100

Tel. No. 3

Tel. No. 1, Tel. No. 2., and Tel. No. 3.


; Telephone Number
.
:
.
telephone number X?"
?" .

Customer-to-Telephone Number
RDBMS. 789
Tel. No. 2
Tel. No. 1 .

3. 4 .,
3 , 4- .

3:
, Telephone
Number ,
string
:
Customer
Customer ID

First Name

Surname

Telephone Number

123

Robert

Ingram

555-861-2025

456

Jane

Wright

555-403-1659, 555-776-4100

789

Maria

Fernandez

555-808-9633

1NF. Telephone Number


,
.
?" .

1NF :
Customer Name Customer Telephone Number .
Customer Name
Customer ID

First Name

Customer Telephone Number


Surname

Customer ID

Telephone Number

123

Robert

Ingram

123

555-861-2025

456

Jane

Wright

456

555-403-1659

789

Maria

Fernandez

456

555-776-4100

789

555-808-9633

.
, Customer-to-Telephone Number
.

1NF
(2NF) ,
1NF.
1NF

. , 1NF,
2NF :
Customer Names and Telephone Numbers
Customer ID

First Name

Surname

Telephone Number

123

Robert

Ingram

555-861-2025

456

Jane

Wright

555-403-1659

456

Jane

Wright

555-776-4100

789

Maria

Fernandez

555-808-9633

{Customer ID, Telephone Number}.


Jane Wright ,
.
, :
456?" . 2NF .


(1NF)
(2NF).
: (2NF):
.
1NF
(
), 2NF.

:

:
Employees' Skills
Employee

Skill

Current Work Location

Jones

Typing

114 Main Street

Jones

Shorthand

114 Main Street

Jones

Whittling

114 Main Street

Roberts

Light Cleaning

73 Industrial Way

Ellis

Alchemy

73 Industrial Way

Ellis

Juggling

73 Industrial Way

Harrison

Light Cleaning

73 Industrial Way

{Employee} {Skill} .
Employee ()
( ),
( ).
{Employee, Skill} .

, Current Work Location,


, .. Employee.
2NF.

Current Work Locations : 3-
Jones 114 Main Street, Ellis
73 Industrial Way.
:
Jones "Typing"
"Shorthand"
"Whittling" .

Jones?

2NF :
"Employees" {Employee},
"Employees' Skills" {Employee, Skill}:

Employees
Employee

Current Work Location

Employees' Skills
Employee

Skill

Jones

114 Main Street

Jones

Typing

Roberts

73 Industrial Way

Jones

Shorthand

Ellis

73 Industrial Way

Jones

Whittling

Harrison

73 Industrial Way

Roberts

Light Cleaning

Ellis

Alchemy

Ellis

Juggling

Harrison

Light Cleaning

2NF free .
2NF
:
Tournament Winners
Tournament

Year

Winner

Winner Date of Birth

Des Moines Masters

1998

Chip Masterson

14 March 1977

Indiana Invitational

1998

Al Fredrickson

21 July 1975

Cleveland Open

1999

Bob Albertson

28 September 1968

Des Moines Masters

1999

Al Fredrickson

21 July 1975

Indiana Invitational

1999

Chip Masterson

14 March 1977

Winner Winner Date of Birth


{Tournament, Year} ,
Winner / Winner Date of Birth
.
(3NF).

2NF


, 2NF. ,
;

.
:
Electric Toothbrush Models
Manufacturer

Model

Model Full
Name

Manufacturer
Country

tanduay

X-Prime

Forte X-Prime

Italy

redhorse

Ultraclean

Forte
Ultraclean

Italy

Dent-o-Fresh

EZBrush

Dent-o-Fresh
EZBrush

USA

Kobayashi

ST-60

Kobayashi ST60

Japan

Hoch

Toothmaster

Hoch
Toothmaster

Germany

Hoch

Contender

Hoch
Contender

Germany



{Model Full
Name},
2NF. {Manufacturer,
Model}

Manufacturer Country

:
Manufacturer.


: (3NF): 3NF
:
R () (2NF)
( )
.
R
R.

X Z (X Z) , X Y Y Z.

: (3NF) Carlo Zaniolo: 3NF ,


X A,
:
X A (, X A
),
X ,
A (.., A
)
Zaniolo
3NF Boyce-Codd normal form (BCNF).
BCNF ("A
").

2NF;

3NF.

:
2NF 3NF
:
Tournament Winners
Tournament

Year

Winner

Winner Date
of Birth

Indiana
Invitational

1998

Al Fredrickson 21 July 1975

Cleveland
Open

1999

Bob Albertson

Des Moines
Masters

1999

Al Fredrickson 21 July 1975

Indiana
Invitational

1999

Chip
Masterson

28 September
1968

14 March
1977


(Tournament) (Year),
{Tournament, Year}
. {Tournament, Year}
.

3NF
Winner Date of Birth
{Tournament, Year}
Winner. Winner
Date of Birth Winner
(inconsistencies),


.

Tournament Winners
Tournament

Year

Player Dates of Birth


Winner

Winner

Date of Birth

Indiana Invitational

1998

Al Fredrickson

Chip Masterson

14 March 1977

Cleveland Open

1999

Bob Albertson

Al Fredrickson

21 July 1975

Des Moines Masters

1999

Al Fredrickson

Bob Albertson

28 September 1968

Indiana Invitational

1999

Chip Masterson


, 3NF.

Zaniolo
Zaniolo 3NF
, X A,
:
X A,
X ,
A (.., A
)
:
X A (.. X
A) A . Y
R. YX. A Y
X Y, , X .

3NF
3NF
, .
3NF ,
, ;
Boyce-Codd
(BCNF) , BCNF,
4NF 5NF.


(4NF)
. 4NF
Boyce-Codd
(BCNF). 2NF, 3NF Boyce-Codd
(concerned) , 4NF

.
4NF ,
X Y, X X
.


If the column headings in a relational database table are divided
into three disjoint groupings X, Y, and Z, then, in the context of a
particular row, we can refer to the data beneath each group of
headings as x, y, and z respectively. A multivalued
dependency X Y signifies that if we choose any x actually
occurring in the table (call this choice xc), and compile a list of all
the xcyz combinations that occur in the table, we will find that xc is
associated with the same y entries regardless of z.
A trivial multivalued dependency X Y is one in which Y consists
of all columns not belonging to X. That is, a subset of attributes in a
table has a trivial multivalued dependency on the remaining subset
of attributes.
A functional dependency is a special case of multivalued
dependency. In a functional dependency X Y,
every x determines exactly one y, never more than one.

:
:
Pizza Delivery Permutations
Restaurant

Pizza Variety

Delivery Area

A1 Pizza

Thick Crust

Springfield

A1 Pizza

Thick Crust

Shelbyville

A1 Pizza

Thick Crust

Capital City

A1 Pizza

Stuffed Crust

Springfield

A1 Pizza

Stuffed Crust

Shelbyville

A1 Pizza

Stuffed Crust

Capital City

Elite Pizza

Thin Crust

Capital City

Elite Pizza

Stuffed Crust

Capital City

Vincenzo's Pizza

Thick Crust

Springfield

Vincenzo's Pizza

Thick Crust

Shelbyville

Vincenzo's Pizza

Thin Crust

Springfield

Vincenzo's Pizza

Thin Crust

Shelbyville


.

{Restaurant, Pizza Variety, Delivery Area}.
BCNF. , 4NF.

{Restaurant} ( ). :
{Restaurant} {Pizza Variety}
{Restaurant} {Delivery Area}
-


.
(,
) : ., A1 Pizza
Stuffed Crust, A1 Pizza Cheese Crust
, A1 Pizza's
. :
Cheese Crust A1 Pizza's
,
{Restaurant} {Pizza Variety}.

,
(Pizza
Variety)
(Delivery area),
4NF:
Varieties By Restaurant
Restaurant

Pizza Variety

Delivery Areas By Restaurant


Restaurant

Delivery Area

A1 Pizza

Thick Crust

A1 Pizza

Springfield

A1 Pizza

Stuffed Crust

A1 Pizza

Shelbyville

Elite Pizza

Thin Crust

A1 Pizza

Capital City

Elite Pizza

Stuffed Crust

Elite Pizza

Capital City

Vincenzo's Pizza

Thick Crust

Vincenzo's Pizza

Springfield

Vincenzo's Pizza

Thin Crust

Vincenzo's Pizza

Shelbyville

,


, -
4NF.


(5NF), Project-join
normal form (PJ/NF) is a level of database
normalization, designed to reduce redundancy in relational
databases
recording
multi-valued
facts
by
isolating semantically related multiple relationships. A table is
said to be in the 5NF if and only if it is in 4NF and every join
dependency in it is implied by the candidate keys.

Example
Consider the following example:
Travelling Salesman Product Availability By Brand
Travelling Salesman

Brand

Product Type

Jack Schneider

Acme

Vacuum Cleaner

Jack Schneider

Acme

Breadbox

Willy Loman

Robusto

Pruning Shears

Willy Loman

Robusto

Vacuum Cleaner

Willy Loman

Robusto

Breadbox

Willy Loman

Robusto

Umbrella Stand

Louis Ferguson

Robusto

Vacuum Cleaner

Louis Ferguson

Robusto

Telescope

Louis Ferguson

Acme

Vacuum Cleaner

Louis Ferguson

Acme

Lava Lamp

Louis Ferguson

Nimbus

Tie Rack

: Product
Type, Brand,
Travelling Salesman.

In the absence of any rules restricting the valid possible
combinations of Travelling Salesman, Brand, and Product
Type, the three-attribute table above is necessary in order to
model the situation correctly.
:
(Travelling Salesman)
(Brands) (Product Types)
(repertoire). If Brand B is in his
repertoire, and Product Type P is in his repertoire, then
(assuming Brand B makes Product Type P), the Travelling
Salesman must offer products of Product Type P made by
Brand B.

Product Types By Travelling Salesman

Travelling Salesman

Product Type

Brands By Travelling Salesman

Travelling Salesman

Brand

Jack Schneider

Vacuum Cleaner

Jack Schneider

Acme

Jack Schneider

Breadbox

Willy Loman

Robusto

Willy Loman

Pruning Shears

Louis Ferguson

Robusto

Willy Loman

Vacuum Cleaner

Louis Ferguson

Acme

Willy Loman

Breadbox

Louis Ferguson

Nimbus

Willy Loman

Umbrella Stand

Louis Ferguson

Telescope

Louis Ferguson

Vacuum Cleaner

Acme

Vacuum Cleaner

Louis Ferguson

Lava Lamp

Acme

Breadbox

Louis Ferguson

Tie Rack

Acme

Lava Lamp

Robusto

Pruning Shears

Robusto

Vacuum Cleaner

Robusto

Breadbox

Robusto

Umbrella Stand

Robusto

Telescope

Nimbus

Tie Rack

Product Types By Brand

Brand

Product Type

Note how this setup helps to remove redundancy. Suppose that


Jack Schneider starts selling Robusto's products. In the previous
setup we would have to add two new entries since Jack
Schneider is able to sell two Product Types covered by Robusto:
Breadboxes and Vacuum Cleaners. With the new setup we need
only add a single entry (in Brands By Travelling Salesman).

Usage
Only in rare situations does a 4NF table not conform to
5NF. These are situations in which a complex real-world
constraint governing the valid combinations of
attribute values in the 4NF table is not implicit in the
structure of that table. If such a table is not normalized
to 5NF, the burden of maintaining the logical
consistency of the data within the table must be
carried partly by the application responsible for
insertions, deletions, and updates to it; and there is a
heightened risk that the data within the table will
become inconsistent. In contrast, the 5NF design
excludes the possibility of such inconsistencies.


First Normal Form (1NF)
1 ,

()
.


.
, .
3

1
- Lokacija1, Lokacija2, Lokacija3
- : Lokacii
null .

2
- .
- : ,
.

3
- Departmani 2 .

.

01: 1


.
Korisnici(KorisnikID, Ime, Kompanija,AdresaKompanija,
Mobilen)
Korisnici(KorisnikId, Ime, Kompanija, AdresaKompanija)
Telefoni(RKorisnikId*,Mob)
Second Normal Form (2NF)

2 1
.

B R
, B (A>B)
B R
R, B
, .
.
,
.
. VRABOTENI_PROEKTI(VrabotenID, ImeVraboten, Proekt, VkupnoVreme)
.
a ,
2 (ImeVraboten Proekt)
VRABOTENI(VrabotenID, ImeVraboten)
VREME(VrabotenID, Proekt, VkupnoVreme)

You might also like