MySQL Tutorial
JOIN means "to combine two or more tables".
A JOIN clause is used to combine rows from two or more tables, based on a related column between them
We've a table named Students and Teachers in our database that contains the following records:
ROLL_NO | NAME | SUBJECT |
---|---|---|
1 | Will | C++ |
2 | SAM | Python |
3 | Rani | Node.js | 4 | Rim | Java |
5 | Micheal | JAVA |
6 | Lara | PHP |
TECH_NO | NAME | SUBJECT | ROLL_NO |
---|---|---|---|
20 | Kayla | PHP | 6 |
21 | Albert | Java | 2 |
21 | Albert | Java | 5 |
22 | Helen | Node.js | 3 | 23 | Anne | Python | 2 |
24 | Jaime | C++ | 1 |
Notice that the "ROLL_NO" column in the "Teachers" table refers to the "ROLL_NO" in the "Students" table. The relationship between the two tables above is the "ROLL_NO" column.
We can make different type of Join statement with this kind of relations in a table.