$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · medium · #251

What is the output?

CREATE TABLE t (x INT);
INSERT INTO t VALUES (2), (NULL), (4);
SELECT AVG(x) FROM t;
  1. 2.0
  2. 3.0
  3. NULL
  4. 6.0
Aggregates skip NULLs, so AVG averages only 2 and 4: (2 + 4) / 2 = 3.0.
Play Problem Solving ▸