Jump to content

Recommended Posts

new to SQL and PHP

so, i've been recommended to read normalization steps

but the book just makes it more harder for me to design a DB in practical

so, all the pros say that they don't particularly follow normalization

but it's like ABC to the them

so, how do they think?

can smn outline simple rules of the Normalization steps which will be helpful in practical designing?

Link to comment
https://forums.phpfreaks.com/topic/201116-normalization/
Share on other sites

I think their are 2 main streams in the normalization process:

 

1) The Codd method

 

Starts with NF0 which means all data in one table. Afterwards you apply the laws of Codd to become a NF3 or possibly an NF5 (NF3 is sufficient in most cases). Also note that in some circumstances denormalization will be applied if performance may benefit from it.

 

Example: http://en.wikipedia.org/wiki/Database_normalization#Objectives_of_normalization

 

2) Don't the know the exact name of the second method but is commonly referred to as an ERD

 

You start out by creating entities (little boxes with names in it, singular) and you try to find their relationships

 

Chen_ERD.gif

 

The diamond's in the picture represent relations, the circles are fields, the squares are table names.

Link to comment
https://forums.phpfreaks.com/topic/201116-normalization/#findComment-1055147
Share on other sites

thank u ignace

so, i'll simplfy the steps below:

1. Draw and ERD and take out the fields and tables

2. Take all the fields in one table

3. Choose a primary key and put redundant fields in another table and so on

4. Choose primary keys for other tables and corresponding foreign keys

5. Look for dependencies and eliminate them

but i have a question:

how do i break many to many relationships??? 

Link to comment
https://forums.phpfreaks.com/topic/201116-normalization/#findComment-1056173
Share on other sites

No they are 2 different methods either you use the ERD or you use the Codd method don't mix them. And the Codd method is actually a bit harder then your 3-5 steps, see Objectives of Normalization.

 

how do i break many to many relationships???

 

You create a bridge-table that has a foreign key for both tables primary keys.

 

 

Link to comment
https://forums.phpfreaks.com/topic/201116-normalization/#findComment-1056285
Share on other sites

2) Don't the know the exact name of the second method but is commonly referred to as an ERD

 

You are not guaranteed any normalization form just because you've made an E/R-diagram.

 

How do you mean:

 

1) The person creating the ERD has a limited knowledge of database design and can therefor not create a normalized ERD?

2) or, the person creating the ERD has sufficient knowledge in database design, but due to not using Codd's method ends up with an ERD of which he only thinks is normalized?

 

If 2, then yeah I have been thinking about that, it always turned out right (sort of). They taught us in college it this way and told us that we should favor it over Codd's method. Like most of the times they give no reason as to why, just that we must. Most students (like myself back then) are naive and ignorant, and asking for motive is (de facto) verboten.

 

2 years later and I haven't looked it back up, care to share some insights?

Link to comment
https://forums.phpfreaks.com/topic/201116-normalization/#findComment-1056406
Share on other sites

2) Don't the know the exact name of the second method but is commonly referred to as an ERD

 

You are not guaranteed any normalization form just because you've made an E/R-diagram.

 

How do you mean:

 

1) The person creating the ERD has a limited knowledge of database design and can therefor not create a normalized ERD?

2) or, the person creating the ERD has sufficient knowledge in database design, but due to not using Codd's method ends up with an ERD of which he only thinks is normalized?

 

Neither. I just mean that because you created a diagram of a schema, you aren't ensured that it's normalized. Consider the two E/R-diagrams I've attached (bold outlined attributes are primary keys, I couldn't figure out how to make things underlined using graphviz).

 

In foo.png, we have two functional dependencies on Movies:

Title,Year -> Genre,Director

Director -> DirectorAddress

 

This violates BCNF (Boyce-Codd Normal Form) because it requires that all left-side terms of non-trivial functional dependencies must be a superkey in that relation. However, Director is not a superkey in the Movies relation. Title,Year is a superkey though, because functional dependencies are transitive.

 

The bar.png diagram shows a normalized version.

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/201116-normalization/#findComment-1056430
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.