The inventory table

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

A row in the inventory  table represents a copy of a given film in a given store.

The inventory table refers to the filmand store tables using foreign keys.

The rental table refers to the inventory table using a foreign key.

Table Structure

The structure of the film table is as follows:

+--------------+--------------------+------+-----+-------------------+-----------------------------------------------+
| Field        | Type               | Null | Key | Default           | Extra                                         |
+--------------+--------------------+------+-----+-------------------+-----------------------------------------------+
| inventory_id | mediumint unsigned | NO   | PRI | NULL              | auto_increment                                |
| film_id      | smallint unsigned  | NO   | MUL | NULL              |                                               |
| store_id     | tinyint unsigned   | NO   | MUL | 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
inventory_id The surrogate primary key used to uniquely identify each item in the inventory.
film_id The primary key of the film represented by this item.
store_id The primary key of the store.
last_update The time when the row was created or last updated.