Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Prevent Division by Zero | Null Functions
Functions in SQL

bookChallenge: Prevent Division by Zero

Aufgabe

Swipe to start coding

Write a query to calculate the total bonus, the number of employees, and the average bonus per employee. Use NULLIF to prevent division by zero when calculating the average bonus per employee.

  • Calculate the sum of the bonus column and assign it an alias.
  • Count the number of employees and assign it an alias.
  • Divide the total bonus by the number of employees using NULLIF to avoid division by zero, and assign the result an alias.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 5. Kapitel 6
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

close

bookChallenge: Prevent Division by Zero

Swipe um das Menü anzuzeigen

Aufgabe

Swipe to start coding

Write a query to calculate the total bonus, the number of employees, and the average bonus per employee. Use NULLIF to prevent division by zero when calculating the average bonus per employee.

  • Calculate the sum of the bonus column and assign it an alias.
  • Count the number of employees and assign it an alias.
  • Divide the total bonus by the number of employees using NULLIF to avoid division by zero, and assign the result an alias.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 5. Kapitel 6
single

single

some-alt