The staff table
This article introduces the structure of the staff table in the Sakila database.
The staff table lists all staff information, including email addresses, login information, and pictures.
The staff table refers to store and address tables using foreign keys.
The rental table refers to the staff using a foreign key.
The payment table refers to the staff using a foreign key.
The store table refers to the staff using a foreign key.
Table Structure
The structure of the staff table is as follows:
+-------------+-------------------+------+-----+-------------------+-----------------------------------------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------------+------+-----+-------------------+-----------------------------------------------+
| staff_id | tinyint unsigned | NO | PRI | NULL | auto_increment |
| first_name | varchar(45) | NO | | NULL | |
| last_name | varchar(45) | NO | | NULL | |
| address_id | smallint unsigned | NO | MUL | NULL | |
| picture | blob | YES | | NULL | |
| email | varchar(50) | YES | | NULL | |
| store_id | tinyint unsigned | NO | MUL | NULL | |
| active | tinyint(1) | NO | | 1 | |
| username | varchar(16) | NO | | NULL | |
| password | varchar(40) | YES | | NULL | |
| last_update | timestamp | NO | | CURRENT_TIMESTAMP | DEFAULT_GENERATED on update CURRENT_TIMESTAMP |
+-------------+-------------------+------+-----+-------------------+-----------------------------------------------+
Table Columns
The following table explains all columns in the staff table.
| Column | Description |
|---|---|
staff_id |
The surrogate primary key that uniquely identifies the worker. |
first_name |
The name of the staff member. |
last_name |
The last name of the staff member. |
address_id |
The foreign key to the address of the worker in the address table. |
picture |
The BLOB data that contains photos of employees. |
email |
The email address of the staff member. |
store_id |
The staff “home shop”. “The employee can work in other stores, but is usually assigned to the listed store. |
active |
Is this an active employee. If employees leave, their rows will not be deleted from this table; And this column is set to FALSE. |
username |
The user name used by the staff to access the rental system. |
password |
The password used by the staff to access the rental system. The passwords should be is stored as a hash using this SHA2() function. |
last_update |
The time when the row was created or last updated. |