MySQL SQLLesson 28Free preview
MySQL Joins
This lesson is part of MySQL · All levels
Summary
JOIN is used to combine rows of two or more tables based on the relationships between columns, usually foreign keys versus primary keys. With JOIN, separate data in multiple tables can be displayed as a single result set without having to store it twice. MySQL provides several types of JOIN, and the type option determines which lines remain even if the pair does not exist.
Key points
- JOIN combines two rows of tables via the ON condition on the relation column
- The ON condition specifies how to match the line, e.g. s.id_kelas = k.id
- Type JOIN (INNER, LEFT, RIGHT, CROSS, self) determines which line to join
- Use a table alias to keep the combined query concise and unambiguous
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.