Learn to Code
All tracks
Learn to Code

Free lessons from scratch to pro — every language, databases and DevOps.

AboutContactPrivacy PolicyTerms of Use

Your progress is saved in this browser. © 2026 Learn to Code

SQL
SQL
0/12 completed
Beginner
What is a database?SELECT: reading dataFiltering with WHERESorting and limiting results
Intermediate
Aggregates and GROUP BYJOINs: combining tablesINSERT, UPDATE and DELETECreating tables and constraints
Advanced
Subqueries and CTEsWindow functions
Pro
Indexes and transactionsDatabase design and normalization
Tracks / SQL / Beginner

Filtering with WHERE

WHERE keeps only the rows that match a condition. It's how you find one user out of millions.

SQL · editable

Text values go in single quotes. Numbers don't need quotes.

Comparison operators

Operator Meaning
= equal
<> or != not equal
> < >= <= greater / less than
SQL · editable

Combining conditions: AND, OR, NOT

SQL · editable
SQL · editable

Precedence trap: AND binds tighter than OR. When you mix them, always use brackets: WHERE category = 'Kitchen' AND (price < 10 OR stock > 150)

IN, BETWEEN and LIKE

SQL · editable
SQL · editable
SQL · editable
Pattern Matches
'A%' starts with A
'%son' ends with "son"
'%lap%' contains "lap"
'_i%' second letter is i

NULL: the missing value

NULL means "unknown or missing". It is not equal to anything, not even another NULL, so = NULL never works. Use IS NULL / IS NOT NULL.

SQL · editable

The statements run in order. The first SELECT matches no rows, so only one result table appears: the one from IS NULL.

Practice

Find all products that are in stock, cost between 5 and 50, and are not in the Kitchen category.

SQL · editable
✎ Check your understanding

1.Which query finds customers with no email?

2.Which names match LIKE 'M%'?

← SELECT: reading data