The film table

This article introduces the structure of the film table in the Sakila database.

The film table lists all the films that may be in stock in the store.

The film table refers to the language table using a foreign key.

The actual in-stock copy of each film is listed in the inventory table. The inventory table refers to the film table using a foreign key.

The many-to-many relationship between films and categories is stored in the film_category table.

The many-to-many relationship between films and actors is stored in the film_actor table.

Table Structure

The structure of the film table is as follows:

+----------------------+---------------------------------------------------------------------+------+-----+-------------------+-----------------------------------------------+
| Field                | Type                                                                | Null | Key | Default           | Extra                                         |
+----------------------+---------------------------------------------------------------------+------+-----+-------------------+-----------------------------------------------+
| film_id              | smallint unsigned                                                   | NO   | PRI | NULL              | auto_increment                                |
| title                | varchar(128)                                                        | NO   | MUL | NULL              |                                               |
| description          | text                                                                | YES  |     | NULL              |                                               |
| release_year         | year                                                                | YES  |     | NULL              |                                               |
| language_id          | tinyint unsigned                                                    | NO   | MUL | NULL              |                                               |
| original_language_id | tinyint unsigned                                                    | YES  | MUL | NULL              |                                               |
| rental_duration      | tinyint unsigned                                                    | NO   |     | 3                 |                                               |
| rental_rate          | decimal(4,2)                                                        | NO   |     | 4.99              |                                               |
| length               | smallint unsigned                                                   | YES  |     | NULL              |                                               |
| replacement_cost     | decimal(5,2)                                                        | NO   |     | 19.99             |                                               |
| rating               | enum('G','PG','PG-13','R','NC-17')                                  | YES  |     | G                 |                                               |
| special_features     | set('Trailers','Commentaries','Deleted Scenes','Behind the Scenes') | YES  |     | NULL              |                                               |
| last_update          | timestamp                                                           | NO   |     | CURRENT_TIMESTAMP | DEFAULT_GENERATED on update CURRENT_TIMESTAMP |
+----------------------+---------------------------------------------------------------------+------+-----+-------------------+-----------------------------------------------+

Table Columns

The following table explains all columns in the film table.

Column Description
film_id The surrogate primary key used to uniquely identify each film in the table.
title The title of the film.
description A short description or plot summary of the film.
release_year The year the film was released.
language_id The language of the film. It refers to the language table.
original_language_id The original language of the film. Used when the film is dubbed into a new language. It refers to the language table.
rental_duration The length of the rental period, in days.
rental_rate The cost to rent the film for the period specified in the rental_duration column.
length The duration of the film, in minutes.
replacement_cost If the film is not returned or returned in a damaged state, the customer will be charged.
rating The rating assigned to the film, possible values: G, PG, PG-13, R, NC-17, .
special_features List the common special features included in the DVD. It can be zero or more: Trailers, Commentaries, Deleted Scenes, Behind the Scenes.
last_update The time when the row was created or last updated.