Tutorials Hut

  • SQL Testing




  • What is Left Outer Join or Left JOIN
    with Example?

    The LEFT OUTER JOIN /LEFT JOIN returns all records from the left table and the matched records from the right table 

    A = B (+)

    If no matching rows found in the right table, NULL are used.

    SQL- Left Outer JOIN

    Syntax

    SELECT select_List FROM table1 
    LEFT JOIN table2 
    ON table1.column_name = table2.column_name;

    Example:

    Consider Employee table having below records.

    Employee_Table1

    Consider Department table having below records.

    DepartmentTable2

    List all Employees and their department irrespective whether they belongs to any department or not

    Select  e1.EmployeeID ,e1.Employee_FirstName ,e1.Employee_LastName ,e1.City , d.departmentID , d.departmentName  
    from Employee e1 LEFT JOIN Department d
    ON e1.departmentID=d.departmentID order by departmentID
    SQL left Outer Join



  • SQL Testing


















  • Leave a Reply

    Your email address will not be published. Required fields are marked *