Quick Search:
 
 Oracle PL/SQL: RIGHT JOIN example and syntax Jump to:  
Category: >> Oracle PL/SQL >> RIGHT JOIN example and syntax  

<< lastnext >>

Snippet Name: RIGHT JOIN example and syntax

Description: The RIGHT JOIN (or RIGHT OUTER JOIN) keyword Return all rows from the right table (table_name2), even if there are no matches in the left table (table_name1).

A right outer join (or right join) closely resembles a left outer join, except with the tables reversed. Every row from the "right" table (B) will appear in the joined table at least once. If no matching row from the "left" table (A) exists, NULL will appear in columns from A for those records that have no match in A.

A right outer join returns all the values from the right table and matched values from the left table (NULL in case of no matching join predicate).

Also see:
» ANSI Joins: FULL JOIN
» ANSI Joins: OUTER JOIN
» ANSI Joins: CROSS JOIN
» ANSI Joins: INNER JOIN
» Self-join example and syntax
» FULL JOIN example and syntax
» LEFT JOIN example and syntax
» INNER JOIN example and syntax

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 07th, 2009

SELECT column_name(s)
FROM table_name1
RIGHT JOIN table_name2 
ON table_name1.column_name=table_name2.column_name
 
-- or
 
SELECT * 
FROM   employee RIGHT OUTER JOIN department 
          ON employee.DepartmentID = department.DepartmentID
 
 
-- for example:
SELECT Person.LastName, Person.FirstName, Sales.OrderNo
FROM Person
RIGHT JOIN Sales
ON Persons.P_Id=Sales.P_Id
ORDER BY Person.LastName 


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org