samah,
My comments are found in-line below.
This Produts table does not appear to be fully normalized based on the above description.
However, I do not have the book and cannot fully analyze it or the database.
If the book does not explain why things were done the way they were done, it is very
difficult for me to comment otherwise.
I hesitate to do so because John Viescas has a lot more experience than I do.
"Relationship" means many things.
In the MS Access world, it means Foreign Key references between tables to assure
Referential Integrity.
It is rare, but you can declare a Foreign Key from one column of a table to another column
(I've never done it myself).
On the other hand, when "relationship" is used more generically, it can be discussing any
form of association.
So, that was a long-winded way of saying that I don't know what your book is saying
because I don't have it.
A "dependency" in normalization is one of factual correctness.
When you have products that have colors, then your Product entity will have an attribute
called Color, and that attribute that is dependent on the primary key of Product.
But there is no MS Access Relationship (Foreign Key) between whatever column or columns
make up the Primary Key and the the color column.
Part of the rules of normalization exist to make sure that all attributes of an entity
(i.e. columns of a table) are related (the generic use of the word).
One of my pet peeves about MS Access is that it "robbed" the use of "relationship" to
replace the term referential integrity constraints (which it should not have done, in my
opinion).
Yes, this is true. That can be very useful.
That subject is not "related" (I'm using the word generically right there) to MS Access
Relationships or database normalization.
Here's my big discussion on this:
Part of the trouble about understanding relationships could come from the fact that
Relation, Relations, and Relationship(s) have multiple meanings in regards to "Relational
Databases."
One meaning is that the underlying theory behind Relational Databases is a branch of math
called Relational Algebra (invented by Dr. Codd). This branch of math works on "sets" of
data. A "set" in Relational Algebra is called a "relation". Then, some people in various
companies (IBM, Oracle, etc.) took this branch of math and made it into the precursors of
the Relational Databases software we have today. They grabbed "relational" off of
Relational Algebra and stuck it in front of "database", and voila, we have "Relational
Databases".
Another meaning is that "Relation" is the technical name of what Relational Databases call
"Tables". (Just to be complete, the technical name of "Row" is "Tuple".)
Now, in order to run our databases, we have something that goes by the technical term,
Referential Integrity. This states that if we start with table called Items, that has a
Primary Key of UPC, and we also have table called Pricing, that has a primary key of UPC
and PricingDate, then whatever happens, we do not want to have a row in the Pricing table
that has an UPC value that doesn't appear in the Items table. Why? Because we would have
prices in Pricing for items no one in the company could identify (there being nothing in
Items to identify the item). Relational Databases use internal management, usually
indexes, to *enforce* a "rule" that automatically prevents users from deleting any row in
Items . . . *when there is still any row* . . . in Pricing with the UPC about to be
deleted from Items. This process, this "enforcement" of the "rules", is called
Referential Integrity. It is one of the most critical features of any Relational
Database.
Now, in MS Access, you open up the "Relationships" window, and make some table sub-windows
appear on it. Then you drag fields back and forth between the table sub-windows and
establish nice little lines that go from table to table, and MS Access calls these lines
"Relationships" (and a lot of other people do, too). In this case, an MS Access
"Relationship" is the method whereby "Referential Integrity" is set up. It should be
noted that MS Access uses the word "relationship" in completely different ways than other
database products, and differently from Data Modeling (more on that in a second). This
alternate usage is so pervasive on the PC desktop world that terminology creep has taken
place, causing the MS Access version of "relationship" to be thought of by many as "what
real relationships are in databases".
To further confuse the issue (yes, there's more), Data Modeling, the process where ideas
about things (entities) are organized into understandable formats, like big charts covered
by boxes with lines running between them (rather remarkably like the boxes and lines in
the MS Access Relationships window), also uses the concept of "relationships". Except in
Data Modeling, a "relationship" is an actual box on the chart (an entity), not the lines
running between them.
Data Models themselves are built to help database designers create good databases. When
all the aspects of the chart (there can be many versions and detail levels) are completed,
and I'm skipping over a lot of stuff here for simplicity, the chart is turned over to the
database designers, and they go to work.
The boxes on a Data Modeling chart represent "entities", or the people, places, things, or
knowledge that are being described on the chart. A "relationship", then, is a form of
knowledge because it *tells* us something. Therefore, it gets a box on the chart. And
here's another one, the lines on a Data Model chart? They represent something called
Cardinality. Cardinality is one to one, one to many, many to many, or recursive (Bill of
Materials).
To yet further confuse things, the word "relationship" *frequently* replaces "Cardinality"
even when experts are discussing the situation. It's important to understand all this,
because a table of a concrete entity (like an Book) can have a many to many "cardinality"
with an abstract piece of knowledge (a relationship). If a Book can be checked out of
library by many people, the book does not have a one to many cardinality with people,
instead there is a "relationship" between books and people, and books have a cardinality
with that relationship, and people have a cardinality with that relationship (we'll call
it a CheckedOut relationship).
Concrete Entity: Books
Concrete Entity: People
Abstract Entity: CheckedOut
Both Books and People can appear in CheckedOut over an over again, as the same person
checks out and reads the same book over and over again. The check-out date will be the
attribute ("CheckedOutDate") of CheckedOut that helps define each row. The primary key
would be, BookID, PeopleID, and CheckedOutDate. The "relationship" between books and
people is that people can check the books out of the library. The two cardinalities from
the two concrete entities to the one abstract relationship entity are the one-to-many
(etc.) part of it and together form a many-to-many cardinality (i.e. relationship in MS
Access terms).
Yes, cardinality is *rarely* discussed by MS Access users. But it is still important to
realize that it exists. It is further necessary to realize that what MS Access "calls" a
"relationship" is really called something else by a large fraction of Data Modelers and
Database Designers. It's important because you have to realize that a real-world entity,
a "bit of knowledge", may be a "relationship" between other entities and that the
"relationship" may be described in the database by a table (also known as a "relation").
And in MS Access, the cardinality between the tables is called a "relationship", as well.
Don't ask me why the MS Access designers decided to rob an already massively overused term
and apply it the way they did, but they did, and knowing about it can be quite helpful in
my opinion.
I can only hope this helped clear up all the different ways that the word relationship
gets used in the overall database world.
Basics:
About.com
http://databases.about.com/od/specificproducts/a/normalization.htm
Tips to Get You Going
http://home.att.net/~california.db/tips.html#aTip1
Microsoft: Description of database normalization basics in Access 2000 (not significantly
changed by Access 2007, see the article's own references at the end to material from the
early 1990s).
http://support.microsoft.com/support/kb/articles/q209/5/34.asp
Intermediate:
MySQL's website:
http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html
Advanced:
Wikipedia:
http://en.wikipedia.org/wiki/Database_normalization
Very Advanced:
University of Texas:
I like this whole site, since it has a handy menu on the right describing many important
aspects of the database world:
http://www.utexas.edu/its/windows/database/datamodeling/rm/rm7.html
Sincerely,
Chris O.