Manuals / Data Literacy / Chapter 4

B · Query · intermediate · Week 2 · Chapter 4 of 8

SQL lite for truth-seeking

SELECT, WHERE, GROUP BY, COUNT, averages. Enough to verify a dashboard number once.

Path progress
50%

Step 1 of 1

Reproduce a number

Reproduce a numberDrag stickies · tap for tips
Study mapDrag stickies · tap for tipsKeep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Assert the UIdrag · tap →Retry wiselydrag · tap →Seed datadrag · tap →Close the loopdrag · tap →Keep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Pathwise hackdrag · tap →Reproduce a numberdrag · tap →Try thisdrag · tap →Follow the dashed drag · tap →

Example

SELECT date_trunc('day', created_at) AS day,
       COUNT(*) FILTER (WHERE status = 'error') AS errors,
       COUNT(*) AS total
FROM events
WHERE created_at >= now() - interval '7 days'
GROUP BY 1
ORDER BY 1;

Do this now

Match (or explain mismatch of) one dashboard figure with a query or export.

Was this step clear?
Chapter learning outcomes
  • Aggregations
  • Joins caution
  • Sampling

Clear these before you leave