{"publisher":"WESWOO","id":"inventory-import-no-change","title":{"zh":"查看样例与复核查询","en":"View the records and verification query"},"setup_sql":"CREATE TABLE review(location TEXT,sku TEXT,export_current INT,new_on_hand INT,fresh_current INT,\n PRIMARY KEY(location,sku));\nINSERT INTO review VALUES ('East','M',8,12,8),('West','M',5,NULL,5),('East','L',6,6,6);","query_sql":"SELECT location,sku,CASE WHEN new_on_hand IS NULL THEN 'blank: no quantity request'\n WHEN export_current<>fresh_current THEN 'refresh count'\n WHEN new_on_hand=fresh_current THEN 'already equal' ELSE 'candidate' END AS action,\n new_on_hand FROM review ORDER BY location,sku;","checks":[{"condition":"Blank target, same value, real change","change_sql":"","expected":[["East","L","already equal",6],["East","M","candidate",12],["West","M","blank: no quantity request",null]],"observed":[["East","L","already equal",6],["East","M","candidate",12],["West","M","blank: no quantity request",null]]},{"condition":"East stock moved after export","change_sql":"UPDATE review SET fresh_current=7 WHERE sku='M' AND location='East';","expected":[["East","L","already equal",6],["East","M","refresh count",12],["West","M","blank: no quantity request",null]],"observed":[["East","L","already equal",6],["East","M","refresh count",12],["West","M","blank: no quantity request",null]]},{"condition":"Counted zero explicitly","change_sql":"UPDATE review SET new_on_hand=0 WHERE location='West';","expected":[["East","L","already equal",6],["East","M","candidate",12],["West","M","candidate",0]],"observed":[["East","L","already equal",6],["East","M","candidate",12],["West","M","candidate",0]]}]}