Join question


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.

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

Thanks in advance.

Who is Participating?
krznpskConnect With a Mentor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.