Generate custom courses on any topic — with hands-on practice, AI guidance, and visuals built in.
Already have an account?
The request comes in at 4:20 PM. A stakeholder wants a daily revenue KPI split by channel for the last 90 days, and they want it in Slack before standup tomorrow.
An AI assistant can draft a first-pass SQL query fast. You still own the delivered number. If the query double-counts revenue because of a many-to-many join, the downstream failure is yours, not the model’s. Your professional move is to use AI for speed where it is cheap to be wrong, and to keep verification gates where it is expensive to be wrong.
Explore the main parts of the process.
Use AI to generate candidate SQL when the work product is inspectable. Drafting a query skeleton, translating a question into a GROUP BY, or producing a set of validation queries are good fits because you can run them and compare outputs.
A practical example. You have a fact_orders table with 12.4 million rows covering 2024-01-01 to 2024-06-30, and a dim_channel table keyed by channel_id. The question is “daily net revenue by channel for the last 90 days.” AI can draft the joins and date filter, then you verify row-grain and join cardinality before you trust totals.
Keep AI out of tasks where authority matters. KPI definition, metric scoping, and business rules are not drafting problems. They are decisions. AI can restate your definition, but you must decide whether “revenue” means gross, net of refunds, net of discounts, or recognized revenue, and you own the consequence if stakeholders act on the wrong definition.
See how different tasks compare in risk.
You will use one workflow throughout this course. Verification gate means a step where you do not proceed until you have evidence the query is correct for the stated definition.
Start with a spec you can point to. Write the metric definition, time window, grain, and segmentation dimensions in plain language.
Then generate. AI drafts SQL and also drafts the checks you will use to challenge it. You run everything yourself in your warehouse.
Validation is not “it returned rows.” Validate by triangulation. Compare to a known dashboard number for one day, check totals before and after the join, and confirm the grain by counting distinct keys. If SUM(revenue) changes when you join dim_channel, that is a red flag you must resolve before sharing.
Documentation is part of done. Save the final SQL, the assumptions, and the validation queries. If another analyst cannot reproduce your result tomorrow, you are not done.
Try the workflow you will follow in this course.