LEFT OUTER JOIN tableName ON joined columns : Left Outer Join « Table Joins « Oracle PL / SQL

Home
Oracle PL / SQL
1.Aggregate Functions
2.Analytical Functions
3.Char Functions
4.Constraints
5.Conversion Functions
6.Cursor
7.Data Type
8.Date Timezone
9.Hierarchical Query
10.Index
11.Insert Delete Update
12.Large Objects
13.Numeric Math Functions
14.Object Oriented Database
15.PL SQL
16.Regular Expressions
17.Report Column Page
18.Result Set
19.Select Query
20.Sequence
21.SQL Plus
22.Stored Procedure Function
23.Subquery
24.System Packages
25.System Tables Views
26.Table
27.Table Joins
28.Trigger
29.User Previliege
30.View
31.XML
Oracle PL / SQL » Table Joins » Left Outer Join 
LEFT OUTER JOIN tableName ON joined columns
 

SQL>
SQL> CREATE TABLE emps (
  2    emp varchar(30)
  3   ,title    varchar(30)
  4  );

Table created.

SQL>
SQL> INSERT INTO emps VALUES ('Tom','Programmer');

row created.

SQL> INSERT INTO emps VALUES ('Jack','Tester');

row created.

SQL> INSERT INTO emps VALUES ('Mary','Technician');

row created.

SQL>
SQL> CREATE TABLE JobLevel (
  2    title     varchar(30)
  3   ,rank    varchar(30)
  4  );

Table created.

SQL>
SQL> INSERT INTO JobLevel VALUES ('Programmer','Level1');

row created.

SQL> INSERT INTO JobLevel VALUES ('Tester','Level2');

row created.

SQL> INSERT INTO JobLevel VALUES ('Technician','Level3');

row created.

SQL>
SQL> CREATE TABLE salary (
  2    rank     varchar(30)
  3   ,payment  DECIMAL(10,2)
  4  );

Table created.

SQL>
SQL> INSERT INTO salary VALUES ('Level1',2000.00);

row created.

SQL> INSERT INTO salary VALUES ('Level2',3000.00);

row created.

SQL> INSERT INTO salary VALUES ('Level3',5000.00);

row created.

SQL> INSERT INTO salary VALUES ('Level4',6000.00);

row created.

SQL>
SQL> select from emps;



EMP
------------------------------
TITLE
------------------------------
Tom
Programmer

Jack
Tester

Mary
Technician


rows selected.

SQL> select from JobLevel;



TITLE
------------------------------
RANK
------------------------------
Programmer
Level1

Tester
Level2

Technician
Level3

rows selected.

SQL> select from salary;



RANK                               PAYMENT
------------------------------  ----------
Level1                                2000
Level2                                3000
Level3                                5000
Level4                                6000

rows selected.

SQL>
SQL>
SQL> SELECT salary.rank
  2  FROM salary LEFT OUTER JOIN JobLevel ON (salary.rank = JobLevel.rank)
  3  WHERE JobLevel.rank IS NULL;



RANK
------------------------------
Level4


row selected.

SQL>
SQL>
SQL> DROP TABLE emps;

Table dropped.

SQL> DROP TABLE JobLevel;

Table dropped.

SQL> DROP TABLE salary;

Table dropped.

SQL>
SQL>

   
  
Related examples in the same category
1.left outer join between employee table and department table
2.Left outer join demo
3.A left outer join:the outer join operator appears on the right of the equality operator
4.LEFT OUTER JOIN vs RIGHT OUTER JOIN
5.Left join with plus sign
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.