-- Synthetic reference; integer USD cents. Subscription cost only; excludes labor, migration, taxes and add-ons. Acceptance counts are hypothetical; no vendor performance measured. Null means undefined or invalid. WITH cases(name,subscription_cents,reports,accepted,expected_cents) AS (VALUES ('ten_of_ten',20000,10,10,2000),('eight_of_ten',16000,10,8,2000),('zero_accepted',20000,10,0,NULL),('all_free',0,10,10,0),('partial',15000,12,6,2500),('single',12345,1,1,12345),('invalid_count',15000,2,3,NULL),('negative_cost',-100,1,1,NULL)), results AS (SELECT *,CASE WHEN accepted>0 AND accepted<=reports AND subscription_cents>=0 THEN CAST(ROUND(subscription_cents*1.0/accepted) AS INTEGER) ELSE NULL END actual FROM cases) SELECT *,expected_cents expected,actual IS expected_cents pass FROM results;