Right join with where in clause : Right Outer Joins « Table Joins « Oracle PL / SQL






Right join with where in clause

   

SQL>
SQL>
SQL> CREATE TABLE emp
  2  (
  3     cid                NUMBER,
  4     lname         VARCHAR2(40) ,
  5     city              VARCHAR2(30) ,
  6     customer_state             VARCHAR2(40),
  7     country_id                 CHAR(2) ,
  8     customer_credit            NUMBER
  9  );

Table created.

SQL>
SQL> CREATE TABLE sales(
  2    product_id                NUMBER(6),
  3    cid               NUMBER,
  4    time_id                   DATE,
  5    channel_id                CHAR(1),
  6    promo_id                  NUMBER(6),
  7    sold             NUMBER(3),
  8    amount                    NUMBER(10,2),
  9    cost                      NUMBER(10,2)
 10  );

Table created.

SQL>
SQL>
SQL>
SQL> select c.cid, c.lname, s.product_id, s.sold
  2  from sales s right join emp c
  3     on c.cid = s.cid
  4  where c.cid in (1,80);

no rows selected

SQL>
SQL> drop table sales;

Table dropped.

SQL> drop table emp;

Table dropped.

SQL>
SQL>

   
    
    
  








Related examples in the same category

1.right outer join between department table and employee table
2.Right outer joins:return all the rows from the table on the right instead of the table on the left
3.Group by and right join department id
4.Right Outer Join, room table and class table
5.Right Outer Join(room vs class)