Too much free time - ANSII SQL question
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Too much free time - ANSII SQL question

  1. #1
    Join Date
    Aug 2002
    Location
    Atlanta
    Posts
    1,187

    Too much free time - ANSII SQL question

    So I got nothing better to do today so I'm messing with some ANSII sql.

    Why would you ever want to use the ON clause?

    For example, if I could use

    SELECT e.employee_id, e.last_name, d.location_id
    FROM employees e JOIN departments d USING (department_id)

    Tnen why would I even think of using


    SELECT e.employee_id, e.last_name, d.location_id
    FROM employees e JOIN departments d ON (e.department_id = d.department_id)

    The 9i new features book says using the ON clause makes your SQL code easier to read.

    Any thoughts?

    Thanks much
    I'm stmontgo and I approve of this message

  2. #2
    Join Date
    Aug 2002
    Location
    Atlanta
    Posts
    1,187
    never mind, a 3 way join would be good for this, should have flipped on to the next page ;-)
    I'm stmontgo and I approve of this message

  3. #3
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    10 years ago the problem I had with Rdb's implementation of USING(department_id) was that neither d. nor e. aliases were allowed for the join column - it could only be refered to as "department_id". So if you had a third table with with a column "department_id" there was no simple way of resolving the ambiguity. (This may not be strict ANSII behaviour.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width