Two Ways To Count
Table readings:
| id | sensor | value |
|---|---|---|
| 1 | a | 10 |
| 2 | a | NULL |
| 3 | a | 20 |
| 4 | b | NULL |
SELECT sensor,
count(*) AS c_star,
count(value) AS c_val,
sum(value) AS total,
avg(value) AS mean
FROM readings
GROUP BY sensor
ORDER BY sensor;
What are the two output rows?
Sign in to answer questions and track your progress
Sign In