JOINS IN
ORACLE-different joins in oracle with examples
1. The
purpose of a join is to combine the data across tables.2. A
join is actually performed by the where clause which combines the specified
rows of tables.3. If
a join involves in more than two tables then Oracle joins
first two tables based on the joins condition and then compares the result with
the next table and so on. TYPES1 Equi
join2 Non-equi
join3 Self
join4 Natural
join5 Cross
join6 Outer
join ·
Left outer ·
Right outer ·
Full outer 7 Inner
join8 Using
clause9 On
clause Assume that we have the following tables.SQL> select * from dept;
DEPTNO
|
DNAME
|
LOC
|
10
|
INVENTORY
|
HYBD
|
20
|
FINANCE
|
BGLR
|
30
|
HR
|
MUMBAI
|
EMPNO
|
ENAME
|
JOB
|
MGR
|
DEPTNO
|
111
|
smita
|
analyst
|
444
|
10
|
222
|
sudha
|
clerk
|
333
|
20
|
333
|
jagan
|
manager
|
111
|
10
|
444
|
madhu
|
engineer
|
222
|
40
|
EMPNO
|
ENAME
|
JOB
|
DNAME
|
LOC
|
111
|
smita
|
analyst
|
INVENTORY
|
HYBD
|
333
|
jagan
|
manager
|
INVENTORY
|
HYBD
|
222
|
sudha
|
clerk
|
FINANCE
|
BGLR
|
EMPNO
|
ENAME
|
JOB
|
DNAME
|
LOC
|
111
|
smita
|
analyst
|
INVENTORY
|
HYBD
|
333
|
jagan
|
manager
|
INVENTORY
|
HYBD
|
222
|
sudha
|
clerk
|
FINANCE
|
BGLR
|
EMPNO
|
ENAME
|
JOB
|
DNAME
|
LOC
|
111
|
smita
|
analyst
|
INVENTORY
|
HYBD
|
333
|
jagan
|
manager
|
INVENTORY
|
HYBD
|
222
|
sudha
|
clerk
|
FINANCE
|
BGLR
|
EMPNO
|
ENAME
|
JOB
|
DNAME
|
LOC
|
222
|
sudha
|
clerk
|
INVENTORY
|
HYBD
|
444
|
madhu
|
engineer
|
INVENTORY
|
HYBD
|
444
|
madhu
|
engineer
|
FINANCE
|
BGLR
|
444
|
madhu
|
engineer
|
HR
|
MUMBAI
|
EMPNO
|
ENAME
|
JOB
|
DEPTNO
|
111
|
jagan
|
analyst
|
10
|
222
|
madhu
|
clerk
|
40
|
333
|
sudha
|
manager
|
20
|
444
|
smita
|
engineer
|
10
|
EMPNO
|
ENAME
|
JOB
|
DNAME
|
LOC
|
111
|
smita
|
analyst
|
INVENTORY
|
HYBD
|
333
|
jagan
|
manager
|
INVENTORY
|
HYBD
|
222
|
sudha
|
clerk
|
FINANCE
|
BGLR
|
EMPNO
|
ENAME
|
JOB
|
DNAME
|
LOC
|
111
|
smita
|
analyst
|
INVENTORY
|
HYBD
|
222
|
sudha
|
clerk
|
INVENTORY
|
HYBD
|
333
|
jagan
|
manager
|
INVENTORY
|
HYBD
|
444
|
madhu
|
engineer
|
INVENTORY
|
HYBD
|
111
|
smita
|
analyst
|
FINANCE
|
BGLR
|
222
|
sudha
|
clerk
|
FINANCE
|
BGLR
|
333
|
jagan
|
manager
|
FINANCE
|
BGLR
|
444
|
madhu
|
engineer
|
FINANCE
|
BGLR
|
111
|
smita
|
analyst
|
HR
|
MUMBAI
|
222
|
sudha
|
clerk
|
HR
|
MUMBAI
|
333
|
jagan
|
manager
|
HR
|
MUMBAI
|
444
|
madhu
|
engineer
|
HR
|
MUMBAI
|
EMPNO
|
ENAME
|
JOB
|
DNAME
|
LOC
|
111
|
smita
|
analyst
|
INVENTORY
|
HYBD
|
333
|
jagan
|
manager
|
INVENTORY
|
HYBD
|
222
|
sudha
|
clerk
|
FINANCE
|
BGLR
|
444
|
madhu
|
engineer
|
EMPNO
|
ENAME
|
JOB
|
DNAME
|
LOC
|
111
|
smita
|
analyst
|
INVENTORY
|
HYBD
|
333
|
jagan
|
manager
|
INVENTORY
|
HYBD
|
222
|
sudha
|
clerk
|
FINANCE
|
BGLR
|
HR
|
MUMBAI
|
EMPNO
|
ENAME
|
JOB
|
DNAME
|
LOC
|
333
|
jagan
|
manager
|
INVENTORY
|
HYBD
|
111
|
smita
|
analyst
|
INVENTORY
|
HYBD
|
222
|
sudha
|
clerk
|
FINANCE
|
BGLR
|
444
|
madhu
|
engineer
|
||
HR
|
MUMBAI
|
EMPNO
|
ENAME
|
JOB
|
DNAME
|
LOC
|
111
|
smita
|
analyst
|
INVENTORY
|
HYBD
|
333
|
jagan
|
manager
|
INVENTORY
|
HYBD
|
222
|
sudha
|
clerkx`
|
FINANCE
|
BGLR
|
No comments:
Post a Comment