Solved

Join question

Posted on 2003-11-15
1
417 Views
Last Modified: 2008-03-06
Hello,

Is there any difference between these two select commands?

(from the sample 'Pubs' database in MS SQL Server 2000)

----------------------------------------------------------
select T.title, P.pub_name
from titles T
   join publishers P on (T.pub_id = P.pub_id);
-----------------------------------------------------------
select T.title, P.pub_name
from titles T, publishers P
where (T.pub_id = P.pub_id);
----------------------------------------------------------

I know that they return the same records.

But I learned in my Oracle classes (in college) to do joins like the second select.
And now I am reading a MS SQL Server book that teaches joins like in the first select.

So.....
Is there a "better" way, or it's just a matter of personal taste?

Thanks in advance.


0
Comment
Question by:LeoHyppolito
1 Comment
 
LVL 4

Accepted Solution

by:
krznpsk earned 50 total points
Comment Utility
That's because Oracle didn't support the JOIN keyword until version 9i.

MS SQL is compliant either way you type it, but the JOIN syntax is recommended.  One reason is that you can qualify the JOIN type, as in INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, and CROSS JOIN.

INNER JOIN is the default, and using only the JOIN keyword will perform an INNER JOIN.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now