runtime
74 / 139

task GROUP BY · medium

Predict: count rows or known values?

Predict the single row of counts over the sample products.

what to return

Columns
productspricedcategories in this order
Rows
in the order asked
Watch for
Use only the sample rows shown. NULL is not zero or empty text. Keep duplicate rows.
Skill
Reason about the exact result of a fixed SQL query. Refresher: COUNT, SUM & AVG →

data you can query

product_sample4 columns · 10 rows
stock_codedescriptioncategory_idlist_price
21017RED BIRD HOUSE TREE DECORATION110.85
21018BIRD BOX CHRISTMAS TREE DECORATION10.85
21019NULLNULLNULL
21020NULLNULLNULL
21021NULLNULLNULL
21022NULLNULLNULL
21023NULLNULLNULL
21024NULLNULLNULL
21025SPACE FROG171.25
21026SPACE OWL171.25
stock_code
21017
description
RED BIRD HOUSE TREE DECORATION
category_id
11
list_price
0.85
stock_code
21018
description
BIRD BOX CHRISTMAS TREE DECORATION
category_id
1
list_price
0.85
stock_code
21019
description
NULL
category_id
NULL
list_price
NULL
stock_code
21020
description
NULL
category_id
NULL
list_price
NULL
stock_code
21021
description
NULL
category_id
NULL
list_price
NULL
stock_code
21022
description
NULL
category_id
NULL
list_price
NULL
stock_code
21023
description
NULL
category_id
NULL
list_price
NULL
stock_code
21024
description
NULL
category_id
NULL
list_price
NULL
stock_code
21025
description
SPACE FROG
category_id
17
list_price
1.25
stock_code
21026
description
SPACE OWL
category_id
17
list_price
1.25

all 10 rows

predict.sql
SELECT
  COUNT(*) AS products,
  COUNT(list_price) AS priced,
  COUNT(DISTINCT category_id) AS categories
FROM product_sample
prediction.json

Enter the rows you think the query returns, column order products, priced, categories. JSON array of rows — numbers bare, text in quotes, null for NULL. Example: [ [ 1, null, null ] ]. Keep ORDER BY order.

 
Output

Hints and the answer are always available. Using them counts the question as solved with help.

Predict: count rows or known values? — SQL practice · Runtime