Introduction
Function AVG
Functions SUM, MAX, MIN
Revision
32. Summary

Instruction

OK, it's time to review what we've learned in this part.

  • COUNT(*) counts the number of all rows.
  • COUNT(column1) counts the number of rows where column1 is not NULL.
  • COUNT can be used to count non-NULL expressions.
  • Avoid COUNT(*) with LEFT JOINs.
  • DISTINCT only takes into account distinctive values.
  • AVG, SUM, MAX and MIN ignore NULLs, but COUNT takes them into account when counting the number of rows.
  • You can use COALESCE(x,y) to replace x with y when x is NULL. For example, you can replace NULLs with 0.
  • You can use AVG, SUM, MIN or MAX with DISTINCT.
  • You can use ROUND to round the score obtained with AVG.
    • Alright! Are you ready for some practice?

Exercise

Press Next exercise to start our practice.

Console

Code editor

Result

TableConsole