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
 inner join/where vs. enterprise mgr relationships

Author  Topic 

sjlsam
Starting Member

9 Posts

Posted - 2007-04-09 : 14:00:14
Hello, I am new to SQL and the site, thanks for taking the time to look at my post

I have been building all of my queries using the WHERE clause (which i read functions the same as an INNER JOIN) to deal with my related tables. my boss wants me to look into the functionality of the "Relationships..." option in Enterprise Manager to see if it is more efficient to use and would eliminate the need for a WHERE clause

i have created some relationships using this "Relationships..." dialogue box to test out what happens (without using WHERE in this test scenario), the output seems to remain the same except for the fact that it looks like more rows are being queried to determine which ones are related

can you help me understand what the benefit of doing Relationships through Enterprise Manager is as opposed to using WHERE clauses to join related tables?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-09 : 14:36:00
sjlsam,

1.Relationships are created in order to force a column to have its values derived from other related table (foreign key relationship). Basically, this means there are two tables - Parent and Child. Foreign key column in Child table can have only those values which are defined in Parent table's key column.

2.JOINs are used to retrieve data from two or more tables based on some common column

3. WHERE clause is used limit the number of rows based on some condition. It can be used to specify JOIN condition as well but that is not a preferred way.


I suggest you to purchase some good book on SQL Server (like Programming SQL Server by Rob Viera) which can clear your concepts on this. Also, you can go through SQL Server help if that suits you.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-04-09 : 14:36:45
Using the JOIN syntax is ANSI compliant whereas what you are doing is not.

Tara Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -