Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Student-Class Report with Defaults | Handling NULLs, Performance, and Real-World Join Scenarios
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
SQL Joins in Depth

bookChallenge: 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 students and classes tables based on the class_id.
  • Select the student's name from the students table.
  • Select the class name from the classes table, replacing any NULL values with 'Unassigned' using the COALESCE function.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 2
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

close

bookChallenge: 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 students and classes tables based on the class_id.
  • Select the student's name from the students table.
  • Select the class name from the classes table, replacing any NULL values with 'Unassigned' using the COALESCE function.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 2
single

single

some-alt