Sei sulla pagina 1di 5

Example of Library Standardization

The following exercise is an attempt to assert the knowledge of standardization with a simplified example of a
database for a small library.

CodLibro Title Author Editorial NameReader DateDev


Pérez Gómez,
1001 Complex variable Murray Spiegel McGraw Hill 15/04/2005
Juan
1004 Visual Basic 5 E. Petroustsos Anaya Ríos Terán, Ana 17/04/2005
1005 Statistics Murray Spiegel McGraw Hill Roca, René 16/04/2005
Nancy
García Roque,
1006 Oracle University Greenberg and Oracle Corp. 20/04/2005
Luis
Priya Nathan
Pérez Gómez,
1007 Clipper 5.01 Ramalho McGraw Hill 18/04/2005
Juan

This table does not meet the First Normal Form (1FN) requirement of having only atomic fields, since the
reader's name is a field that can (and should) be broken down into paternal surname, maternal surname and first
names.

As shown in the following table.

1NF
CodLibro Title Author Editorial Paterno Materna Names DateDev
l
Complex McGraw
1001 Murray Spiegel Perez Gomez John 15/04/2005
variable Hill
1004 Visual Basic 5 E. Petroustsos Anaya Rivers Teran Ana 17/04/2005
McGraw
1005 Statistics Murray Spiegel Rock René 16/04/2005
Hill
Oracle Nancy Oracle
1006 Garcia Roque Luis 20/04/2005
University Greenberg Corp.
Oracle Oracle
1006 Priya Nathan Garcia Roque Luis 20/04/2005
University Corp.
McGraw
1007 Clipper 5.01 Ramalho Perez Gomez John 18/04/2005
Hill

As can be seen, there is some redundancy characteristic of 1NF.


The Second Normal Form (2FN) requires that there be no partial dependencies or in other words, all non-key
attributes must be completely dependent on the primary key.

Currently in our table we have several partial dependencies if we consider as key attribute the book code.

For example, the title is completely identified by the book code, but the name of the reader does not really
depend on this code, so this data must be moved to another table.

2FN

CodLibro Title Author Editorial


1001 Complex variable Murray Spiegel McGraw Hill
1004 Visual Basic 5 E. Petroustsos Anaya
1005 Statistics Murray Spiegel McGraw Hill
1006 Oracle University Nancy Greenberg Oracle Corp.
1006 Oracle University Priya Nathan Oracle Corp.
1007 Clipper 5.01 Ramalho McGraw Hill

The new table will only contain data from the reader.

CodLecto Patern Matern Names


r o al
501 Perez Gomez John
502 Rivers Teran Ana
503 Rock René
504 Garcia Roque Luis

We created a table to contain the reader data and also had to create the CodLector column to uniquely identify
each reader.

However, this new database layout necessitates that there be another table to maintain the information of which
books are loaned to which readers.

This table is shown below:


CodLibr CodLecto DateDev
o r
15/04/200
1001 501 5
17/04/200
1004 502 5
16/04/200
1005 503 5
20/04/200
1006 504 5
18/04/200
1007 501 5

For the Third Normal Form (3FN) the relationship must be in 2FN and in addition the non-key attributes must be
mutually independent and completely dependent on the primary key.

Recall also that we said that this means that the columns in the table must contain only information about the
entity defined by the primary key and, therefore, the columns in the table must contain data about only one thing.

In our 2FN example, the first table holds information about the book, authors and publishers, so we must create
new tables to satisfy 3FN requirements.

3FN

CodLibro Title
1001 Complex variable
1004 Visual Basic 5
1005 Statistics
1006 Oracle University
1007 Clipper 5.01
CodAutor Author
801 Murray Spiegel
802 E. Petroustsos
Nancy
803 Greenberg
804 Priya Nathan
806 Ramalho

CodEditorial Editorial
901 McGraw Hill
902 Anaya
903 Oracle Corp.

Although we have created new tables so that each one has only information about one entity, we have also lost
the information about which author has written which book and the corresponding publishers, so we must create
other tables that relate each book to its authors and publishers.

CodLibro codAutho
r
1001 801
1004 802
1005 801
1006 803
1006 804
1007 806

CodLibro codEditorial
1001 901
1004 902
1005 901
1006 903
1007 901
And the rest of the tables do not need modification.

CodLector Paterno Materna Names


l
501 Perez Gomez John
502 Rivers Teran Ana
503 Rock René
504 Garcia Roque Luis

CodLibr CodLect DateDev


o or
15/04/200
1001 501 5
17/04/200
1004 502 5
16/04/200
1005 503 5
20/04/200
1006 504 5
18/04/200
1007 501 5

Potrebbero piacerti anche