DataBolt

All Lessons

Introduction to SQL
SQL Lesson 1: Your Sample Database
SQL Lesson 2: SELECT — Reading data
SQL Lesson 3: WHERE — Filtering rows
SQL Lesson 4: AND, OR, NOT
SQL Lesson 5: BETWEEN, IN, LIKE
SQL Lesson 6: NULL — The Mystery Value
SQL Lesson 7: ORDER BY
SQL Lesson 8: LIMIT & OFFSET
SQL Lesson 9: Aggregate Functions
SQL Lesson 10: GROUP BY
SQL Lesson 11: HAVING
SQL Lesson 12: INNER JOINs
SQL Lesson 13: LEFT JOINs
SQL Lesson 14: RIGHT JOINs
SQL Lesson 15: SELF JOINs
SQL Lesson 16: UNION JOINs
SQL Lesson 17: Joining Multiple Tables
SQL Lesson 18: Subqueries
SQL Lesson 19: CTEs (WITH)
SQL Lesson 20: CASE Statements
SQL Lesson 21: Window Functions
SQL Lesson 22: String Functions
SQL Lesson 23: Date & Time Functions
SQL Lesson 24: INSERT, UPDATE, DELETE
SQL Lesson 25: CREATE TABLE & DDL
SQL Lesson 26: Indexes & Performance
SQL Lesson 27: Transactions & ACID
SQL Lesson 28: SQL Execution Order
SQL Lesson 29: 50 Practice Problems

CHAPTER 1

What is SQL?

And why is it one of the most valuable skills you can learn in tech?

IN THIS CHAPTER

  • What a database is and why every app needs one
  • The difference between a database, a table, a row, and a column
  • Why SQL has remained the #1 data language for 50+ years
  • Key terminology you will use throughout your career

Every App you Love Runs on a Database

When you scroll Instagram, the app sends a SQL query that looks something like:

SELECT post_id, image_url, caption, like_count 
FROM posts 
WHERE user_id IN (
    Select following_id FROM followers WHERE user_id = ?;
)
ORDER BY created_at DESC
LIMIT 20;

This query runs millions of times per second at scale, SQL is the universal language of data.

Key Terminology

TermWhat It MeansReal-World Analogy
DatabaseA container holding all related tablesAll of Swiggy's data - users, restaurants, orders
TableOne entity stored as rows + columnsThe "orders" spreadsheet inside Swiggy's database
Row / RecordA single record in a tableA single order placed by Ananya
Column / FieldOne attribute of each rowThe "total_amount" column in the orders table
Primary KeyUnique ID - no two rows share itYour Aadhaar number
Foreign KeyA column that links to another table's primary keyorder.customer_id --> customer.customer_id
QueryA SQL statement asking a question or giving a commandSELECT name FROM employees WHERE salary > 7000
SchemaThe structure definition of a databaseThe blueprint listing all tables and their columns

💡 Engineering Insight: At Google, databases can have tables with trillions of rows annd schemas with hundreds of tables. Yet the SQL you write today is the same SQL engineers write at Google - the language scales from 8 rows to 8 trillion.