You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
When data is split across multiple normalised tables, you use JOINs to combine rows from two or more tables based on a related column (usually a foreign key relationship). Joins are one of the most powerful features of SQL and a core topic at A-Level.
After normalisation, data that logically belongs together is stored in separate tables to avoid redundancy. To view this data together, we must join the tables.
Example Tables:
Students
| StudentID | FirstName | Surname | FormGroup |
|---|---|---|---|
| 1 | Alice | Chen | 10A |
| 2 | Bob | Patel | 10B |
| 3 | Carol | Smith | 10A |
Grades
| GradeID | StudentID | Subject | Score |
|---|---|---|---|
| 1 | 1 | Maths | 85 |
| 2 | 1 | English | 72 |
| 3 | 2 | Maths | 91 |
| 4 | 4 | Science | 68 |
Note that GradeID 4 references StudentID 4, who does not exist in the Students table (this will illustrate differences between join types).
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.