Database system
concept
JOINED RELATION
PREPARED BY
Ms.M.Raihana Begum -III-B.Sc - Information Technology
UNDER THE GUIDANCE OF
Mrs.P.Anusha M.Sc(IT).,M.Phil.,D.P.T.T.,(Ph.D).,
Assistant professor,
Department of Information Technology,
Bon secours college for women,
Thanjavur.
Select * from emp;
Select * from emp1;
JOIN:
A join clause is used to combine rows
from two or more tables, based on a
related column between them.
QUERY:
Select * from table1 join table2;
NATURAL JOIN
• The natural join operation forms a cartesian
product of its two arguments, performs selection
forcing equality on those attributes that appear in
both relation schema a finally remove duplicate
attributes.
QUERY:
Select * from table 1 natural join table 2;
Example
Select * from emp natural join emp1;
Select * from empfull;
Select * from emppartime;
INNER JOIN
Returns record that have matching values in both the
table.
QUERY:
Select table1.colum_name from table1 inner join
table2 on table1.column_name=table2.column_name
• Example:
select empfull.name form empfull innerjoin emppartime on
empfull.emp_id=emppartime.emp_id;
LEFT OUTER JOIN
• Returns all records from the left table, and the
matched records from the right table.
QUERY:
Select table name1. column name from table
name1 left join on table name2.column
name=table name2.column name;
• EXAMPLE:
Select empfull.name from empfull left join
emppartime on empfull.emp_id=emppartime.emp_id;
RIGHT OUTER JOIN
• Returns all records from the right table, and the
matched records from the left table.
QUERY:
Select table name1.column name from table
name1 right join table name2 on table
name1.column name=table name2.column name
EXAMPLE:
Select empfull.name from empfull right join emppartime on
empfull.emp_id = emppartime.emp_id;

join relation.pptx

  • 1.
  • 2.
    PREPARED BY Ms.M.Raihana Begum-III-B.Sc - Information Technology UNDER THE GUIDANCE OF Mrs.P.Anusha M.Sc(IT).,M.Phil.,D.P.T.T.,(Ph.D)., Assistant professor, Department of Information Technology, Bon secours college for women, Thanjavur.
  • 3.
  • 4.
  • 5.
    JOIN: A join clauseis used to combine rows from two or more tables, based on a related column between them. QUERY: Select * from table1 join table2;
  • 7.
    NATURAL JOIN • Thenatural join operation forms a cartesian product of its two arguments, performs selection forcing equality on those attributes that appear in both relation schema a finally remove duplicate attributes. QUERY: Select * from table 1 natural join table 2;
  • 8.
    Example Select * fromemp natural join emp1;
  • 9.
    Select * fromempfull;
  • 10.
    Select * fromemppartime;
  • 11.
    INNER JOIN Returns recordthat have matching values in both the table. QUERY: Select table1.colum_name from table1 inner join table2 on table1.column_name=table2.column_name
  • 12.
    • Example: select empfull.nameform empfull innerjoin emppartime on empfull.emp_id=emppartime.emp_id;
  • 13.
    LEFT OUTER JOIN •Returns all records from the left table, and the matched records from the right table. QUERY: Select table name1. column name from table name1 left join on table name2.column name=table name2.column name;
  • 14.
    • EXAMPLE: Select empfull.namefrom empfull left join emppartime on empfull.emp_id=emppartime.emp_id;
  • 15.
    RIGHT OUTER JOIN •Returns all records from the right table, and the matched records from the left table. QUERY: Select table name1.column name from table name1 right join table name2 on table name1.column name=table name2.column name
  • 16.
    EXAMPLE: Select empfull.name fromempfull right join emppartime on empfull.emp_id = emppartime.emp_id;