What are joins in MySQL?

MySQL JOINS are used to retrieve data from multiple tables. A MySQL JOIN is performed whenever two or more tables are joined in a SQL statement. The tables are mutually related using primary and foreign keys.

There are different types of MySQL joins:

  • MySQL INNER JOIN (simple join): It is a default join. It returns records when the values match in the joining tables.
  • MySQL LEFT OUTER JOIN (LEFT JOIN): It returns all the records from the left table based on the matched records from the right table.
  • MySQL RIGHT OUTER JOIN ( RIGHT JOIN): It returns all the records from the right table based on the matched records from the left table.
  • MYSQL CROSS JOIN
  • FULL OUTER JOIN: It returns all the records that match from the left or right table.