top of page
khushbupatel061997

MySQL JOINS

Updated: Apr 5, 2024

MySQL JOINS are 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:

  1. MySQL Inner Join (called Simple join)

  2. MySQL Outer Join (called Left join)

  3. MySQL Right Join (called Right join)


MySQL Inner Join (Simple join):


It is used to return all rows from multiple tables where the join condition is satisfied. It is the most common type of join.


Syntax:

SELECT columns

FROM table1

INNER JOIN table2

ON table1.column = table2.column;



MySQL Left Outer Join:


The Left Outer join returns all rows from the left hand table specified in the ON condition and only those rows from other table where the join condition is fulfilled.


Syntax:

SELECT columns

FROM table1

LEFT [OUTER] JOIN table2

ON table1.column = table2.column;



MySQL Right Outer Join:


The 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 the join condition is fulfilled.


Syntax:

SELECT columns

FROM table1

RIGHT [OUTER] JOIN table2

ON table1.column = table2.column;




15 views0 comments

Recent Posts

See All

Battle of the Backends: Java vs Node.js

Comparing Java and Node.js involves contrasting two distinct platforms commonly used in backend development. Here’s a breakdown of their...

Comentarios


bottom of page