Relational Database Concepts
The Relational Model
Section titled “The Relational Model”Developed by Edgar F. Codd in 1970, the relational model organizes data into tables (relations) with rows and columns.
Key Components
Section titled “Key Components”Tables (Relations)
Section titled “Tables (Relations)”- Collection of related data entries
- Consists of rows and columns
- Each table represents an entity
Rows (Tuples/Records)
Section titled “Rows (Tuples/Records)”- Individual data entries in a table
- Each row represents a single instance of an entity
Columns (Attributes/Fields)
Section titled “Columns (Attributes/Fields)”- Properties or characteristics of an entity
- Define the structure of data in a table
Domains
Section titled “Domains”- Set of allowable values for an attribute
- Defines data type and constraints
Primary Keys
Section titled “Primary Keys”- Uniquely identifies each row in a table
- Cannot contain NULL values
- Cannot have duplicate values
- Can be composite (multiple columns)
Foreign Keys
Section titled “Foreign Keys”- Column(s) that reference primary key of another table
- Establishes relationships between tables
- Maintains referential integrity
Relational Integrity Rules
Section titled “Relational Integrity Rules”Entity Integrity
Section titled “Entity Integrity”- Primary key cannot be NULL
- Primary key must be unique
Referential Integrity
Section titled “Referential Integrity”- Foreign key values must match existing primary key values
- Or foreign key can be NULL (if allowed)
Domain Integrity
Section titled “Domain Integrity”- Values must be within defined domain
- Data type constraints must be followed
Relationships
Section titled “Relationships”One-to-One (1:1)
Section titled “One-to-One (1:1)”- Each record in Table A relates to one record in Table B
One-to-Many (1:M)
Section titled “One-to-Many (1:M)”- Each record in Table A can relate to multiple records in Table B
Many-to-Many (M:N)
Section titled “Many-to-Many (M:N)”- Records in both tables can relate to multiple records in the other
- Requires junction table to implement