The Database Design Resource Center
The Database Design Resource Center
 
 FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in   The Website
Database for a website

 
Post new topic   Reply to topic    Database Design Resource Forum: Forum Index -> The relational model
 Display posts from previous 
Display posts from previous:   

 Database for a website 
Author Message
quark
User


Joined: 26 May 2010
Posts: 1

PostPosted: Wed May 26, 2010 3:01 pm    Post subject: Database for a website Reply with quote

I have a database driven website I am building & have a few questions.

First I have about 5 tables (possibly more) I want to make to store information & want to make sure I'm building it relationally correct.

My main table is the members table. Here I will assign the member a primary key & everything will revolve around the primary key since it is a member based website.

Next, I have Favorites, orders, conversations & feedback tables.

My question is, do I simply need to have a column for the primary key in all the subsequent tables to link them back to the member?
View user's profile Send private message

  
Author Message
peter
User


Joined: 09 Nov 2007
Posts: 81
Location: Berlin, Germany

PostPosted: Tue Jun 01, 2010 7:12 pm    Post subject: Reply with quote

Hi quark,

you have to add a so-called foreign key column to every subsequent table that references the primary key column in your member table.
If you don't add it: how do you know which favorite or order belong to which member?
_________________
Peter
Moderator
View user's profile Send private message Visit poster's website

  
Author Message
Pollux
User


Joined: 31 May 2010
Posts: 5

PostPosted: Mon Jun 21, 2010 6:49 pm    Post subject: Reply with quote

You can see in this product catalog how to relate different dependent data when you need from PK or FK and how few FK can be compound PK.
_________________
Nothing's imposible imagination is everything!
Database Benchmark Software (GPL) | World's fastest database
View user's profile Send private message Send e-mail Visit poster's website

Post new topic   Reply to topic    Database Design Resource Forum: Forum Index -> The relational model All times are GMT
Page 1 of 1
View previous topic :: View next topic  

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Site Build It!

Copyright © 2004-2008 www.databasedesign-resource.com / Alf A. Pedersen
All rights reserved.
All information contained on this website is for informational purposes only.
*Disclaimer: www.databasedesign-resource.com does not warrant any company, product, service or any content contained herein.

Copyright acknowledgement note:

The name Oracle is a trademark of Oracle Corporation.
The names MS Access/MS SQL Server are trademarks of Microsoft Corporation.
Any other names used on this website may be trademarks of their respective owners, which I fully respect.


Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS :: phpbb Templates available at GemViper.com :: Contents © Database Design Resource Forum: