Skip to content

Visualization & SQL

SQL Essentials for Analysts

9 min+80 XPStep 1/10

The sentence structure

SQL reads like the request it is: SELECT amount, region FROM orders WHERE status = 'refunded' — 'give me amount and region from orders, where status is refunded.'

Three clauses do three jobs:

  • FROM — which table
  • WHERE — which rows (the filter)
  • SELECT — which columns (the projection)

That skeleton alone answers a surprising share of analyst questions: 'what did we sell in Texas last month?' is one WHERE clause away from an answer. Everything else — grouping, joining, subqueries — is elaboration on this sentence.

insight

SQL's execution order isn't its written order: `FROM` runs first, `WHERE` filters next, `SELECT` picks columns last. Knowing this explains most 'why is my query empty' mysteries.