top of page
Writer's pictureShital Patel

MySQL JOINS

MySQL JOINS are utilized in conjunction with the SELECT statement to retrieve data from multiple tables simultaneously. This operation becomes necessary whenever there's a need to gather records from two or more tables.

 

There exist three primary types of MySQL joins:

 

1. MySQL Inner Join (referred to as Simple join):

  - This type of join returns all rows from multiple tables where the specified join condition is met. It stands out as the most commonly used join type.

 

  Syntax:

  SELECT columns

  FROM table1

  INNER JOIN table2

  ON table1.column = table2.column;

 

 

2. MySQL Left Outer Join:

  - The Left Outer join fetches all rows from the left-hand table mentioned in the ON condition, along with those rows from the other table where the join condition is satisfied.

 

  Syntax:

  SELECT columns

  FROM table1

  LEFT [OUTER] JOIN table2

  ON table1.column = table2.column;

 

3. MySQL Right Outer Join:

  - Conversely, the Right Outer Join retrieves all rows from the right-hand table stated in the ON condition, in addition to those rows from the opposing table where the join condition holds true.

 

  Syntax:

  SELECT columns

  FROM table1

  RIGHT [OUTER] JOIN table2

  ON table1.column = table2.column;

6 views0 comments

Recent Posts

See All

Comments


bottom of page