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 > users-items rating (was "Basic database layout question")

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-22-06, 16:27
dutchstoner dutchstoner is offline
Registered User
 
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.
Reply With Quote
  #2 (permalink)  
Old 05-23-06, 09:08
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
the rating table should not have its own id as PK

the PK should be a composite PK consisting of the two FKs
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 05-23-06, 17:39
dutchstoner dutchstoner is offline
Registered User
 
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)
Reply With Quote
  #4 (permalink)  
Old 05-23-06, 18:46
r123456 r123456 is offline
Registered User
 
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.
Reply With Quote
  #5 (permalink)  
Old 05-24-06, 08:57
sco08y sco08y is offline
Registered User
 
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?
Reply With Quote
  #6 (permalink)  
Old 05-24-06, 09:12
dutchstoner dutchstoner is offline
Registered User
 
Join Date: May 2006
Posts: 3
It is redundant...
Reply With Quote
  #7 (permalink)  
Old 05-24-06, 13:15
sco08y sco08y is offline
Registered User
 
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.
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