---
title: The example library
description: The small library database used throughout these docs.
sidebar:
  order: 4
---

Most examples in this documentation use the same small database: a library
with **authors**, **books**, **members**, and **loans**. Keeping one
familiar set of tables makes it easier to focus on the concept each page is
teaching.

## The tables

| Table | Columns |
|---|---|
| `authors` | `author_id` (serial, primary key), `name` (text), `birth_year` (int) |
| `books` | `book_id` (serial, primary key), `title` (text), `author_id` (int → authors), `published` (int), `isbn` (text, unique) |
| `members` | `member_id` (serial, primary key), `name` (text), `joined` (date) |
| `loans` | `loan_id` (serial, primary key), `book_id` (int → books), `member_id` (int → members), `loaned_on` (date), `returned_on` (date) |

## The relationships

- **An author has many books.** `books.author_id` points at
  `authors.author_id` — a one-to-many relationship.
- **Members borrow books.** Each row in `loans` ties one book to one member,
  so `loans` connects `books` and `members` — a many-to-many relationship
  expressed through a bridging table.

You will build these tables and relationships step by step in
[Build the library](/guides/build-the-library/). Individual reference pages
use whichever part of this schema illustrates the command at hand.
