Foundations — SQL DML — SELECT, INSERT, UPDATE, DELETE
Before you can read a single SELECT, you must know what each little piece means and what it looks like. Below, every symbol and word the parent note leaned on is rebuilt from nothing, in the order that each one needs the one before it.
0. The grid itself — table, row, column, cell
Look at the figure. The whole rectangle is the table. One horizontal strip (blue) is a row. One vertical strip (pink) is a column. The single box where a row and column cross (yellow) is a cell — that is where an actual value like 50000 lives.

Why the topic needs this: every DML verb is defined by what part of the grid it touches. INSERT adds a row. DELETE removes a row. UPDATE changes cells inside chosen rows. SELECT shows you chosen rows/columns. You literally cannot say what any verb does without the words row/column.
1. Column names and data types
Each column has a name (a label, like salary) and a type (what kind of value is allowed).
The picture: think of each column as a mailbox with a slot cut to one shape. The INT slot only takes number-cards; the VARCHAR slot takes word-cards. Try to post the wrong shape and the database rejects it.
Why the topic needs this: the parent writes salary INT and name VARCHAR(50). When you later write WHERE dept = 'Eng' the text is in quotes (it's a word-card) but salary > 60000 has no quotes (a number-card). The type explains the quotes.
2. Quotes, the = sign, and comparison symbols
The comparison symbols you'll meet. Each one asks a yes/no question about two values:
| Symbol | Plain words | How to read it |
|---|---|---|
= |
equal to | the two values are exactly the same |
<> or != |
not equal to | the two values differ (both spellings mean the same thing) |
> |
greater than | the mouth opens toward the bigger side: salary > 60000 |
< |
less than | the mouth points at the smaller side: salary < 60000 |
>= |
greater than or equal to | passes when bigger or a tie: COUNT(*) >= 2 is true for exactly 2 |
<= |
less than or equal to | passes when smaller or a tie: salary <= 50000 includes exactly 50000 |
Why the topic needs this: salary > 60000, salary < 60000, COUNT(*) >= 2 all appear in the parent. Each is a yes/no test asked of one row.
3. NULL — the "we don't know" box
Because NULL means "unknown," SQL uses three-valued logic: a predicate can come out TRUE, FALSE, or UNKNOWN. Any comparison against NULL yields UNKNOWN — and a turnstile only lets a row through on TRUE, so UNKNOWN rows are quietly blocked.
Why the topic needs this: the moment a real table has a missing salary or dept, ordinary predicates silently drop those rows. Knowing NULL → UNKNOWN → blocked explains "why did that row vanish?"
4. The predicate — a true/false machine
The picture: imagine a turnstile at the door of every row. The predicate is the guard. TRUE = you pass through; FALSE or UNKNOWN = you're turned away.

Combining and negating predicates:
AND= both guards must say yes (dept = 'Eng' AND salary > 60000).OR= either guard saying yes is enough.NOT= flips the answer:NOT (salary > 60000)is TRUE exactly whensalary > 60000is FALSE.
Why the topic needs this: the entire WHERE clause is a predicate. WHERE, UPDATE … WHERE, and DELETE … WHERE all reuse this same turnstile idea — see WHERE clause and Predicates.
5. WHERE — the filter, and the terror of leaving it out
This is why the parent chants "No WHERE → everywhere." For SELECT that just shows extra rows (harmless). For UPDATE and DELETE it means you change or erase the whole table. The word WHERE is the single most important safety symbol in the topic.
6. The star * and functions like COUNT, AVG
The picture: a function is a juicer. You drop a column of many numbers in the top; one number drips out the bottom.
Why the topic needs this: SELECT dept, AVG(salary), COUNT(*) uses two juicers. These only make sense once you know that a group of rows can be squeezed together — which needs the next idea.
7. Grouping, HAVING, and aliases
The picture: pour all rows onto a table, then slide them into labelled boxes (Sales box, Eng box). Now AVG runs once per box.
Why the topic needs this: the parent's GROUP BY dept HAVING COUNT(*) >= 2 and the rule "you can't use an alias in WHERE" both require this bucket picture. WHERE filters rows before bucketing; HAVING filters buckets after. See Aggregate Functions & GROUP BY.
8. The salary * 1.10 trick — right side reads the current value
Why and not ? Multiplying by = keep and add = . So .
Why the topic needs this: the parent's 10% raise example. Without knowing the right side reads the old value, the arithmetic looks like magic.
9. The semicolon — where one statement ends
Why the topic needs this: every multi-statement example in the parent (the forecast-then-verify exercise) relies on ; to separate the steps.
10. Transaction words — BEGIN, COMMIT, ROLLBACK
The picture: a whiteboard you can wipe clean (ROLLBACK) up until you photograph it (COMMIT).
Why the topic needs this: this is the safety net behind the "preview a risky UPDATE" advice — see Transactions — ACID, COMMIT, ROLLBACK.
How these feed the topic
Equipment checklist
Test yourself — cover the right side.
What is a row versus a column?
What is a cell?
What does INT vs VARCHAR(50) allow?
INT = whole numbers; VARCHAR(50) = text up to 50 characters (any symbols, not just letters).Why is 'Eng' in quotes but 60000 isn't?
'Eng' is a string literal (text); 60000 is an integer, which needs no quotes.What are the two jobs of = in SQL?
WHERE it compares (asks true/false); in SET it assigns (stores a value).Which two spellings both mean "not equal"?
<> and !=.What do >= and <= add over > and <?
What is NULL, and how do you test for it?
IS NULL / IS NOT NULL, never with =.What does a comparison against NULL evaluate to, and does the row pass?
Which binds tighter, AND or OR, and what fixes ambiguity?
AND binds tighter than OR; add parentheses to force the grouping you want.What is a predicate?
What happens with no WHERE on an UPDATE/DELETE?
What does COUNT(*) return?
What does GROUP BY dept do before AVG runs?
AVG runs inside each bucket.How does HAVING differ from WHERE?
In SET salary = salary * 1.10, what is the right-hand salary, and what does * mean?
* is SQL's multiply operator.What does the semicolon ; do?
What does ROLLBACK do?
Connections
- Parent topic
- WHERE clause and Predicates — the turnstile guard in full.
- Aggregate Functions & GROUP BY — the juicers and buckets.
- Transactions — ACID, COMMIT, ROLLBACK — the pencil-draft safety net.
- SQL DDL — CREATE, ALTER, DROP — how the grid itself is built.
- SQL Joins — combining grids later.