Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Table relationships

Author  Topic 

tclose
Starting Member

24 Posts

Posted - 2010-04-24 : 02:44:41

I have several tables that aren't related to one another, but I need to do joins on them to do computations etc. Would it be considered bad practice to place a foreign key in each table with the same value for the sake of joining them? Any advice is appreciated.

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-04-24 : 03:22:23
You definitly need to set primary and foreign keys (or composite keys)as well as constraints on table in order to correctly join data from several tables. With indexes and constraints you will define relational constraints and data accuracy.
Go to Top of Page

tclose
Starting Member

24 Posts

Posted - 2010-04-24 : 04:28:30
quote:
Originally posted by slimt_slimt

You definitly need to set primary and foreign keys (or composite keys)as well as constraints on table in order to correctly join data from several tables. With indexes and constraints you will define relational constraints and data accuracy.




I thought that might be the case. Thanks for the information.
Go to Top of Page
   

- Advertisement -