Challenge: Student-Class Report with Defaults
Opgave
Swipe to start coding
Write a query to generate a report listing each student's name and their class name. If a student does not have a class assigned, display 'Unassigned' instead of a NULL class name.
- Use a LEFT JOIN to combine the
studentsandclassestables based on theclass_id. - Select the student's name from the
studentstable. - Select the class name from the
classestable, replacing any NULL values with 'Unassigned' using the COALESCE function.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 3. Kapitel 2
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Fantastisk!
Completion rate forbedret til 4.76
Challenge: Student-Class Report with Defaults
Stryg for at vise menuen
Opgave
Swipe to start coding
Write a query to generate a report listing each student's name and their class name. If a student does not have a class assigned, display 'Unassigned' instead of a NULL class name.
- Use a LEFT JOIN to combine the
studentsandclassestables based on theclass_id. - Select the student's name from the
studentstable. - Select the class name from the
classestable, replacing any NULL values with 'Unassigned' using the COALESCE function.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 3. Kapitel 2
single