Solution: Connect Two Tables
Explore how to join two tables in SQL using the LEFT JOIN method to combine student records with their Math grades. Understand how to use table aliases, join conditions, and filtering to display all students with their corresponding grades or NULL values where grades are missing.
We'll cover the following...
We'll cover the following...
Query
SELECT s.id, s.name, g.score AS math_gradeFROM students sLEFT JOIN grades gON s.id = g.student_id AND g.subject = 'Math';
Explanation
This query shows each student along with their Math grade (if available). ...