> ## 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.

# Load the Sakila sample database

> Download the Sakila sample database, load its schema and its data into your MySQL server with 2 commands, then check that every table arrived.

<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>

Sakila arrives as 2 SQL files in 1 zip. The first builds the tables, the
second fills them. You run them in that order, against the server from
[Install a server](/docs/tutorial/install-mysql).

## Download it

Run these in any directory you like.

```bash theme={null}
curl -O https://downloads.mysql.com/docs/sakila-db.zip
unzip sakila-db.zip
```

That leaves a `sakila-db` directory. The 2 files you need from it are
`sakila-schema.sql` and `sakila-data.sql`.

## Load it

The schema file first, then the data file. Press Return at each password prompt
if `root` has no password.

```bash theme={null}
mysql -u root -p < sakila-db/sakila-schema.sql
mysql -u root -p < sakila-db/sakila-data.sql
```

Neither command prints anything after the password prompt when it works. The
data file takes longer, because it inserts every row in the database.

<Note>
  The first thing the schema file does is `DROP SCHEMA IF EXISTS sakila`. Running
  these 2 commands again rebuilds the database from scratch, so you can always get
  back to a clean copy. Anything you changed goes with it.
</Note>

## Check it

Ask the server what the database now contains.

```bash theme={null}
mysql -u root -p -e "USE sakila; SHOW TABLES;"
```

```text theme={null}
Enter password:
+----------------------------+
| Tables_in_sakila           |
+----------------------------+
| actor                      |
| actor_info                 |
| address                    |
| category                   |
| city                       |
| country                    |
| customer                   |
| customer_list              |
| film                       |
| film_actor                 |
| film_category              |
| film_list                  |
| film_text                  |
| inventory                  |
| language                   |
| nicer_but_slower_film_list |
| payment                    |
| rental                     |
| sales_by_film_category     |
| sales_by_store             |
| staff                      |
| staff_list                 |
| store                      |
+----------------------------+
```

23 names, because `SHOW TABLES` lists the 16 tables and the 7 views together.

The tables can arrive without the data, so count something as well.

```bash theme={null}
mysql -u root -p -e "SELECT COUNT(*) FROM sakila.film;"
```

```text theme={null}
Enter password:
+----------+
| COUNT(*) |
+----------+
|     1000 |
+----------+
```

1,000 films means you are ready for the first lesson.

## Work inside the database

Every lesson writes its queries as though `sakila` is the current database.
Name it when you open the client:

```bash theme={null}
mysql -u root -p sakila
```

Or switch to it once you are inside:

```sql theme={null}
USE sakila;
```

Without one of those, a query naming `film` fails.

```bash theme={null}
mysql -u root -p -e "SELECT COUNT(*) FROM film;"
```

```text theme={null}
Enter password:
ERROR 1046 (3D000) at line 1: No database selected
```

## See also

* [The Sakila sample database](/docs/tutorial/sakila-database) — what the 16 tables hold
* [SELECT](/docs/tutorial/select) — the first lesson, which queries the data from this one
