Ask the Expert

Difference between select query and JOIN

What is the difference between a query like select a.field1,b.feild2 from Table1 a,Table2 b where a.id=b.fk_code and using JOIN?

    Requires Free Membership to View

In Oracle, I can write a query similar to the following:
SELECT a.field1, b.field2
FROM table1 a, table2 b
WHERE a.id=b.fk_code;
The above will join two tables together on the defined join condition (the WHERE clause). One of the criticisms of Oracle was that the join syntax above is not compliant with the widely accepted ANSI SQL standard syntax. An ANSI-compliant join statement similar to the above will look like the following:
SELECT a.field1, b.field2
FROM table1 a INNER JOIN table2 b
     ON a.id=b.fk_code;
The two statements will return identical results. A developer who creates applications for Oracle and other ANSI-compliant database platforms can now use the same syntax in each. ANSI-compliant joins were first available in Oracle 9i.

This was first published in February 2007

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: