SQL Left Outer Join With Example


Left Join In SQL With Example (Left Outer Joins)

In SQL, a LEFT JOIN is used to retrieve records from one table (the "left" table) along with matching records from another table (the "right" table). The result set of a LEFT JOIN includes all the records from the left table and the matching records from the right table. If there are no matching records in the right table, NULL values are returned for the columns of the right table.

Syntax of Left Join 
The syntax for a LEFT JOIN is as follows:

SELECT columns
FROM left_table
LEFT JOIN right_table ON join_condition;

Example of outer Join 

Let's consider an example to illustrate the usage of a LEFT JOIN. Suppose we have two tables: "customers" and "orders." The "customers" table contains information about customers, and the "orders" table contains information about orders placed by customers.

select Cust.first_name, Od.item From Customers as Cust 
left join Orders as Od 
on Cust.customer_id=Od.customer_id

Hope!!! The above Tutorial on Left Join In SQL With Examples is helpful For You...

QA acharya

Left Joins in SQL With Examples 

Post a Comment