Right join in MySQL

MySQL right Join

In right join type of MySQL, all records from the right table, the one after the join clause are fetched. While only the matched rows from the left table are returned. As using the right join, the values in empty rows of the left table are shown as Null values.

Right join syntax

This is how right join is used:

Select * from table_name1

right Join table_name2 ON table_name1.common_field = table_name2.common_field

A right join example

For our example, we will use the departmental store scenario. Consider a departmental store database tables:

  1. tbl_employee
  2. tbl_customers_orders

The MySQL right join query:

In above query’s output, you can see all records are fetched from the right table.

Was this article helpful?

Related Articles

Leave A Comment?