SQL, or Structured Query Language, is the standardized language used to manage relational databases—databases that organize data into tables connected through defined relationships. A relational database is managed by software called an RDBMS, with popular implementations including PostgreSQL, MySQL, SQLite, Oracle, and SQL Server. Each of these systems speaks a common core of SQL but often extends it with proprietary features known as dialects.
A table is the fundamental unit of storage in a relational database. It consists of rows and columns: a row represents a single record, while a column represents an attribute or field shared by every row in the table. To make rows addressable and to link tables together, SQL uses keys. A primary key uniquely identifies each row and cannot be NULL, while a foreign key in one table references the primary key of another, establishing a relationship between them. More advanced key types include composite keys (formed from multiple columns acting together) and candidate keys (any column or set that could serve as the primary key).
The reliability of these relationships is governed by referential integrity, which ensures that every foreign key points to an existing primary key. Underpinning everything is the requirement that each cell in a well-designed table hold a single atomic value—introducing the first rule of normalization explored in the next chapter.