Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Calculate Average Bonus | Null Functions
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Functions in SQL

bookChallenge: Calculate Average Bonus

Oppgave

Swipe to start coding

Write a query to calculate the average bonus for all employees in the employees table, treating any NULL bonus values as zero.

  • Use the COALESCE function to replace any NULL value in the bonus column with zero.
  • Calculate the average of these values.
  • The result should be a single column named avg_bonus.

Løsning

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 5. Kapittel 5
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

close

bookChallenge: Calculate Average Bonus

Sveip for å vise menyen

Oppgave

Swipe to start coding

Write a query to calculate the average bonus for all employees in the employees table, treating any NULL bonus values as zero.

  • Use the COALESCE function to replace any NULL value in the bonus column with zero.
  • Calculate the average of these values.
  • The result should be a single column named avg_bonus.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 5. Kapittel 5
single

single

some-alt