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.
Columns
This table contains 9 columns.
CUSTOMER_ID-
INTEGER·NOT NULLA surrogate primary key used to uniquely identify each customer in the table.
STORE_ID-
INTEGER·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-
VARCHAR(45)·NOT NULLThe customer first name.
LAST_NAME-
VARCHAR(45)·NOT NULLThe customer last name.
EMAIL-
VARCHAR(50)·DEFAULT NULLThe customer email address.
ADDRESS_ID-
INTEGER·NOT NULLA foreign key identifying the customer address in the ADDRESS table.
ACTIVE-
BOOLEAN·NOT NULL·DEFAULT 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·NOT NULL·DEFAULT CURRENT_TIMESTAMPThe date the customer was added to the system. This date is automatically set using a trigger during an INSERT.
LAST_UPDATE-
TIMESTAMP·NOT NULL·DEFAULT 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»ADDRESS (ADDRESS_ID)·ON UPDATE CASCADE·ON DELETE NO ACTION FK_CUSTOMER_STORE-
STORE_ID»STORE (STORE_ID)·ON UPDATE CASCADE·ON DELETE NO ACTION
Indices
This table has 6 indices.
FK_CUSTOMER_ADDRESS-
ADDRESS_ID FK_CUSTOMER_STORE-
STORE_ID IDX_CUSTOMER_FK_ADDRESS_ID-
ADDRESS_ID IDX_CUSTOMER_FK_STORE_ID-
STORE_ID IDX_CUSTOMER_LAST_NAME-
LAST_NAME RDB$PRIMARY6-
CUSTOMER_ID