A school wants a complete attendance grid: one row for every combination of student and subject, showing how many times that student sat that subject's exam. Combinations with no attempts show 0. Write an SQL query that returns student_id, student_name, subject_name and attended_exams. Order the results by student_id, then subject_name.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.