I have a derived attribute Fine
in a MySQL table, whose value is
(CurrentDate - DueDate) * 0.5
CurrentDate
and DueDate
are stored in the table in the Date
format.
How can I specify this formula for Fine
attribute in my table
CREATE TABLE IF NOT EXISTS Loan (
loanID INT UNSIGNED NOT NULL AUTO_INCREMENT,
BorrowDate DATE DEFAULT NULL,
ReturnDate DATE DEFAULT NULL,
DueDate DATE DEFAULT NULL,
--- Fine... What do I write for Fine here-------
userID INT UNSIGNED NOT NULL,
itemID INT UNSIGNED NOT NULL,
PRIMARY KEY (loanID) ,
FOREIGN KEY (userID) REFERENCES LibraryUser (userID),
FOREIGN KEY (itemID) REFERENCES Items (itemID)
);