Question
Add a new relation: late_notice(patron, book, check_out_date, notice_date) Define constraints sufficient to pass all test cases. You do not need to define any additional constraints
Add a new relation: late_notice(patron, book, check_out_date, notice_date) Define constraints sufficient to pass all test cases. You do not need to define any additional constraints beyond those exercised by the test cases.
CURRENT LATE_NOTICE:
CREATE TABLE late_notice( patron INT PRIMARY KEY, book VARCHAR(255), check_out_date DATE NOT NULL, notice_date DATE NOT NULL, FOREIGN KEY(patron) REFERENCES patron(id), FOREIGN KEY(book) REFERENCES book(isbn) );
TABLES MADE:
CREATE TABLE book( isbn VARCHAR(255) NOT NULL PRIMARY KEY, title VARCHAR(255) NOT NULL, author VARCHAR(255)NOT NULL, pub_date DATE ); CREATE TABLE patron( id INT PRIMARY KEY, first_name VARCHAR(255), last_name VARCHAR(255), sign_up DATE );
CREATE TABLE borrow( patron INT NOT NULL, book VARCHAR(255), check_out_date DATE, due_date DATE,
FOREIGN KEY(patron) REFERENCES patron(id), FOREIGN KEY(book) REFERENCES book(isbn)
);
Am having issues with getting a late notice
values: VALUES (1, '012345', '2021-09-05', '2021-12-01')
While Values: VALUES (1, '012345', '2021-09-05', '2021-11-01') Work fine I dont understand why PLEASE EXPAIN
Add late notice | 1 row affected | 1 row affected | INSERT INTO late_notice (patron, book, check_out_date, notice_date) VALUES (1, '012345', '2021-09-05', '2021-11-01') |
Add late notice | 1 row affected | Error | INSERT INTO late_notice (patron, book, check_out_date, notice_date) VALUES (1, '012345', '2021-09-05', '2021-12-01') |
Add late notice, no patron | Error | Error | INSERT INTO late_notice (patron, book, check_out_date, notice_date) VALUES (null, '012345', '2021-09-05', '2021-12-01') |
Add late notice, non-patron | Error | Error | INSERT INTO late_notice (patron, book, check_out_date, notice_date) VALUES (99, '012345', '2021-09-05', '2021-12-01') |
Add late notice, non-book | Error | Error | INSERT INTO late_notice (patron, book, check_out_date, notice_date) VALUES (2, 'ABCDEF', '2021-11-01', '2021-12-01') |
Add late notice, no borrow record | Error | Error | INSERT INTO late_notice (patron, book, check_out_date, notice_dat |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started