GCGrowCarrer

Operators and Comparisons

Locked

Lesson 2 of 25 · Syntax · Easy

Finish these first:Values and Data Types →Or pass the tests below to unlock it now.

1

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`.
Key words (tap to learn):
2

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.

3

Quick check

What does `SELECT 3 + 5;` give back?

4

Your challenge

1 sample test, 1 hidden

Write a SQL line that adds 4 and 6 (just type SELECT 4 + 6;).

Stuck? Get a hint (free)
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.

Mastery0%

Learn this first