Clause in SQL Natural Join

  • SELECT * FROM TAB1 NATURAL JOIN TAB2
    ON(CONDITION);

    This query gives an error.

    SELECT * FROM TAB1 NATURAL JOIN TAB2
    WHERE(CONDITION);

    This question was executed effectively.

    So Why the WHERE clause is used instead of ON clause in SQL Natural Join?

  • SQL Server doesn't support Natural JOINs, so what RDBMS is this for?

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • If I understood well, a natural join is supposed to have no ON-clause as it uses matching column names

    ref: https://www.geeksforgeeks.org/sql-natural-join/

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • The WHERE clause is not used instead of an ON clause. The WHERE clause is always, logically, that is, a filter of the result of the FROM-JOIN operations.

    As Johan says, NATURAL JOIN does not use ON, because the join condition is inferred by column matching names. Which I will have to say, I find quite odd. But I may be missing something, as the database product I work with, Microsoft SQL Server, does not support NATURAL JOIN.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply