Solved

SQL JOIN syntax

Posted on 2012-12-25
3
496 Views
Last Modified: 2012-12-25
When doing SQL JOINS is see two different syntax for what seems to be the same thing, one using the JOIN syntax and one not.  See examples.

Code 1
SELECT Address.City, Name.NameFirst
from Address, Name
Where Address.AddressId = Name.AddressId

Code 2
SELECT Address.City, Name.NameFirst
    from Address
    join Name
    on name.addressid = address.addressid

Needless to say there are many variations, but the fundamental difference seems to be using the FROM <table1>, <table2>
versus using JOIN <table2>
Even the variations of Left, Right, inner, outer seem easier managed with the Code 1 concept.

To me same Code 1 seems lots simpler.
0
Comment
Question by:hconant
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38720406
Was there a question in there somewhere?
0
 

Author Comment

by:hconant
ID: 38720408
The question is, when and why would you need to use the JOIN syntax as both styles seem the same.  And is it simply a matter of style?  Just trying to learn best methods.
0
 
LVL 42

Accepted Solution

by:
pcelba earned 250 total points
ID: 38720413
Code1 and Code2 is identical for INNER JOINs.
The Code1 is older concept and not all SQL dialects allow to specify OUTER JOIN by operator in WHERE clause.

OTOH, Code1 allows CROSS JOIN which is not available in all SQL dialects supporting JOIN clause...

So, use the way which better fits to you and your SQL engine specifications. Everything else is a work for SQL optimization.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

733 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