blog post

RIGHT JOIN performs a join starting with the second (right-most) table and then any matching first (left-most) table records.
RIGHT JOIN and RIGHT OUTER JOIN are the same.
Right img

The SQL RIGHT JOIN syntax

The general syntax is:
SELECT column-names
  FROM table-name1 RIGHT JOIN table-name2 
    ON column-name1 = column-name2
 WHERE condition

The general RIGHT OUTER JOIN syntax is:
SELECT column-names
  FROM table-name1 RIGHT OUTER JOIN table-name2 
    ON column-name1 = column-name2
 WHERE condition
 

SQL RIGHT JOIN Example

Problem: List customers that have not placed orders
SELECT TotalAmount, FirstName, LastName, City, Country
  FROM [Order] O RIGHT JOIN Customer C
    ON O.CustomerId = C.Id
WHERE TotalAmount IS NULL

This returns customers that, when joined, have no matching order.

SQL RIGHT JOIN
  • Share This Story


Pleas give your valuable comments to improve the contents.

about author

Atul kumar shukla


I'm Atul Kumar Shukla, working as a web developer.
Welcome to my Blog. This is my personal blog where i post my own questions and answers , articles about ASP.Net., SQL Server, HTML, CSS, Jquery and many more..

Visit Profile

Leave a comment

Name
E-mail
Url
Message

Get More Stuff
Subscribing to the TheOneblogs newsletter and get intersting stuff and updates to your email inbox.
Your Email

 

Style Switcher

Change Color

×! We use cookies to improve your user experience. More information