MySQL Joins
MySQL Joins
In this tutorial, we will learn MySQL Joins. We can combine data from multiple tables, using the MySQL JOIN keyword. A join operation produces result by combining or joining information in one table with information in another table.
The main categories of joins are as follows:
- Cross Join
- Inner Join
- Outer Join
Syntax
The basic join syntax is shown below:
SELECT table1.column, table2.column, ..
FROM table1 JOIN table2
ON (table1.common_column=table2.common_column)
WHERE <conditions>
Cross Join
Cross Join is also called a Cartesian Product. Cross Join yields all possible combinations of rows. The Cross Join combines all the rows from one table with all the rows of another table
When the tables are cross-joined, each row from one table is combined with each row from every other participating table.
For example, if Table A has 5 rows and Table B has 10 rows. The Cartesian Product of the two tables will yield
= 5 * 10 = 50 rows
INNER JOIN
An INNER JOIN identifies matching rows from the joined tables.
https://www.testingdocs.com/mysql-inner-join/
OUTER JOIN
An INNER JOIN finds matching rows from the joined tables. OUTER JOIN will also finds instances of rows in one table that has no match in another table in the join.
https://www.testingdocs.com/mysql-outer-join/
—
MySQL Tutorials
MySQL Tutorials on this website:
https://www.testingdocs.com/mysql-tutorials-for-beginners/