Learn T-SQL Commands with Samples
Skip Navigation Links
Skip Navigation Links.
Expand DatabaseDatabase
Expand TableTable
Expand ViewView
Expand Stored ProcedureStored Procedure
Expand Data FilteringData Filtering
Expand Data GroupingData Grouping
Collapse JoinsJoins
Expand TriggerTrigger
Expand CursorCursor
Expand OperatorsOperators
Expand ConstraintsConstraints
Expand FunctionsFunctions
Expand Conditional ProcessingConditional Processing
Expand LoopingLooping
Expand Error HandlingError Handling
Expand v.IMP Queriesv.IMP Queries
Expand XMLXML
Expand Query PerformanceQuery Performance
Expand QueriesQueries
Expand NormalizationNormalization
Expand CreateCreate
     

Left Join

 
      
Capitals
Country Capital
India New Delhi
USA Washington
France Paris
Continents
Country Continent
India Asia
USA N.America
Italy Europe
      
---- Returns all the rows from the first Table, even if there are no matches in the second Table.
SELECT Capitals.*, Continents.Continent FROM Capitals LEFT JOIN Continents ON Capitals.Country=Continents.Country
      
Output
Country Capital Continent
India New Delhi Asia
USA Washington N.America
France Paris NULL