The relational data model, a concept pioneered by Edgar F. Codd in 1970, remains the bedrock of most modern databases. It organizes information into structured tables, akin to spreadsheets, where data is neatly arranged into rows and columns. This approach allows for clear relationships to be defined between different pieces of data, making it easier to manage and query large volumes of structured information using Structured Query Language (SQL).
At its core, the relational model relies on several key components. Tables, also known as relations, represent distinct entities, with each row (tuple) containing a record and each column (attribute) defining a property of that entity. A schema acts as the blueprint, dictating the structure of these tables, their attributes, data types, and the relationships between them. Understanding the distinction between a relation schema (the design) and a relation instance (the actual data) is crucial.
Domains define the permissible values for each attribute, ensuring data consistency and validity. For instance, an 'age' attribute might have a domain of integers between 0 and 120. This atomic value enforcement is a cornerstone of data integrity.
Keys: The Connectors of Data
Keys are special attributes that uniquely identify rows and forge connections between tables. A primary key uniquely identifies each row within a table, never allowing null values. Candidate keys are potential primary keys, while a super key is any set of attributes that guarantees uniqueness. Crucially, a foreign key in one table references the primary key of another, establishing a link and enforcing referential integrity.
These keys enable various relationships between tables, such as one-to-one, one-to-many, and many-to-many. For example, a customer can have many orders (one-to-many), a relationship maintained via foreign keys. This structured linking is fundamental to how relational databases operate.