Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

SQL & Analytical Warehousing

Progress0/29
x

Understanding Data

  • What is data?8m
  • What is a database?8m
  • Tables, rows, and columns10m
  • Primary keys and foreign keys10m

Relational core

  • Relational basics8m
  • NULL handling10m
  • Aggregations & grouping10m
  • Multi-table joins12m
  • Subqueries & CTEs10m

Windows, cleaning & opsPreview

  • Window functions (the DE benchmark)Free14m
  • Data cleaning & string/date manipulation10m
  • CASE expressions10m
  • Deduplication & incremental upserts12m
  • Indexing, partitioning & optimization12m

Advanced Querying

  • Set operations: UNION, INTERSECT, EXCEPT10m
  • Recursive CTEs for hierarchical data12m
  • Querying semi-structured JSON12m
  • Pivoting and unpivoting12m

Warehouse & Dimensional Modeling

  • OLTP vs OLAP mental model10m
  • Star schema: facts, dimensions, grain14m
  • Surrogate keys & conformed dimensions12m
  • Slowly Changing Dimensions Type 1 / 2 / 316m
  • Additive, semi-additive, and non-additive facts12m
  • Normalization vs denormalization for analytics12m

Performance & Production SQL

  • Query plans: hash, merge, nested-loop14m
  • Partitioning & clustering in real warehouses12m
  • Views vs materialized views10m
  • PK / FK / CHECK, and how warehouses relax them12m
  • Capstone: model a star from orders18m
Back to track
  1. Learn
  2. SQL & Analytical Warehousing
  3. Understanding Data
  4. What is a database?

Lesson 2 of 29 · Theory first, then run it

What is a database?

sqlbeginner8 min

Overview

A database is organized storage for data. Tables hold related records. SQL is the language for asking questions about that data.

On this page7 sections›
  1. 1The idea
  2. 2Why this exists
  3. 3Picture this
  4. 4A small example
  5. 5Common beginner questions
  6. 6What comes next
  7. 7Practice

The idea

A database is software that stores data in an organized way. Instead of keeping information in scattered files and folders, a database uses tables with strict rules about what each column can hold. A relational database stores data in tables that can reference each other through shared columns.

SQL (Structured Query Language, pronounced 'sequel' or 'S-Q-L') is the language you use to communicate with a database. You write a question in SQL, and the database returns the answer as rows and columns. SQL has been the standard language for databases since the 1970s and is used by virtually every data tool today.

Why this exists

Imagine a bank that stores customer information in one system, account balances in another, and transaction records in a third. Without a database that connects these systems, a bank teller cannot see your full account history when you call with a question.

A relational database solves this by storing customers, accounts, and transactions in separate tables that reference each other through shared columns like customer_id. One SQL query can combine data from all three tables to show a complete picture.

Picture this

How a database organizes data
Tables (organized storage)SQL engine (processes queries)Query results (rows and columns)

Tables store data. SQL queries retrieve it. Results come back as rows and columns.

This track focuses on relational databases because they are the foundation of data warehousing.

Database typeExamplesBest for
Relational (SQL)PostgreSQL, MySQL, Snowflake, BigQueryStructured data with relationships
DocumentMongoDB, DynamoDBSemi-structured JSON documents
Key-valueRedis, DynamoDBFast lookups by a single key
Column-familyCassandra, HBaseWide tables with many columns

The SQL editor in this tab is a relational database with several tables already loaded: orders, order_items, payments, ecommerce_events, telemetry, and customer history. You do not need to install anything. Just write SQL and see results.

A query is a question written in SQL. The database reads the query, finds matching rows, and returns a result table. You do not move files around. You ask, and the engine answers.

A small example

Run the example below in this tab. Read the input, follow the code, then check the output matches what you expect.

SQLA query is a question: show me five paid orders
SELECT order_id, order_total
FROM orders
WHERE order_status = 'paid'
LIMIT 5;

Read it in English: from the orders table, keep paid rows, return two columns, stop after five rows. That is the same idea as filtering a spreadsheet, with rules the database enforces.

A library with a perfect index

A database is like a library where every book (row) is filed by topic (table), and you can find any book instantly with the right question (SQL query).

Copy-paste without reading the output

Run Sample first. If the numbers or row count look wrong, stop and re-read the previous section before changing code.

Common beginner questions

What is the difference between a database and a spreadsheet?

A spreadsheet stores data in one big grid. A database stores data in multiple related tables, enforces data types, supports millions of rows efficiently, and allows multiple users to query simultaneously.

Do I need to install a database to learn SQL?

Not here. The SQL editor runs in your browser with real tables already loaded. On the job, you will connect to databases hosted in the cloud (Snowflake, BigQuery, Redshift) or on company servers.

What comes next

In the next lesson, you will look closely at tables, rows, and columns. You will learn how data types work and why they matter for data quality.

Practice

Run Sample to see all tables available in this SQL editor with SHOW TABLES. Then complete Exercise: preview the payments table with SELECT * FROM payments LIMIT 5.

Rate:
Was this useful?
What is data?Tables, rows, and columns