SQLSQL

SQL glossary – key terms explained

ACID

Atomicity, Consistency, Isolation, Durability – the guarantees of a transaction.

Aggregate function

Summarizes many rows into one value: COUNT, SUM, AVG, MIN, MAX.

Constraint

A rule in the schema that ensures data quality: NOT NULL, UNIQUE, CHECK, PRIMARY KEY, FOREIGN KEY.

CTE

Common Table Expression: a named subquery with WITH, also possible recursively.

Foreign key

A column that references the primary key of another table and ensures referential integrity.

GROUP BY / HAVING

GROUP BY forms groups for aggregates, HAVING filters the resulting groups.

Index

An additional sorted data structure (usually a B-tree) for fast lookup at the cost of write speed and storage.

JOIN

Combines rows from several tables based on a condition (INNER, LEFT, RIGHT, FULL, CROSS).

Normalization

Splitting tables into normal forms (1NF–3NF) to avoid redundancy and anomalies.

NULL

A marker for "unknown/no value". Comparisons with NULL yield NULL (three-valued logic); check with IS NULL.

Primary key

Column(s) that uniquely identify each row; unique and not NULL.

Query planner

The database component that picks the most efficient execution plan from a declarative query; visible via EXPLAIN.

Relational database

A database that stores data in tables (relations) of rows and columns and links them via keys.

SQL injection

An attack through SQL code smuggled into user input; prevented by parameterized queries.

Subquery

A SELECT inside another statement – scalar, as a list (IN), as an existence check, or as a derived table.

Transaction

A group of statements that count as a unit: COMMIT saves everything, ROLLBACK discards everything.

UPSERT

Insert-or-update in a single atomic statement (ON CONFLICT or ON DUPLICATE KEY UPDATE).

View

A stored, named query that is queried like a table (it stores no data itself).

Window function

A calculation over a window of related rows with OVER (...), without collapsing rows (ranking, running totals).