Results 1 to 2 of 2
Feb 4, 2011, 04:10 #1
Advice on lookup tables and inconstancy
Simple question really, I've googled it but couldn't get a straight answer.
Basically I wanna know, what are the advantages and disadvantages of having a lookup table for .. pretty much any tables, because I want to keep my tables consistent.
I have a news table, then i have a games table, then I have a category table.
I have a lookup table that puts the news article into a 'game' and a 'category'.
Without even thinking about it, I added comments to be allowed on each article and made a table 'news_comments' with a 'news_Id) foreign key in it, rather then having a seperate lookup table to join the 2, but after thought, its mixed up now isn't it, lookup tables for some tables, and foreign keys on the actual data row.
What's your preference, am I being too much of a perfectionist, and over complicating things?
Thanks in advanced for any input!
Joe."Ah the USB, the only rectangular device
that requires 3 attempts to get right."
Feb 4, 2011, 04:22 #2
- Join Date
- Jul 2002
- Toronto, Canada
- 63 Post(s)
- 3 Thread(s)
sorry, i kinda got lost in your explanation
i think what you mean by lookup table is what i would call a relationship table -- for instance a table which has news_id,game_id,category_id will relate a news article to a game and a category, so if a news article belongs to more than one game in the same category, you simply add additional "lookup" rows
this is fine
then you talk about the news_comments table, which simply refers each comment to the news article it belongs to
that's fine too, because it's not a many-to-many relationship, you don't need to structure it so that the same comment can be applied to multiple news articles