| Start |
|---|
| CROSS JOIN A Example: This can also be written as: Here's an example of cross join in SQL between two tables: Sample Table: TABLEA Sample Table: TABLEB Now, If you execute the query: Output: This is how cross joining happens between two tables:
More about Cross Join: Oracle documentation (opens new window) |
| LEFT OUTER JOIN A Example: Even though ANSI syntax is the recommended (opens new window) way, it is likely to encounter legacy syntax very often. Using Here's an example of Left Outer Join between two tables: Sample Table: EMPLOYEE Sample Table: DEPT Now, If you execute the query: Output: |
| RIGHT OUTER JOIN A Example: As the unmatched rows of Here's an example of Right Outer Join between two tables: Sample Table: EMPLOYEE Sample Table: DEPT Now, If you execute the query: Output: Oracle (+) syntax equivalent for the query is: |
| FULL OUTER JOIN A Example: Here's an example of Full Outer Join between two tables: Sample Table: EMPLOYEE Sample Table: DEPT Now, If you execute the query: Output Here the columns that do not match has been kept NULL. |
| ANTIJOIN An antijoin returns rows from the left side of the predicate for which there are no corresponding rows on the right side of the predicate. It returns rows that fail to match (NOT IN) the subquery on the right side. Here's an example of Anti Join between two tables: Sample Table: EMPLOYEE Sample Table: DEPT Now, If you execute the query: Output: The output shows that only the rows of EMPLOYEE table, of which DEPTNO were not present in DEPT table. |
| INNER JOIN An INNER JOIN is a JOIN operation that allows you to specify an explicit join clause. Syntax TableExpression [ INNER ] JOIN TableExpression { ON booleanExpression | USING clause } You can specify the join clause by specifying ON with a boolean expression. The scope of expressions in the ON clause includes the current tables and any tables in outer query blocks to the current SELECT. In the following example, the ON clause refers to the current tables: |
| CROSS JOIN A Example: This can also be written as: Here's an example of cross join in SQL between two tables: Sample Table: TABLEA Sample Table: TABLEB Now, If you execute the query: Output: This is how cross joining happens between two tables:
More about Cross Join: Oracle documentation (opens new window) |
| SEMIJOIN A semijoin query can be used, for example, to find all departments with at least one employee whose salary exceeds 2500. This is more efficient than the full join alternatives, as inner joining on employees then giving a where clause detailing that the salary has to be greater than 2500 could return the same department numerous times. Say if the Fire department has |
| NATURAL JOIN NATURAL JOIN requires no explitic join condition; it builds one based on all the fields with the same name in the joined tables. The join will be done on the fields ID and DESCR, common to both the tables: Columns with different names will not be used in the JOIN condition: If the joined tables have no common columns, a JOIN with no conditions will be done: |
Read Article
https://develop.horje.com/learn/1434/reference