If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > one table per attribute?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-25-09, 18:36
luapyeltrah luapyeltrah is offline
Registered User
 
Join Date: Sep 2009
Posts: 16
one table per attribute?

I posted a thread earlier about using EAV versus one table per attribute because I need to allow users to define their own attributes (I'm basically stuck at having to allow this). I'm sufficiently worried about implementing EAV given its drawbacks, so the only sensible solution I can think of is to just create a table for each user-specified attribute, which would tuples of (entity_id, attribute_value). If I'm not mistaken that's basically a DKNF table. I would obviously need to have a lookup table for getting the table names for attributes in order to perform desired join queries. I was wondering if anyone has an opinion good/bad about this kind of database plan for allowing user-defined attributes. thanks.
Reply With Quote
  #2 (permalink)  
Old 09-25-09, 18:59
dportas dportas is offline
Registered User
 
Join Date: Dec 2007
Location: London, UK
Posts: 732
Having at most one non-key attribute per table is called Sixth Normal Form (Date, Darwen, Lorentzos). It is a potentially useful way to deal with a regularly changing schema or one where all attributes are independent of each other. In practice it isn't usually necessary to go that far though because at least some attributes normally are associated, ie: they go together so that you would never have one without the other.
Reply With Quote
  #3 (permalink)  
Old 09-28-09, 09:33
Derek Asirvadem Derek Asirvadem is offline
Registered User
 
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 258
EAV is definitely bad news, unless you like masses of code that do not work. Just because the users are allowed to define their own attributes does not mean the entire data model has to be based on that: you can have a proper Normalised structure and use either a simple 1:n table or 6NF, just where they need to add attributes. You don't want the whole database to be broken, just the bit that they keep changing.

I do not think that is DKNF. Where I have seen formal DKNFs, they have had no RI at all, so the Domain-Key requirement didn't have DK to be based on DK. They said they had to remove the RI to "make it work". IMHO DKNF is too informal and non-specif, anyone who is trying to comly with some xNF, who does not make it, trumpets that they have DKNF; because it is non-specific, most people find it hard to prove that the declaration is false.

Stick with the "real" normal forms, at least 3NF and BCNF for the main database.
__________________
Regards
Derek Asirvadem (Formerly DerekA)
Information Architect / Senior Sybase DBA
Copyright © 2009 Software Gems Pty Ltd

I answer questions from the Original Poster only. If you have a genuine question, as the moderators have requested, start a new thread.

http://www.softwaregems.com.au
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On