Skip to content
Jobless Busters
SQLQuestion 13 of 14Multiple choice

COUNT(*), COUNT(1), COUNT(column) and NULL

What does the query return (in order: rows, ones, non_null, unique_values)?

SQL
WITH sample(value) AS (VALUES (10), (NULL), (10))
SELECT COUNT(*) AS rows,
       COUNT(1) AS ones,
       COUNT(value) AS non_null,
       COUNT(DISTINCT value) AS unique_values
FROM sample;

Choose one answer.

Source: Quiz question based on a card · Full Stack / JS

The answer and explanation come from the source card linked below.