task GROUP BY · medium
Predict: count rows or known values?
Predict the single row of counts over the sample products.
what to return
- Columns
productspricedcategoriesin 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
Retail dataset: the first 6 rows of each table. Under each column name: the kind of value it holds, and which table it links to. Your queries run on all rows.
product_sample4 columns · 10 rows
| stock_code | description | category_id | list_price |
|---|---|---|---|
| 21017 | RED BIRD HOUSE TREE DECORATION | 11 | 0.85 |
| 21018 | BIRD BOX CHRISTMAS TREE DECORATION | 1 | 0.85 |
| 21019 | NULL | NULL | NULL |
| 21020 | NULL | NULL | NULL |
| 21021 | NULL | NULL | NULL |
| 21022 | NULL | NULL | NULL |
- 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
first 6 of 10 rows · your queries use all of them
SELECT COUNT(*) AS products, COUNT(list_price) AS priced, COUNT(DISTINCT category_id) AS categories FROM product_sample
SELECT COUNT(*) AS products, COUNT(list_price) AS priced, COUNT(DISTINCT category_id) AS categories FROM product_sample
Look at the sample tables and SQL. Enter the rows you think the query returns, in this column order: products, priced, categories. Put each row in square brackets, then wrap all rows in another pair of brackets (JSON format). For example, [[1,null,null]] is one row with 3 values. Replace these with your predicted values. Use numbers without quotes, text in double quotes, and null for SQL NULL. Keep repeated rows. Use [] for no rows. Keep rows in the order specified by ORDER BY.
Hints and the answer are always available. Using them counts the question as solved with help.