<

MySQL DIfferent Types of JOIN

MySQL JOINS can be used with SELECT statement. It is used to retrieve data from multiple tables. It is performed whenever you need to fetch records from two or more tables.


There are three types of MySQL joins:


  • b>MySQL INNER JOIN (also called simple join)

  • b>MySQL LEFT OUTER JOIN (also called LEFT JOIN)

  • b>MySQL RIGHT OUTER JOIN (also called RIGHT JOIN)


  • MYSQL INNER JOIN



    MySQL INNER JOIN return all rows from multiple tables where the join condition is satisfied. It is the most common type of join.


    MySQL INNER JOIN Syntax


    
    SELECT columns  
    FROM table1   
    INNER JOIN table2  
    ON table1.column = table2.column;  
    
    


    MySQL Left Outer Join



    LEFT OUTER JOIN returns all rows from the left hand table specified in the ON condition and only those rows from the other table where the join condition is fulfilled.


    MySQL LEFT OUTER JOIN Syntax


    
    SELECT columns  
    FROM table1  
    LEFT [OUTER] JOIN table2  
    ON table1.column = table2.column;  
    


    MySQL Right Outer Join

    MySQL Right Outer Join returns all rows from the RIGHT-hand table specified in the ON condition and only those rows from the other table where he join condition is fulfilled.


    MySQL RIGHT OUTER JOIN Syntax


    
    SELECT columns  
    FROM table1  
    RIGHT [OUTER] JOIN table2  
    ON table1.column = table2.column;  
    
    















    © copyright 2017-2022 Completedone pvt ltd.