Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Practical application of First Normal Form?
Old 05-27-2009, 10:41 PM Practical application of First Normal Form?
Junior Talker

Posts: 4
Trades: 0
Ok..I want to get to form on the practical application of the First Normal Form (1NF).

Seems to me that one of a basic definitions of 1NF is: Make a separate table for each set of related attributes, and give each table a primary key (to eliminate duplicate records).
The aim here is to avoid redundant information and overcomplicating query code.

My problem is that I have a PHP interface which is quite tightly coupled to the MySQL databse in how it presents the data/.csv-downloads. At the moment, it's proving rather hard to work out how to change this and I was wondering if one could bend the 1NF rule a bit until I get better at understanding SQL & PHP? Yes - not ideal from a database design point of view but I wonder if the problems that come from not strictly adhering to 1NF always apply? Allow me to elaborate in an example...

Let's say we have a simple little database to record if a car has worn tires & where:

Table: check_my_tires
----------------------
pktire_wear (primary key)
left_front_tire_wear (NOT NULL and takes only the values* "Worn" and "Normal")
right_front_tire_wear (NOT NULL and takes only the values* "Worn" and "Normal")
left_back_tire_wear (NOT NULL and takes only the values* "Worn" and "Normal")
right_back_tire_wear (NOT NULL and takes only the values* "Worn" and "Normal")

*default value = "Normal", acceptance of only "Worn" and "Normal" enforced at the UI level via a listbox which only has those 2 values.

The above can't have NULL values (enforced at UI level, avoids redundancy) nor duplicate rows (enforced by the primary key pktire_wear), so far so good?

HOWEVER, it does seem to have attributes which are duplicates in that you are conceptually talking about "tire_wear" in 4 fields. Now, I can see how you can end up with redundant code in queries and the resultant pain in having to adjust your application to deal with it if you are trying to future-proof your design to allow for cars which may have 100 wheels.
BUT..if you are strictly dealing with a situation where cars can only be 4-wheeled, is that a problem that doesn't apply here? ie: the app. is promoted as "Database for 4 wheeled car wear" - no we won't help you with tricycles, we're stricly a 4 wheeled car database provider

I would appreciate hearing from those in the know about the theory as well as real world application about this! I wonder if there's a balance between the two as stated above.

Thanks,
Kev
KevT is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Practical application of First Normal Form?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26813 seconds with 12 queries