SQL Glossary
Every term you will meet while learning SQL, defined in plain language. Where this site has a full tutorial on a term, the entry links to it — and everything here can be tried immediately in the playground.
A
- Aggregate function
- A function that folds many rows into one value: COUNT, SUM, AVG, MIN and MAX are the core five. Usually paired with GROUP BY to produce one value per group. Full guide: GROUP BY vs HAVING →
- Alias
- A temporary name given with AS - to a column (SELECT salary * 12 AS annual) or a table (FROM Employees e). Aliases exist only for the duration of the query. Full guide: The SELECT guide →
B
- BETWEEN
- A range test: WHERE price BETWEEN 10 AND 20 is shorthand for price >= 10 AND price <= 20, inclusive on both ends. For dates, a half-open range is usually safer. Full guide: Date functions →
C
- CASE
- SQL's conditional expression. It tests conditions in order and produces the value of the first match, anywhere a value can appear - SELECT lists, ORDER BY, even inside aggregates. Full guide: CASE WHEN explained →
- COALESCE
- Returns the first non-NULL of its arguments. The standard way to swap a NULL for a readable fallback, as in COALESCE(manager_name, 'No manager'). Full guide: String functions →
- Column
- One named field of a table, holding the same kind of value for every row - an email, a price, a date. Queries choose columns in the SELECT list.
- CROSS JOIN
- A join with no condition: every row on the left pairs with every row on the right. Occasionally wanted for building grids; more often the accidental result of a forgotten ON. Full guide: JOINs explained →
- CTE (Common Table Expression)
- A named, temporary result set defined with WITH at the top of a query and used below by name. It structures multi-step logic so it reads top to bottom. Full guide: CTEs explained →
D
- DDL and DML
- Two families of SQL statements: DDL (Data Definition Language) shapes structure - CREATE, ALTER, DROP - while DML (Data Manipulation Language) works with rows - SELECT, INSERT, UPDATE, DELETE.
- DELETE
- Removes rows matched by its WHERE clause. Without a WHERE it empties the entire table, immediately and without confirmation - which is why you SELECT with the same WHERE first. Full guide: Changing data safely →
- DISTINCT
- Removes duplicate rows from a result. It applies to the whole selected row, not just the column it happens to sit beside - SELECT DISTINCT a, b de-duplicates combinations of a and b. Full guide: The SELECT guide →
F
- Foreign key
- A column that references the primary key of another table, expressing a relationship - Employees.dept_id pointing at Departments.dept_id. Joins follow these references. Full guide: JOINs explained →
- FULL OUTER JOIN
- A join that keeps every row from both tables, matching where possible and filling the gaps with NULL on whichever side has no partner. Full guide: JOINs explained →
G
- GROUP BY
- Collapses rows into one row per unique value (or combination) of the named columns, so aggregate functions can summarise each group. Full guide: GROUP BY vs HAVING →
H
- HAVING
- WHERE's counterpart for groups: it filters after GROUP BY has run, so it can test aggregate values like COUNT(*) > 2, which WHERE cannot see. Full guide: GROUP BY vs HAVING →
I
- Index
- A database structure that makes lookups on a column fast, at the cost of storage and slower writes - the reason WHERE email = ... can be instant on a million rows. Queries never name indexes; the database chooses to use them.
- INNER JOIN
- The default join: returns only the row pairs where the ON condition matches on both sides. Rows with no partner are dropped. Full guide: JOINs explained →
- INSERT
- Adds new rows to a table. Naming the columns - INSERT INTO t (a, b) VALUES (...) - keeps the statement working when the table later gains columns. Full guide: Changing data safely →
- IS NULL
- The only correct way to test for NULL. Comparing with = NULL never matches anything, because NULL means unknown and nothing is known to equal an unknown. Full guide: The WHERE guide →
J
- JOIN
- The operation that combines rows from two tables by matching a condition, usually a foreign key against a primary key. Written alone, JOIN means INNER JOIN. Full guide: JOINs explained →
L
- LEFT JOIN
- Keeps every row from the left table; where the right table has no match, its columns come back NULL. The join to reach for when unmatched rows still matter. Full guide: JOINs explained →
- LIKE
- Pattern matching for text: % stands for any run of characters, _ for exactly one. WHERE name LIKE 'A%' finds names starting with A. Full guide: The WHERE guide →
- LIMIT
- Caps how many rows come back. Meaningful only with an ORDER BY - otherwise it returns an arbitrary handful. SQL Server spells it TOP; Oracle uses FETCH FIRST. Full guide: The SELECT guide →
N
- NULL
- The marker for a missing or unknown value. It is not zero and not an empty string, it fails every ordinary comparison, and aggregate functions skip it. Handle it with IS NULL and COALESCE. Full guide: The WHERE guide →
O
- ORDER BY
- Sorts the final result by one or more columns or expressions, ascending by default, DESC for descending. Without it, row order is never guaranteed. Full guide: The SELECT guide →
P
- PARTITION BY
- Inside a window function's OVER clause, splits rows into independent windows - the non-destructive cousin of GROUP BY, computing per group while keeping every row. Full guide: Window functions →
- Primary key
- The column (or columns) that uniquely identifies each row of a table - order_id, emp_id. Foreign keys in other tables point at it.
Q
- Query
- A request for data written in SQL - most often a SELECT statement. The database plans how to execute it and returns a result table. Full guide: The beginner guide →
R
- RIGHT JOIN
- The mirror of LEFT JOIN: keeps every row from the right table. Rarely written in practice, because swapping the table order turns it into the easier-to-read LEFT JOIN. Full guide: JOINs explained →
- ROW_NUMBER
- A window function that hands out 1, 2, 3... down a specified order, turning position into a value you can filter on - the engine behind pagination and top-N-per-group. Full guide: Window functions →
S
- Schema
- The structure of a database: which tables exist, their columns and types, and how they relate. Reading a schema is the first step of writing a query against unfamiliar data.
- SELECT
- The statement that reads data. Its clauses - FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT - each answer one question about what comes back. Full guide: The SELECT guide →
- Self join
- Joining a table to itself, with two aliases telling the two copies apart. The standard way to walk relationships a table has with its own rows, like employee to manager. Full guide: JOINs explained →
- Subquery
- A SELECT nested inside another statement, supplying a value, a list or a derived table to its outer query. The correlated variety re-runs per outer row. Full guide: Subqueries guide →
T
- Table
- The basic container of a relational database: named columns across the top, one row per record. Everything SQL does starts from tables and produces table-shaped results. Full guide: The beginner guide →
- Transaction
- A group of statements executed all-or-nothing: COMMIT keeps every change, ROLLBACK undoes them all. The mechanism behind the ACID guarantees databases advertise. Full guide: Changing data safely →
- TRUNCATE
- Empties a table in one fast operation, without a WHERE and typically without firing per-row triggers. For removing specific rows, DELETE is the tool. Full guide: Changing data safely →
U
- UNION and UNION ALL
- Stack two results with the same column shape on top of each other. UNION removes duplicate rows (extra work); UNION ALL keeps everything and is faster. Full guide: JOINs explained →
- UPDATE
- Changes values in existing rows: SET says what changes, WHERE says which rows. Without a WHERE, it changes every row in the table. Full guide: Changing data safely →
V
- View
- A stored, named query that behaves like a table. Where a CTE lives for one query, a view lives in the database and is shared by every query and user. Full guide: CTEs explained →
W
- WHERE
- Filters rows before anything else happens to them - before grouping, before selecting, before sorting. The workhorse clause of practically every real query. Full guide: The WHERE guide →
- Wildcard
- A placeholder character in a LIKE pattern: % matches any run of characters (including none), _ matches exactly one. SELECT's * is also loosely called a wildcard - it means every column. Full guide: The WHERE guide →
- Window function
- A function that computes a value for each row from a window of related rows - rankings, running totals, per-group averages - without collapsing rows the way GROUP BY does. Full guide: Window functions →