Python MySQLLesson 123Free preview
MySQL Join
This lesson is part of Python · All levels
Summary
This lesson explains how to combine data from two or more tables using JOIN on MySQL. The merger is based on the relationship between primary key and foreign key, with the ON clause determining the condition of matching. Different types of JOINs like INNER JOIN and LEFT JOINs produce different data coverage.
Key points
- INNER JOIN returns only the matching rows on both tables.
- LEFT JOIN returns all the left table rows even though there are no pairs.
- The ON clause specifies the comparison column, for example pesanan.pelanggan_id = pelanggan.id.
- Cross JOIN produces the result of a Cartesian time without matching conditions.
- Combining tables avoids duplication of the same data in many places (normalization).
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.