SQL Guide for Data Analysts

This guide is meant to teach you SQL. It is meant for analysts with little to zero prior knowledge of SQL, who might have only some basic Excel concepts.

Note: this guide is meant to teach SQL for data analysis purpose, so we will focus more on the extracting and querying aspect of data. INSERT, UPDATE, and DELETE won't be covered as much.

These chapters are not meant to be consumed in-order. Chapter 1 talks about the simplest concepts of SQL.

Chapter 2 talks about the 3 most central concepts of SQL in the data analysis world: aggregation (GROUP BY), joins, and CTE. A combination of these 3 concepts are what makes SQL powerful.

Chapter 3 cover some vertical topics, like working with specific data types (date, datetime, string, json) or window functions.

Table of Content

Chapter 1: Basic SQL Concepts

  • Database, Table and Columns
  • SELECT and FROM
  • WHERE condition
  • ORDER BY
  • LIMIT
  • Logical Expression: AND + OR
  • NOT
  • IN
  • LIKE
  • Alias
  • NULL
  • UNION
  • EXCEPT

Chapter 2: Immediate Concepts

  • Joining Data
  • Aggregating Data: GROUP BY
  • Sub-query
  • Common Table Expression (CTE).
  • The SQL Way of Thinking

Chapter 3: Advanced Topics

  • Date and Datetime
  • String
  • JSON Type
  • Window Functions