SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Dumb Vocab Question about What This Type of Table is Called


Dumb Vocab Question about What This Type of Table is Called

Author
Message
lek103
lek103
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 Visits: 168
This is probably a dumb question, but I'm totally self-taught and have learned everything I know from the Internet, so sometimes I struggle with knowing the correct terms to use for things. I've tried Googling this and I can't seem to adequately describe it to get good search results. So if I have the following 2 tables:

FieldType
FieldTypeID
FieldTypeDescription

FieldValueList
FieldTypeID
FieldValueID
FieldValue

...and they're populated like this:

FieldTypeID FieldTypeDescription
1 State
2 Animal
3 Vegetable

FieldTypeID FieldValueID FieldValue
1 1 Massachusetts
1 2 Vermont
2 3 Cat
2 4 Frog
3 5 Broccoli
3 6 Radish

...is there terminology for the FieldValueList table? Basically a table that's a dumping ground for a bunch of lists of things that would appear in drop-downs based on their FieldTypeID?
John Mitchell-245523
John Mitchell-245523
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13998 Visits: 15944
Those are horrible. I recommend avoiding that design if at all possible. I've seen it described as EAV (Entity Attribute Value), OTLT (One True Lookup Table) and MUCK (Massively Unified Code Key).

John
GilaMonster
GilaMonster
SSC Guru
SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)

Group: General Forum Members
Points: 86639 Visits: 45253
The One True Lookup Table design. Also known to people who have worked with them as 'Oh $%$$%$$ not that thing again'

It's a 'design' that looks so attractive to people who haven't worked with it but it's an absolute mess, causes all sorts of integrity issues, performance issues and to be honest should be avoided for most scenarios. There's very, very little benefit to that design and a whole lot of problems

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


lek103
lek103
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 Visits: 168
Ah, I see! Thanks to you both! I wasn't aware that it was considered poor design. I've always used that approach for any list items about which I know I'll never need to store any other information, such as name prefixes and suffixes, states, etc. I'll do some research on OTLT and perhaps reconsider my approach. Thank you!
GilaMonster
GilaMonster
SSC Guru
SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)

Group: General Forum Members
Points: 86639 Visits: 45253
http://tonyandrews.blogspot.com/2004/10/otlt-and-eav-two-big-design-mistakes.html
https://www.simple-talk.com/sql/t-sql-programming/look-up-tables-in-sql-/

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


lek103
lek103
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 Visits: 168
Thanks! Those articles are full of stuff that somehow never occurred to me. Blink
aaron.reese
aaron.reese
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1037 Visits: 902
Front end developers love EAV tables because they can quickly built an interface that allows users to configure the properties of an entity (think a website that sells books and wine. One needs ISBN number, author, publisher, the other needs Vintage, Terroire, Grape, Acidity etc..)

But reporting on it is a nightmare as you effectively have to unpivot the data to use it and create very wide sparsely populated tables anyway and you have no idea how many columns you are going to need.
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)SSC Guru (85K reputation)

Group: General Forum Members
Points: 85172 Visits: 41077
As with all else, "It Depends". Please see the latest article from Tony on the subject.
http://www.sqlservercentral.com/articles/Editorial/105414/

I agree that they are a panacea for nothing and usually cause a whole lot of trouble especially for those who might not be well practiced at them. But, they are a tool that can be used very successfully for certain things.

I also wouldn't necessarily call the tables given by the OP EAV or OTLT any more than I'd call a check account and EAB or OTLT. "IT DEPENDS!" ;-)

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search