November 17, 2008 at 3:43 pm
What's the proper way to design this database?
#1
Table: Galleries
gallery_id (int, pk)
title (varchar)
Table: Albums
album_id (int, pk)
title (varchar)
Table: Images
image_id (int, pk)
title (varchar)
Table: AT_Galleries_Albums
id (int, pk)
gallery_id (int)
album_id (int)
Table: AT_Albums_Images
id (int, pk)
album_id (int)
image_id (int)
--- OR ---
#2
Table: Galleries
gallery_id (int, pk)
title (varchar)
Table: Albums
album_id (int, pk)
gallery_id (int)
title (varchar)
Table: Images
image_id (int, pk)
album_id (int)
title (varchar)
Basically what I'm asking is should I store the related ids within the associated tables (#2) or in seperate (linkage type) tables (#1)? The relationships should be obvious but I can supply a diagram if needed. I apologize if there are not enough details here.
Thanks!
November 17, 2008 at 4:49 pm
We would need to know the relationships between these items in order to answer that.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
November 18, 2008 at 7:10 am
Can an Album belong to more than one Gallery? Can an image be in multiple albums?
For each YES you need a "glue" table, for each NO you can do not.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
November 18, 2008 at 10:12 am
Thank you, that makes perfect sense.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply