Joins II — fan-out & grain
Exercise · SQL & Querying

Predict, then run it

Predict the output

grow(batch, kilos) = (B1,10),(B2,20). harvest(batch, tray) = (B1,t1),(B1,t2),(B2,t9). Run the two-count fan-out probe on the join:

SELECT COUNT(*) AS rows, COUNT(DISTINCT g.batch) AS batches FROM grow g JOIN harvest h ON h.batch = g.batch;

Predict the exact output.