Skip to content

Commit acadf96

Browse files
formatting of the relational model, remove the queries chapter from Concepts
1 parent 5c7a4fd commit acadf96

File tree

2 files changed

+25
-62
lines changed

2 files changed

+25
-62
lines changed

book/20-concepts/01-relational.md

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
---
2-
title: Relational Theory
3-
date: 2024-08-20
4-
authors:
5-
- name: Dimitri Yatsenko
6-
---
1+
# Relational Model
72

8-
# Origins of Relational Theory
3+
## Origins of Relational Theory
94

105
Relations are a key concept in mathematics, representing how different elements from one set are connected to elements of another set. When two sets are of elements are related to each other, this forms a *second-order* or *binary* relation. Higher orders are also possible: third, fourth, and $n^{th}$ order relations.
116

@@ -58,7 +53,7 @@ Cantor's set theory introduced the idea that relations could be seen as subsets
5853
[Georg Cantor](https://en.wikipedia.org/wiki/Georg_Cantor) (1845-1918) reframed relations in the context of Set Theory
5954
```
6055

61-
# Mathematical Foundations
56+
## Mathematical Foundations
6257
Relational theory is not just a mathematical curiosity; it is a powerful tool that underpins many important concepts in mathematics and computer science. The ability to describe and analyze how different objects are connected is fundamental to many areas of study.
6358

6459
One of the most important applications of relational theory is in the concept of **functions**. A function is a specific type of relation where each element in the domain (the first set) is associated with exactly one element in the codomain (the second set). Functions are essential in nearly every area of mathematics, from calculus to linear algebra.
@@ -77,7 +72,7 @@ In first-order logic, predicates represent relations, and the logical statements
7772
The equivalence between relational theory and first-order logic was notably formalized by Alfred Tarski in the 1930s.
7873
Tarski demonstrated that every relation can be described by a formula in first-order logic, establishing a profound connection between these mathematical frameworks that has since underpinned much of modern theoretical computer science and logic.
7974

80-
# Relational Algebra and Calculus
75+
## Relational Algebra and Calculus
8176

8277
**Relational algebra** is a set of operations that can be used to transform relations in a formal way.
8378
It provides the foundation for querying relational databases, allowing us to combine, modify, and retrieve data stored in tables (relations).
@@ -130,7 +125,7 @@ The query notation of the SQL programming language combines concepts from both r
130125
However, DataJoint's query language is based purely on relational algebra.
131126
:::
132127

133-
# Relational Database Model
128+
## Relational Database Model
134129
The **relational data model** is the brainchild of the British-American mathematician and engineer [Edgar F. Codd.](https://amturing.acm.org/award_winners/codd_1000892.cfm), earning him the prestigeous Turing Award in 1981.
135130

136131
Working at IBM, Codd explored the possibility of translating the mathematic rigor of relational theory into powerful system for large-scale data management and operation [@10.1145/362384.362685].
@@ -178,23 +173,23 @@ Practical database programmers speak of tables and rows while theoretical data m
178173
| **Tuple** | **Record** or **Row** | A single element of a relation, containing a value for each attribute. |
179174
:::
180175

181-
# Three Views of the Relational Model
176+
## Three Views of the Relational Model
182177

183178
The relational data model, while powerful, offers considerable flexibility that can be both a blessing and a curse. This flexibility has led to the development of three distinct conceptual frameworks for understanding and applying relational databases. While these approaches share the same underlying syntax (tables, primary keys, foreign keys, etc.), they provide fundamentally different **semantics** that lead to distinct approaches to database design, data manipulation, and query formation.
184179

185-
## The Mathematical View: Predicate Calculus and Functional Dependencies
180+
### The Mathematical View: Predicate Calculus and Functional Dependencies
186181

187182
The **mathematical view** of the relational model, championed by Edgar F. Codd, is rooted in **predicate calculus** and **set theory**. This approach treats relations as mathematical predicates—statements about variables that can be determined to be true or false.
188183

189-
### Core Definitions
184+
#### Core Definitions
190185

191186
**Relation as Predicate**: A table (relation) represents a logical predicate; it contains the complete set of all facts (propositions) that make the predicate true.
192187

193188
**Tuple as Proposition**: Each row (tuple) is a specific set of attribute values that asserts a true proposition for the predicate. For example, if a table's predicate is "Employee $x$ works on Project $y$," the row (Alice, P1) asserts: "Employee Alice works on Project P1."
194189

195190
**Functional Dependencies**: The core concept is the functional dependency: attribute `A` functionally determines attribute `B` (written `A → B`) if knowing the value of `A` allows you to determine the unique value of `B`.
196191

197-
### Design Philosophy
192+
#### Design Philosophy
198193

199194
The mathematical approach frames database design as deciding **which predicates should become base relations (stored tables)** so that:
200195
- All other valid true propositions can be **most easily and efficiently derived** through relational operations
@@ -203,15 +198,15 @@ The mathematical approach frames database design as deciding **which predicates
203198

204199
**Normalization Principle**: "Every non-key attribute must depend on the key, the whole key, and nothing but the key."
205200

206-
### Characteristics
201+
#### Characteristics
207202
- **Abstract**: Reasons about predicates and functional dependencies, not real-world entities
208203
- **Mathematical**: Provides formal, rigorous definitions and proofs
209204
- **Attribute-centric**: Focuses on relationships between attributes
210205
- **Prescriptive**: Provides clear rules (normal forms) to check compliance
211206

212-
## The Entity-Relationship View: Domain Modeling
207+
### The Entity-Relationship View: Domain Modeling
213208

214-
The **entity-relationship view**, introduced by Peter Chen in 1976, revolutionized how we think about database design by shifting from abstract mathematical concepts to concrete domain modeling.
209+
The **entity-relationship view**, introduced by Peter Chen in 1976, revolutionized how we think about database design by shifting from abstract mathematical concepts to concrete domain modeling: @10.1145/320434.320440, @10.1007/978-3-642-59412-0_17
215210

216211
```{figure} ../images/PChen.jpeg
217212
:name: Peter Chen
@@ -220,21 +215,21 @@ The **entity-relationship view**, introduced by Peter Chen in 1976, revolutioniz
220215
Peter Chen, born in 1943, Taiwanese-American computer scientist, inventor of the Entity-Relationship Model.
221216
```
222217

223-
### Core Definitions
218+
#### Core Definitions
224219

225220
**Entity Set**: An unordered collection of identifiable items (entities) that share the same attributes and are distinguished by a primary key.
226221

227222
**Relationship Set**: A collection of associations that link entities from different entity sets, defined by referential constraints (foreign keys).
228223

229224
**Entity Type**: A well-defined category of things in the domain (e.g., Student, Course, Department).
230225

231-
### Design Philosophy
226+
#### Design Philosophy
232227

233228
The entity-relationship approach frames database design as identifying **what entity types exist** in the domain and **how they relate to each other**.
234229

235230
**Entity Normalization Principle**: "Each table represents exactly one well-defined entity type, identified by the table's primary key. All non-key attributes must describe that entity type directly, completely, and non-optionally."
236231

237-
### Characteristics
232+
#### Characteristics
238233
- **Concrete**: Starts with recognizable entities in the domain
239234
- **Intuitive**: Maps to how people naturally think about their domain
240235
- **Entity-centric**: Focuses on identifying entity types and their properties
@@ -259,11 +254,11 @@ erDiagram
259254
Entity-relationship diagram in [Crow's Foot notation](https://mermaid.js.org/syntax/entityRelationshipDiagram.html).
260255
:::
261256

262-
## The Entity-Workflow View: Temporal and Operational Modeling
257+
### The Entity-Workflow View: Temporal and Operational Modeling
263258

264259
The **entity-workflow view**, pioneered by DataJoint, extends entity normalization with a sequential dimension: the **Entity-Workflow Model**. While traditional ERM focuses on **what entities exist**, DataJoint emphasizes **when and how entities are created** through workflow execution.
265260

266-
### Core Definitions
261+
#### Core Definitions
267262

268263
**Workflow Entity**: An entity that is created at a specific step in a workflow, representing an artifact of workflow execution.
269264

@@ -273,13 +268,13 @@ The **entity-workflow view**, pioneered by DataJoint, extends entity normalizati
273268

274269
**Directed Acyclic Graph (DAG)**: The schema structure that represents valid workflow execution sequences, prohibiting circular dependencies.
275270

276-
### Design Philosophy
271+
#### Design Philosophy
277272

278273
The entity-workflow approach frames database design as mapping **workflow steps to tables** and ensuring **temporal coherence** in entity creation.
279274

280275
**Workflow Normalization Principle**: "Every table represents an entity type that is created at a specific step in a workflow, and all attributes describe that entity as it exists at that workflow step."
281276

282-
### Characteristics
277+
#### Characteristics
283278
- **Temporal**: Views entities as artifacts created by operations
284279
- **Operational**: Focuses on workflow sequence and dependencies
285280
- **Workflow-centric**: Emphasizes when/how entities are created
@@ -291,11 +286,11 @@ The entity-workflow approach frames database design as mapping **workflow steps
291286
DataJoint diagram for the same design
292287
```
293288

294-
## Semantic Differences and Convergence
289+
### Semantic Differences and Convergence
295290

296-
While all three views use the same underlying syntax (tables, primary keys, foreign keys), they provide fundamentally different **semantics**:
291+
While all three views rely on the same underlying constructs (tables, data types, primary keys, foreign keys), they provide fundamentally different **semantics**:
297292

298-
### Different Semantics
293+
#### Different Semantics
299294

300295
| Aspect | Mathematical View | Entity-Relationship View | Entity-Workflow View |
301296
|--------|------------------|-------------------------|---------------------|
@@ -305,7 +300,7 @@ While all three views use the same underlying syntax (tables, primary keys, fore
305300
| **Design Method** | Identify dependencies, decompose | Identify entities, separate entity types | Identify workflow steps, separate by workflow steps |
306301
| **Reasoning Style** | Abstract, mathematical | Concrete, intuitive | Temporal, operational |
307302

308-
### Convergent Results
303+
#### Convergent Results
309304

310305
Despite their different conceptual foundations, all three approaches **converge on the same practical principles**:
311306

@@ -314,7 +309,7 @@ Despite their different conceptual foundations, all three approaches **converge
314309
3. **Clear Structure**: All lead to schemas that reflect domain organization
315310
4. **Data Integrity**: Each approach ensures consistency through appropriate constraints
316311

317-
### Practical Implications
312+
#### Practical Implications
318313

319314
**For Database Design**:
320315
- **Mathematical**: Start with functional dependency analysis
@@ -331,7 +326,7 @@ Despite their different conceptual foundations, all three approaches **converge
331326
- **Entity-Relationship**: Use entity relationship traversal
332327
- **Entity-Workflow**: Use workflow dependency traversal
333328

334-
## Choosing Your Perspective
329+
### Choosing Your Perspective
335330

336331
The choice of perspective depends on your context and needs:
337332

book/20-concepts/05-queries.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)