---
title: "How many ways to join the table in MySQL? Explain with examples."  
description: "How many ways to join the table in MySQL? Explain with examples."  
author: "Revati S Misra"  
published: 2023-03-24  
updated: 2023-04-10  
canonical: https://www.mindstick.com/forum/157565/how-many-ways-to-join-the-table-in-mysql-explain-with-examples  
category: "mysql"  
tags: ["database", "mysql", "sql server"]  
reading_time: 2 minutes  

---

# How many ways to join the table in MySQL? Explain with examples.

How many ways to [join](https://www.mindstick.com/articles/1487/join-sleep-and-interrupt-methods-in-c-sharp-threading) the [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) in [MySQL](https://www.mindstick.com/articles/12156/what-is-mysql)? [Explain](https://www.mindstick.com/forum/157854/what-is-system-debugging-explain-some-system-debugging-tools-used-in-modern-computer-systems) each with an example.

## Replies

### Reply by Rocky Dada

In MySQL, there are several ways to join tables together. Here are the most common types of joins:

![How many ways to join the table in MySQL? Explain with examples.](https://www.mindstick.com/mindstickforums/541fe482-9c12-40a7-85e1-80792a1ed970/images/7adc2716-85a3-4fbc-b185-50cd88326b5e.png)

**INNER JOIN:** This type of join returns only the rows that have matching values in both tables. It is the most commonly used type of join.

## Example:

`SELECT * FROM table1 INNER JOIN table2 ON table1.column_name = table2.column_name;`

**LEFT JOIN:** This type of join returns all the rows from the left table and the matching rows from the right table. If there are no matching rows in the right table, the result will contain NULL values for the right table columns.

## Example:

`SELECT * FROM table1 LEFT JOIN table2 ON table1.column_name = table2.column_name;`

**RIGHT JOIN:** This type of join returns all the rows from the right table and the matching rows from the left table. If there are no matching rows in the left table, the result will contain NULL values for the left table columns.

## Example:

`SELECT * FROM table1 RIGHT JOIN table2 ON table1.column_name = table2.column_name;`

**FULL OUTER JOIN:** This type of join returns all the rows from both tables. If there are no matching rows in either table, the result will contain NULL values for the columns from the table that does not have a matching row.

## Example:

`SELECT * FROM table1 FULL OUTER JOIN table2 ON table1.column_name = table2.column_name;`

**CROSS JOIN:** This type of join returns the Cartesian product of both tables, meaning that it returns all possible combinations of rows from both tables.

## Example:

`SELECT * FROM table1 CROSS JOIN table2;`

These are the most commonly used types of joins in MySQL. Depending on your specific requirements, you may need to use a different type of join or a combination of different types of joins to achieve the desired result.


---

Original Source: https://www.mindstick.com/forum/157565/how-many-ways-to-join-the-table-in-mysql-explain-with-examples

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
