Table customer
This table contains a list of all customers.
The table is referred to in the payment and rental tables and refers to the address and store tables using foreign keys.
Schema
This table belongs to schema sakila.
Columns
This table contains 9 columns.
customer_id-
smallint·NOT NULLA surrogate primary key used to uniquely identify each customer in the table.
store_id-
smallint·NOT NULLA foreign key identifying the customer home store. Customers are not limited to renting only from this store, but this is the store at which they generally shop.
first_name-
character varying(45)·NOT NULLThe customer first name.
last_name-
character varying(45)·NOT NULLThe customer last name.
email-
character varying(50)·NULL::character varyingThe customer email address.
address_id-
smallint·NOT NULLA foreign key identifying the customer address in the address table.
active-
boolean·NOT NULL·trueIndicates whether the customer is an active customer. Setting this to
FALSEserves
as an alternative to deleting a customer outright. Most queries should have aWHERE active = TRUEclause. create_date-
timestamp(0) without time zone·NOT NULLThe date the customer was added to the system. This date is automatically set using a trigger during an
INSERT. last_update-
timestamp(0) without time zone·CURRENT_TIMESTAMPWhen the row was created or most recently updated.
Primary key
This table has a primary key.
customer-
customer_id
Foreign keys
This table has one foreign key.
fk_customer_address-
address_id»sakila.address (address_id)·ON UPDATE CASCADE·ON DELETE RESTRICT fk_customer_store-
store_id»sakila.store (store_id)·ON UPDATE CASCADE·ON DELETE RESTRICT
Indices
This table has 4 indices.
customer_pkey-
customer_id idx_customer_fk_address_id-
address_id idx_customer_fk_store_id-
store_id idx_customer_last_name-
last_name