Re: Database table "triangle"... allowed or not

From: andrewst <member14183_at_dbforums.com>
Date: Sun, 06 Apr 2003 13:53:18 +0000
Message-ID: <2735133.1049637198_at_dbforums.com>


Originally posted by Trooper
> Hello group,
>
> I'm setting up a little database to allow multiple users
> to track their online auctions.
>
> One of my requirements is that each user be able to
> create their own "groups" to classify their auctions.
>
> My problem is that one way of planning this creates
> a "triangle". Here are the tables (in brief) as an example
> so you can see the relations
>
> user
> ===
> user_id PK
> email
>
>
> auction
> =====
> auction_id PK
> user_id FK
> auction_group_id
>
>
> auction_group
> ==========
> auction_group_id PK
> user_id FK
> description
>
>
> What you can see is that both auction tables
> are related to the user table, and the two auction
> tables are related.
>
> This seems somehow wrong, but I am unclear as
> to how I go about fixing this. Actually I do have
> an idea... perhaps the right idea so what do you
> think about this:
>
>
> user
> ===
> user_id PK
> email
>
>
> auction_group
> ==========
> auction_group_id PK
> user_id FK
> auction_id FK
> description
>
>
> auction
> =====
> auction_id PK
> auction_group_id
>
>
>
> In this way, I can relate the auction to the user through
> the auction_group. Seems reasonable...
>
> Well, I'd appreciate any comments on this.
> Thanks,
> Trooper
>
> 05-April-2003
> ==========
Your second idea is wrong, as it means a group can only contain one auction!

The first model is better, and it is not wrong. It states correctly that users can create auction groups, and users can create auctions, and that the auctions may be assigned to auction groups. That's OK.

--
Posted via http://dbforums.com
Received on Sun Apr 06 2003 - 15:53:18 CEST

Original text of this message