bing
Flat 10% & upto 50% off + 10% Cashback + Free additional Courses. Hurry up
×
UPTO
50%
OFF!
Intellipaat
Intellipaat

What is Left Join in SQL?

Left Join is a keyword, which is used to select all rows from the left table and also the matched values between the two tables.

Watch this Left Join in SQL video

Left Join in SQL

The Left Join in SQL basically returns all records from the left table and the matched records from the right tables. For example, let’s say, we have two tables, Table A and Table B. When Left Join is applied on these two tables, all records from Table A and only the matched records from Table B will be displayed.

A Brief Introduction to Left Join

Syntax

SELECT columns
FROM table1 name
LEFT JOIN table2 name
ON table1.coumn_x = table2.column_y;

where SELECT, LEFT JOIN, and ON are the keywords, columns is the list of columns, table1 is the first table and table2 is the second table, and column_x and column_y are the columns for performing the left join, followed by a semicolon.

Example

Let’s apply Left Join to two tables, the employee table and the department table

Select employee.e_name, employee.e_dept, department.d_name, department.d_location from employee
LEFT JOIN department
ON employee.e_dept = department.d_name;

syntax 2

After writing the query, click on the execute button to check for errors. Once the query is executed, a message appears like ‘Commands completed successfully’

This brings us to the end of this Left Join in SQL tutorial section Go ahead and link the tables from your database to get a better insight of your data. In the next tutorial section, we will discuss on the Right Join.

Previous Next

Download Interview Questions asked by top MNCs in 2019?

"0 Responses on Left Join in SQL - SQL Left Joins"

    Leave a Message

    100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.
    top

    Sales Offer

    Sign Up or Login to view the Free Left Join in SQL - SQL Left Joins.