Applied SQL for Analysts
Write queries you can defend in a review
3.5(2 reviews)
13 enrolledAbout this course
Most analysts learn SQL by copying a query that worked once and changing the dates. This course takes you from that to writing queries you understand, can explain, and can fix when the numbers look wrong.
You will work against a realistic sales and subscriptions schema with the kinds of problems real data has: duplicate rows, late arriving records, currencies that changed mid year, and a customer table where the same person appears three times.
By the end you will be comfortable with window functions, common table expressions and query plans, and you will know why a query that runs in two seconds on your laptop takes four minutes in production.
Curriculum
24 lessons, 7m 40s total
2 lessons are free to preview.
01Getting your bearings
4 lessons, 1m 20s
- What this course assumes you already know0:20
- The schema we will use throughout0:20
- Reading a query someone else wroteVideo0:20
- Why SELECT * costs more than you thinkVideo0:20
02Joins that behave
5 lessons, 1m 20s
- Inner, left and the row count trapVideo0:20
- When a join multiplies your rowsVideo0:20
- Anti joins and finding what is missingVideo0:20
- Exercise: reconcile two order tablesVideo0:20
- Reference: join cheat sheetReading
03Aggregation and grouping
4 lessons, 1m 20s
- GROUP BY, and what HAVING is actually forVideo0:20
- Counting things that are not thereVideo0:20
- Averages that lieVideo0:20
- Rolling up to month, quarter and yearVideo0:20
04Window functions
5 lessons, 1m 40s
- The mental model: a window, not a groupVideo0:20
- ROW_NUMBER, RANK and deduplicationVideo0:20
- Running totals and period over periodVideo0:20
- LAG and LEAD for change detectionVideo0:20
- Exercise: build a retention curveVideo0:20
05Making it fast
3 lessons, 1m
- Reading an EXPLAIN plan without fearVideo0:20
- Indexes: what they cost and what they buyVideo0:20
- Why your query is slow only in productionVideo0:20
06Putting it together
3 lessons, 1m
- Structuring a long query with CTEsVideo0:20
- Writing a query someone else can maintainVideo0:20
- Final project walkthroughVideo0:20