Introduction
Function COUNT
Function AVG
Functions SUM, MAX, MIN
Revision

Instruction

Good job! It is less commonly known that you can use COUNT functions with any expression as argument.

You can write:

SELECT COUNT(price*2)
FROM project

This query counts the doubled prices. (Yes, the result will be the same as counting single prices.) We will see the real-world usage of this construction later in this section and in the next part of the course.

Exercise

The feedback of 0 doesn't mean anything to agency managers. They want to find out how many projects got meaningful (non-zero) feedback.

Count the number of project with non-zero feedback.

Stuck? Here's a hint!

The function NULLIF(x,y) checks if x equals to y and if it does, returns a NULL. Otherwise returns x.

Console

Code editor

Result

TableConsole