runtime
101 / 139

task Conditional aggregation · medium

Predict: integer and decimal ratios

Predict both forecast ratios for the two sample authorities.

what to return

Columns
ba_codeint_ratioreal_ratio 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: Ratios, ROUND & NULLIF →

data you can query

forecast_sample3 columns · 2 rows
ba_codedemand_mwforecast_mw
ISNE96188700
NYIS1442613881
ba_code
ISNE
demand_mw
9618
forecast_mw
8700
ba_code
NYIS
demand_mw
14426
forecast_mw
13881

all 2 rows

predict.sql
SELECT
  ba_code,
  demand_mw / forecast_mw AS int_ratio,
  ROUND(1.0 * demand_mw / forecast_mw, 3) AS real_ratio
FROM forecast_sample
ORDER BY ba_code
prediction.json

Enter the rows you think the query returns, column order ba_code, int_ratio, real_ratio. 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: integer and decimal ratios — SQL practice · Runtime