Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Calculate Average Bonus | Section
Functions in SQL
SectionΒ 1. ChapterΒ 29
single

single

bookChallenge: Calculate Average Bonus

Swipe to show menu

Task

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.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 29
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt