📊Ad Hoc Query
Also known as Ad-Hoc Query, Ad Hoc Analysis, One-Off Query
A quick, one-time question to the data. You write it on the spot.
Think of it like
It is like asking a quick question in class. You need the answer now, just this once.
Example
The boss asks why refunds jumped this week. Jack writes a quick query, finds one country behind it and sends the answer in ten minutes.
Why it matters
Definition
Example code
sql
SELECT country, COUNT(*) AS refunds
FROM orders
WHERE status = 'refunded'
AND order_date >= DATE '2026-11-01'
GROUP BY country
ORDER BY refunds DESC;Common mistake
Key takeaways
- 1One time. Asked once, for a reason today.
- 2Written on the spot. Usually in SQL.
- 3Repeats become reports. Save what keeps coming back.