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 > Simple normalizing question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-04-06, 06:05
mattock mattock is offline
Registered User
 
Join Date: Aug 2006
Location: Leeds, UK
Posts: 104
Simple normalizing question

Hi

My first post so bare with me! I'm trying to normalize a table and need some advice on how to set up one particular relationship.

Basically, i have a table of different venues (eg pubs, resturants etc) and each venue has a varying amount of different facilities. At the moment i have a seperate table which has an auto incremented integer for a primary key against each facility name (eg, 1 - toilets).

Back in the venue table i am listing the facilites against each venue in a single comma delimited field.
eg
pub A - 1,3,4
pub B - 3,5

I know that 1st NF requires that you get rid of this but i'm getting stuck as to what will work best.

I've come up with the following:

Keep the facilities table, (eg 1 - toilets) but add a second table where the venu id (fk) lists each faclitiy seperatly, eg (from example above)

venu_id (fk) - facility
pub A - 1
pub A - 3
pub A - 4
pub B - 3
pub B - 5

Only now i'm repeating the venue_id and feel this may be a waste of space, is there a better way?

many thanks in advance
Reply With Quote
  #2 (permalink)  
Old 08-04-06, 07:10
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
no, that is the best way, one row per venue facility -- the venue id is a foreign key, the facility id is a foreign key, and the pair of them together is the primary key

by the way, the expression is "bear with me"

"bare with me" means we both get undressed together, and i'm not gonna

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 08-04-06, 07:33
mattock mattock is offline
Registered User
 
Join Date: Aug 2006
Location: Leeds, UK
Posts: 104
Smile

lol, how about a 'beer' with me then?

Thanks for your answer, great forum, given me a bit more confidence with normalization!
Reply With Quote
  #4 (permalink)  
Old 08-04-06, 07:47
mattock mattock is offline
Registered User
 
Join Date: Aug 2006
Location: Leeds, UK
Posts: 104
ps, don't suppose you know of any freebie graphics programs which will do the layout, i've found one - 'Fabforce database deigner', how ever i can't see anywhere where i can add the 'crows feet' or 'one' or 'zero' icons?
Reply With Quote
  #5 (permalink)  
Old 08-04-06, 08:03
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
see http://www.databaseanswers.org/modelling_tools.htm

i've tried DBDesigner and i don't like it, it messes up PKs and/or forces a particular naming scheme on you
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #6 (permalink)  
Old 08-09-06, 01:27
Mucman Mucman is offline
Registered User
 
Join Date: Dec 2002
Location: Vancouver, BC
Posts: 35
I've been really happy with Happy Fish.
__________________
INSERT INTO Jokes (statement) VALUES ('Here is my witty SQL signature');
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