Results 1 to 7 of 7
  1. #1
    Join Date
    May 2006
    Posts
    3

    users-items rating (was "Basic database layout question")

    I have a very basic question about a database layout. I want to set up an
    item rating application with a database backend. I was wondering wat the
    most efficient database layout is.



    Any comments or suggestions are very welcome.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    the rating table should not have its own id as PK

    the PK should be a composite PK consisting of the two FKs
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    May 2006
    Posts
    3
    Thanks for that one Rudy, i think that's exactly what i was looking for. I always tought there was a 'official' way for this very basic DB issue. (i never read manuals)

  4. #4
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    Either way, you need a unique constraint on a set of logical values. Should this also be your primary key is up to you.
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  5. #5
    Join Date
    Oct 2002
    Location
    Baghdad, Iraq
    Posts
    697
    Quote Originally Posted by dutchstoner
    (i never read manuals)
    It's never too late to start. BTW, isn't "dutchstoner" a bit redundant?

  6. #6
    Join Date
    May 2006
    Posts
    3
    It is redundant...

  7. #7
    Join Date
    Oct 2002
    Location
    Baghdad, Iraq
    Posts
    697
    Quote Originally Posted by dutchstoner
    It is redundant...
    Heh... good to see someone still knows how to have fun.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •