blog post

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

The SQL LEFT JOIN syntax

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

The genera LEFT OUTER JOIN syntax is:
SELECT OrderNumber, TotalAmount, FirstName, LastName, City, Country
  FROM Customer C LEFT JOIN [Order] O
    ON O.CustomerId = C.Id
ORDER BY TotalAmount

This will list all customers, whether they placed any order or not.
The ORDER BY TotalAmount shows the customers without orders first (i.e. TotalMount is NULL).

  • 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


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