Lesson 1 of 10 Β· 12 min Β· 1 hands-on step

Tables & SELECT Queries

Read data with SELECT, filter it with WHERE and sort it with ORDER BY.

What is a database?

A relational database stores data in tables, like spreadsheets with strict rules. Each row is a record (one employee), and each column is a field (name, salary). Most web apps you'll work on use one: PostgreSQL, MySQL or SQLite.

Reading data

SQL Β· try it
Loading…

Filtering

SQL Β· try it
Loading…

Sorting and limiting

SQL Β· try it
Loading…

SQL keywords aren't case sensitive, but writing them in UPPERCASE is the convention and makes queries easier to scan.

The exercise runs a real SQLite database in your browser, and the test compares your result with the expected rows.

πŸ§ͺ Practice

The employees table has columns id, name, department_id, salary, hired.

Return the name and salary of every employee earning more than 90000, highest salary first.

SQL
Loading editor…

Output appears here. Press Run or Ctrl/⌘ + Enter.

βœ… Check your understanding

  1. Which clause filters rows?

  2. What is a primary key?

Create a free account to track your progress.