> ## Documentation Index
> Fetch the complete documentation index at: https://villagesql.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# The Sakila sample database

> Every lesson in this tutorial queries Sakila, a DVD rental schema of 16 tables and 16,044 rentals. Here is what is in it and where it comes from.

<Card title="VillageSQL is a drop-in replacement for MySQL with extensions." icon="database" href="/docs/mysql-8.4/stable/quickstart">
  All examples on this page work on VillageSQL. Install Now →
</Card>

Every lesson in this tutorial queries the same database, so you load it once
and then stop thinking about it. That database is Sakila, which models a chain
of 2 DVD rental stores: the films they carry, the customers who rent them, the
staff who serve them, and the payments that result.

Sakila suits a tutorial because of its size. 1,000 films and 16,044 rentals are
enough that a query returns something worth looking at, and there are few enough
tables that you can keep the shape of it in your head.

## What is in it

Sakila holds 16 tables of data. These are the counts on a freshly loaded copy.

| Table | Rows | What it holds |
| - | - | - |
| `actor` | 200 | One row per actor |
| `address` | 603 | Street addresses, shared by customers, staff and stores |
| `category` | 16 | Film genres |
| `city` | 600 | Cities, each belonging to a country |
| `country` | 109 | Countries |
| `customer` | 599 | One row per customer of either store |
| `film` | 1000 | The film catalog, with rental rate and length |
| `film_actor` | 5462 | Which actors appear in which films |
| `film_category` | 1000 | Which category each film belongs to |
| `film_text` | 1000 | Film titles and descriptions, for full text search |
| `inventory` | 4581 | Physical copies of films, held at a store |
| `language` | 6 | Languages a film can be in |
| `payment` | 16044 | One row per payment taken |
| `rental` | 16044 | One row per rental, with the dates out and back |
| `staff` | 2 | The 2 members of staff |
| `store` | 2 | The 2 stores |

You can check any of these counts yourself once the next lesson has loaded
Sakila. `COUNT(*)` reports how many rows a table holds:

```sql theme={null}
SELECT COUNT(*) FROM actor;
```

```text theme={null}
+----------+
| COUNT(*) |
+----------+
|      200 |
+----------+
1 row in set (0.00 sec)
```

Sakila also carries 7 views, which are saved queries rather than stored rows:
`actor_info`, `customer_list`, `film_list`, `nicer_but_slower_film_list`,
`sales_by_film_category`, `sales_by_store` and `staff_list`. No lesson uses
them, but they are there if you want to read how someone else wrote the same
joins.

## The tables the lessons lean on

You do not need all 16. A handful carry most of the examples.

* `film` is the workhorse. It has text, numbers, dates and a foreign key, so
  most ideas can be shown against it alone.
* `language` has 6 rows, so a query against it prints a complete result you can
  check by eye.
* `customer`, `address` and `city` chain together through foreign keys, which
  makes them the natural set for the join lessons.

## Where it comes from

Oracle publishes Sakila as a sample database. Its schema file and its data file
are covered by the New BSD license, which permits commercial use as long as the
notice travels with the files. That notice is reproduced in full in the
[`NOTICE` file](https://github.com/villagesql/villagesql-docs/blob/main/NOTICE)
of the repository that holds these docs.

The next lesson downloads Sakila from Oracle and loads it into your server.

## See also

* [Load Sakila](/docs/tutorial/load-sakila) — download it and load it into your server
* [Normalization in MySQL](/docs/guides/normalization) — why a schema splits data across tables
* [Foreign keys in MySQL](/docs/guides/foreign-keys) — the relationships the join lessons follow

MySQL is a registered trademark of Oracle and/or its affiliates. Other names
may be trademarks of their respective owners. VillageSQL is not affiliated with
or endorsed by Oracle Corporation.
