Basic SQL & Database Definitions
This document is a plain‑language glossary of common database and SQL terms. It’s
designed to be beginner‑friendly, quick to scan, and easy to revisit while studying or
working on projects.
1. Databases & Data Concepts
Data
Raw facts or values (numbers, text, dates) with no context on their own.
Information
Data that has been processed or organized so it has meaning.
Database
An organized collection of data stored electronically so it can be easily accessed,
managed, and updated.
Relational Database (RDBMS)
A database that stores data in tables with rows and columns and uses relationships
between tables.
Table
A structured set of data organized into rows and columns.
Row (Record)
One complete entry in a table (represents a single item or entity).
Column (Field)
A single attribute or type of data stored in a table.
Schema
The structure or blueprint of a database: tables, columns, data types, and relationships.
Entity
A real‑world object or concept represented in a database (e.g., Customer, Order, Product).
Attribute
A property or characteristic of an entity (stored as a column).
2. Keys & Relationships
Primary Key (PK)
A column (or set of columns) that uniquely identifies each row in a table.
Foreign Key (FK)
A column that references the primary key of another table to create a relationship.
Candidate Key
Any column (or set of columns) that could uniquely identify a row.
Composite Key
A primary key made from two or more columns.
Surrogate Key
An artificial key (often an auto‑increment ID) used instead of a natural key.
Natural Key
A key derived from real‑world data (like an email address or SSN).
One‑to‑One Relationship
Each row in Table A relates to one row in Table B.
One‑to‑Many Relationship
One row in Table A relates to many rows in Table B.
Many‑to‑Many Relationship
Rows in Table A relate to many rows in Table B (usually resolved with a junction table).
3. Normalization
Normalization
The process of organizing data to reduce redundancy and improve integrity.
First Normal Form (1NF)
No repeating groups; each field contains atomic (indivisible) values.
Second Normal Form (2NF)
Meets 1NF and removes partial dependency on a composite key.
Third Normal Form (3NF)
Meets 2NF and removes transitive dependencies.
Denormalization
Intentionally adding redundancy to improve query performance.
4. SQL Basics
SQL (Structured Query Language)
The standard language used to interact with relational databases.
Query
A request for data or for an action to be performed on data.
SELECT
Retrieves data from one or more tables.
FROM
Specifies the table(s) to retrieve data from.
WHERE
Filters rows based on a condition.
ORDER BY
Sorts results.
LIMIT / TOP
Restricts the number of rows returned.
5. Filtering & Logic
AND / OR / NOT
Logical operators used in conditions.
IN
Checks if a value matches any value in a list.
BETWEEN
Checks if a value falls within a range.
LIKE
Used for pattern matching with wildcards (% and _).
NULL
Represents missing or unknown data (not the same as 0 or empty string).
6. Aggregations & Grouping
Aggregate Function
Performs calculations on multiple rows and returns a single value.
Common aggregates: - COUNT() – Number of rows - SUM() – Total - AVG() – Average - MIN()
/ MAX() – Smallest / largest value
GROUP BY
Groups rows so aggregate functions can be applied per group.
HAVING
Filters grouped results (used with GROUP BY).
7. Joins
JOIN
Combines rows from two or more tables based on a related column.
INNER JOIN
Returns only matching rows from both tables.
LEFT JOIN
Returns all rows from the left table and matching rows from the right.
RIGHT JOIN
Returns all rows from the right table and matching rows from the left.
FULL OUTER JOIN
Returns all rows from both tables, matching where possible.
8. Data Modification (DML)
INSERT
Adds new rows to a table.
UPDATE
Modifies existing rows.
DELETE
Removes rows from a table.
9. Database Objects & Control
Index
Improves query performance by allowing faster lookups.
View
A saved query that behaves like a virtual table.
Constraint
Rules enforced on data (e.g., NOT NULL, UNIQUE).
Transaction
A group of operations treated as a single unit of work.
ACID
Properties that ensure reliable transactions: - Atomicity - Consistency - Isolation Durability
10. Roles & Access
User
An account that can connect to the database.
Role
A collection of permissions.
Privilege
Permission to perform an action (SELECT, INSERT, etc.).
Principle of Least Privilege
Users should have only the permissions they need—nothing more.
11. Helpful Mental Models
•
•
•
•
•
Tables ≈ spreadsheets (but smarter and stricter)
Rows ≈ individual records
Columns ≈ attributes or fields
Joins ≈ matching puzzle pieces
SQL ≈ asking questions of your data in a structured way
This document is intentionally tool‑agnostic and applies to most SQL databases
(PostgreSQL, MySQL, SQL Server, SQLite, etc.).