CHAPTER 3 · 2 lessons · 26 exercises
Databases
What sits behind SQL. How tables are designed, and what keeps them safe when several people write at once.
This chapter looks from behind at why the SELECT and JOIN you wrote in the SQL course can be written that way.
It covers normalisation (how to split a table up), the relational operations (projection, selection and join), transactions (what happens when something fails partway), exclusive control and locking, and why an index is fast. Being able to answer "why does adding an index make it faster" is the goal of the chapter.
Lessons in this chapter
Table design and normalisation
- 07Splitting tables the right wayWhy tables come apart, and why JOIN can put them back together. How keys get chosen, and normalisation as the procedure for splitting.Go to the exercises
Transactions and indexes
- 08Failing halfway without breaking anythingA transfer where only one half happened would be trouble. How things succeed together or get undone together, how they are protected when touched at once, and how they are put back after a crash.Go to the exercises