Exercise · SQL & Querying
Predict, then run it
Predict the output
orders(oid, payload) JSON: oid 1 {"tip":5} (tipped), oid 2 {"tip":null} (declined), oid 3 {} (kiosk v1 never asks). Count declined tips only — present-and-null, not absent:
SELECT COUNT(*) AS declined FROM orders WHERE json_type(json_extract(payload,'$.tip')) = 'NULL';
Predict the exact output.