Skip to main content

VillageSQL is a drop-in replacement for MySQL with extensions.

All examples on this page work on VillageSQL. Install Now →
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. You can check any of these counts yourself once the next lesson has loaded Sakila. COUNT(*) reports how many rows a table holds:
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 of the repository that holds these docs. The next lesson downloads Sakila from Oracle and loads it into your server.

See also

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.