Consider the same schema as above given by the following create table statements.
CREATE TABLE Boats (bID INT PRIMARY KEY, bcolor VARCHAR(10);
CREATE TABLE Sailors (sID INT PRIMARY KEY, sName VARCHAR(20), sRating INT);
CREATE TABLE Reservations (bID INT REFERENCES Boats, sID INT REFERENCES Sailors, dateRes DATE,
PRIMARY KEY (bID, sID, dateRes);
Let us assume that we have written a PL/SQL trigger that ensures that any new boat inserted will have bcolor value of one of the primary colors: red, blue or green (you can assume your trigger code from above).
Let us also consider that the boats table has the following data.
bID | bColor |
101 | red |
102 | blue |
Will the following INSERT statement succeed or will it give an error? Also, show the Boats table after performing the INSERT statement.
INSERT IGNORE INTO Boats VALUES (103, 'red');