Professional Documents
Culture Documents
OBJECTIVES
keyword.
These are:
The NATURAL JOIN
The USING Clause
The CROSS Join
The Full Outer Join and
The arbitrary join conditions for outer joins.
THE NATURAL JOIN
FORMAT:
SELECT column_name
FROM table_name1
NATURAL JOIN table_name2
WHERE condition
EXAMPLE:
This would only display the columns with a
department_id greater than 30;
TABLE ALIASES
FORMAT:
statement.
SELF JOINS
EXERCISE:
Query the employees table for possible father and son
relationship among employees.
To do that, you have to know if the last_name
of any employee is the same as the
first_name of any other employee.
We are told that no data is found, that is to
say, such scenario does not exist.
EXERCISE:
Search the employees table for
employees who are managers.
These are employees whose employee_id
is the same as their manager_id
NON EQUIJOINS
If you write a JOIN Query, and you fail to specify the JOIN
condition the Oracle Database optimizer returns
their CARTESIAN PRODUCT.
Oracle combines each row of one table, with each
row of the other table, resulting in many rows that
are rarely useful.