- SQL Basics
- SQL Home
- SQL Syntax
- SQL RDBMS
- SQL Databases
- SQL Data Types
- SQL Operators
- SQL Expressions
- SQL Database
- SQL Create Database
- SQL Select Database
- SQL Drop Database
- SQL Table
- SQL Create Table
- SQL Drop Table
- SQL Keywords
- SQL Insert Into
- SQL Select
- SQL Where
- SQL And & Or
- SQL Update
- SQL Delete
- SQL Like
- SQL Select Top
- SQL Group By
- SQL Order By
- SQL Distinct
- SQL In
- SQL Between
- SQL Joins
- SQL Joins
- SQL Inner Join
- SQL Left Join
- SQL Right Join
- SQL Full Join
- SQL Constraints
- SQL Constraints
- SQL Unique
- SQL Not Null
- SQL Primary Key
- SQL Foreign Key
- SQL Check
- SQL Default
- SQL Create Index
- SQL Advance
- SQL Aliases
- SQL Union
- SQL Auto Increment
- SQL Views
- SQL Dates
- SQL Transactions
- SQL Injection
- SQL Test
- SQL Online Test
- Give Online Test
- All Test List
SQL Left Join
SQL LEFT JOIN keyword is used to return all the rows from the left table (i.e., table1 here), with matching rows in the right table (i.e., table2 here). The result is NULL in the right side, in case when there is no match found. Here is the general form of the LEFT JOIN keyword in SQL:
SELECT column_name(s) FROM table1 LEFT JOIN table2 ON table1.column_name=table2.column_name;
Or,
SELECT column_name(s) FROM table1 LEFT OUTER JOIN table2 ON table1.column_name=table2.column_name;
Note - In some databases, the LEFT JOIN is also called as LEFT OUTER JOIN.
SQL Demo Database
Let us assume that we have the following two table with named "Admissions" and "Students". The first one is Admissions table and the second one is Students table:


SQL LEFT JOIN Keyword Example
Here is an example of LEFT JOIN keyword in SQL. The following SQL statement will return all the Students present in both the table:
SELECT Students.Name, Admissions.StudentID FROM Students LEFT JOIN Admissions ON Students.StudentID=Admissions.StudentID ORDER BY Students.Name;
After querying the above SQL statements, you will get the following output:

Note - The SQL LEFT JOIN keyword returns all the rows from the left table (i.e., Students), even if there are no matches found in the right table (i.e., Admissions).
Here, you are watching that the one column of a student named "Aman Singh" is not displaying i.e. the StudentID, since the StudentID of this student is 1, that is not matching with the other table but displayed here. Since the LEFT JOIN keyword displays all the matching rows in the right table (i.e., table2). The result is NULL in the right side when there is no match found.
« Previous Tutorial Next Tutorial »
Like/Share Us on Facebook 😋