Re: Clues on modeling a really simple concept

From: Bob Badour <>
Date: Mon, 06 Apr 2009 18:16:25 -0300
Message-ID: <49da712e$0$5472$>

Spike wrote:

> Hi everybody!
> I'm trying to model a photo gallery, and i have a doubt on how to
> implement it.
> I have a table for users. I have another table for pictures. And
> finally, i have a table for galleries (which are sets of pictures).
> Both galleries and pictures belongs to a single user, but a single
> picture can be used on many galleries.
> So, i have something like this:
> users --> pictures --> pictures_to_galleries --> galleries
> My question is: Should i add a relationship between galleries and
> users?
> I would like to query which galleries a user has, and i don't really
> know if it is worth adding a foreign key rather than doing a three-
> level join query each time i want to obtain this data.
> Thank you very much!

Design by usenet is a futile endeavour. You really do have to look at all of your requirements, and it's not really feasible to communicate them via usenet.

That said:

The only similar application I am familiar with is

In that application, the owner of a picture does not necessarily own the galleries it appears in. One can create and populate a gallery owning no pictures at all. This suggests to me that galleries have some association with users completely separate and independent from pictures.

But that's just one application and not necessarily your application. Received on Mon Apr 06 2009 - 23:16:25 CEST

Original text of this message