Challenge: Student-Class Report with Defaults
Oppgave
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
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 2
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Suggested prompts:
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Fantastisk!
Completion rate forbedret til 4.76
Challenge: Student-Class Report with Defaults
Sveip for å vise menyen
Oppgave
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
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 2
single