Joins

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Joins as PDF for free.

More details

  • Words: 178
  • Pages: 2
SQL JOINS SQL> select * from persons; P_ID LAST_NAME FIRST_NAME ADDRESS CITY --------- ----------- --------------- ------------- ----------1 Kondawar Kapil N-1 CIDCO Aurangabad 2 Sanadi Pravin N-3 CIDCO Aurangabad 3 Mandil Shashank Khadkeshwar Aurangabad SQL> select * from orders; O_ID ORDER_NUM P_ID --------- --------- --------1 1111 3 2 2222 3 3 3333 1 4 4444 1 5 5555 15

INNER JOIN SQL> select p.p_id,last_name,first_name,o_id,order_num from persons p,orders o where p.p_id=o.p_id; P_ID --------3 3 1 1

LAST_NAME --------------Mandil Mandil Kondawar Kondawar

FIRST_NAME O_ID ORDER_NUM ---------- --------- --------Shashank 1 1111 Shashank 2 2222 Kapil 3 3333 Kapil 4 4444

LEFT JOIN SQL> select p.p_id,last_name,first_name,o_id,order_num from persons p,orders o where p.p_id=o.p_id(+) P_ID --------1 1 2 3 3

LAST_NAME --------------Kondawar Kondawar Sanadi Mandil Mandil

FIRST_NAME O_ID ORDER_NUM ---------- --------- --------Kapil 3 3333 Kapil 4 4444 Pravin Shashank 1 1111 Shashank 2 2222

RIGHT JOIN SQL>select p.p_id,last_name,first_name,o_id,order_num from persons p,orders o where p.p_id(+)=o.p_id

P_ID LAST_NAME FIRST_NAME O_ID ORDER_NUM ------ --------------- ---------- --------- --------3 Mandil Shashank 1 1111 3 Mandil Shashank 2 2222 1 Kondawar Kapil 3 3333 1 Kondawar Kapil 4 4444 5 5555

Related Documents

Joins
May 2020 14
Joins
November 2019 16
Joins
November 2019 23
Joins
November 2019 22
Joins
November 2019 18
Joins And Outer Joins
June 2020 4