Note that there are some explanatory texts on larger screens.

plurals
  1. POinner joins in oracle
    text
    copied!<p>I was thinking about the syntax of inner joins in Oracle's SQL implementation and here is something that seems a bit inconsistent:</p> <p>Let's say you have two relations loan(loan_number, branch_name, amount) and borrower(customer_name, loan_number). loan_number is the attribute common to both tables. Now, Oracle gives you two ways to express an inner join:</p> <pre><code>select * from loan, borrower where loan.loan_number = borrower.loan_number; </code></pre> <p>The above statement is equivalent to:</p> <pre><code>select * from loan inner join borrower on loan.loan_number = borrower.loan_number; </code></pre> <p>However, when expressing a cross join there is only one way to express it:</p> <pre><code>select * from loan, borrower; </code></pre> <p>The following statement is syntactically incorrect:</p> <pre><code>select * from loan inner join borrower; </code></pre> <p>This is invalid; Oracle expects the ON... part of the clause</p> <p>Given that an inner join is just a cross join with a filter condition, do you guys think that this is an inconsistency in Oracle's SQL implementation? Am I missing something? I'd be interested in hearing some other opinions. Thanks.</p> <p>As David pointed out in his answer the syntax is:</p> <pre><code>select * from loan cross join borrower; </code></pre> <p>Even though I was not aware of the above syntax I still think it's inconsistent. Having the cross join keyword in addition to allowing inner join without a join condition would be fine. A cross join is in fact an inner join without a join condition, why not express it as an inner join without the join condition? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload