Challenge: 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
COALESCEfunction to replace anyNULLvalue in thebonuscolumn with zero. - Calculate the average of these values.
- The result should be a single column named
avg_bonus.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 5. Kapittel 5
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
Fantastisk!
Completion rate forbedret til 2.86
Challenge: 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
COALESCEfunction to replace anyNULLvalue in thebonuscolumn with zero. - Calculate the average of these values.
- The result should be a single column named
avg_bonus.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 5. Kapittel 5
single