Screen Link:
https://app.dataquest.io/m/2000588/summary-statistics-with-sql/1/question-1
My Code:
Difficulty to insert NULL operation in argument to count non NULL composer.
SELECT COUNT(*) AS num_rows
FROM track
WHERE composer NOT IS NULL AS ...;
What I expected to happen:
What actually happened:
Replace this line with the output/error
Hi p.verdoot
Welcome to the community!
As per the documentation here (and also here)
If you specify expr
, then COUNT
returns the number of rows where expr
is not null. You can count either all rows, or only distinct values of expr
.
If you specify the asterisk (*), then this function returns all rows, including duplicates and nulls. COUNT
never returns null.
Since we have to count non-null values in the composer
column, COUNT(composer)
will do the needful.
Hope its clear now?
Thanks.