Operators and Comparisons
LockedLesson 2 of 25 · Syntax · Easy
Finish these first:Values and Data Types →Or pass the tests below to unlock it now.
The big idea
Operators let SQL do math right inside a SELECT statement, just like a calculator. Write +, -, , or / after SELECT, and SQL calculates the result for you: Later you will use these exact same operators to calculate totals and compare numbers across real database tables.
Think of it like this: Think of SQL math like using a calculator inside `SELECT`: SQL works out `4 + 6` and hands you back the answer `10`.
Read the lesson
Operators let SQL do math right inside a SELECT statement, just like a calculator.
Write +, -, *, or / after SELECT, and SQL calculates the result for you:
SELECT 3 + 5; -- 8 (addition)
SELECT 10 - 4; -- 6 (subtraction)
SELECT 3 * 4; -- 12 (multiplication)
SELECT 10 / 2; -- 5 (division)
Later you will use these exact same operators to calculate totals and compare numbers across real database tables.
Quick check
What does `SELECT 3 + 5;` give back?
Your challenge
Write a SQL line that adds 4 and 6 (just type SELECT 4 + 6;).
More learning tools(compare languages, visual guide, related lessons)
Compare with another language
Similar to python.operators (90% overlap). Arithmetic and boolean operators behave identically; watch === in JS and integer division in C++/Go/Rust/Java.
Visual walkthrough
A diagram, a step-by-step animation, and short captions for Operators and Comparisons.
Learn this first
- Values and Data TypesNot yet