Table PAYMENT
This table records each payment made by a customer, with information such as the amount and the rental being paid for (when applicable). The table refers to the CUSTOMER, RENTAL, and STAFF table.
Columns
This table contains 7 columns.
PAYMENT_ID
-
INTEGER
·NOT NULL
A surrogate primary key used to uniquely identify each payment.
CUSTOMER_ID
-
INTEGER
·NOT NULL
The customer whose balance the payment is being applied to. This is a foreign key reference to the CUSTOMER table.
STAFF_ID
-
INTEGER
·NOT NULL
The staff member who processed the payment. This is a foreign key reference to the STAFF table.
RENTAL_ID
-
INTEGER
·DEFAULT NULL
The rental that the payment is being applied to. This is optional because some payments are for outstanding fees and may not be directly related to a rental.
AMOUNT
-
DECIMAL
·NOT NULL
The amount of the payment.
PAYMENT_DATE
-
TIMESTAMP
·NOT NULL
The date the payment was processed.
LAST_UPDATE
-
TIMESTAMP
·NOT NULL
·DEFAULT CURRENT_TIMESTAMP
When the row was created or most recently updated.
Primary key
This table has a primary key.
PAYMENT
-
PAYMENT_ID
Foreign keys
This table has one foreign key.
FK_PAYMENT_CUSTOMER
-
CUSTOMER_ID
»CUSTOMER (CUSTOMER_ID)
·ON UPDATE CASCADE
·ON DELETE NO ACTION
FK_PAYMENT_RENTAL
-
RENTAL_ID
»RENTAL (RENTAL_ID)
·ON UPDATE CASCADE
·ON DELETE SET NULL
FK_PAYMENT_STAFF
-
STAFF_ID
»STAFF (STAFF_ID)
·ON UPDATE CASCADE
·ON DELETE NO ACTION
Indices
This table has 6 indices.
FK_PAYMENT_CUSTOMER
-
CUSTOMER_ID
FK_PAYMENT_RENTAL
-
RENTAL_ID
FK_PAYMENT_STAFF
-
STAFF_ID
IDX_PAYMENT_FK_CUSTOMER_ID
-
CUSTOMER_ID
IDX_PAYMENT_FK_STAFF_ID
-
STAFF_ID
RDB$PRIMARY13
-
PAYMENT_ID