CREATE TABLE TRUCK(
TRUCK_ID INT NOT NULL PRIMARY KEY,
CAPACITY SMALLINT NOT NULL);
INSERT INTO TRUCK VALUES(11,3), (22, 2), (33,3);
CREATE TABLE CARGO_BOX(
CARGO_BOX_ID INT NOT NULL PRIMARY KEY,
DESCRIPTION VARCHAR(40));
INSERT INTO CARGO_BOX VALUES(101,'PEACHES'),(102,'POTATOES'),(103,'TOMATOES'), (104,'TOMATOES'),(105,'TOMATOES'),
(106,'PINEAPPLES'),(107,'PINEAPPLES');
CREATE TABLE BOX_IN_TRUCK(
TRUCK_ID INT NOT NULL,
CARGO_BOX_ID INT NOT NULL,
FOREIGN KEY(TRUCK_ID) REFERENCES TRUCK(TRUCK_ID),
FOREIGN KEY(CARGO_BOX_ID) REFERENCES CARGO_BOX(CARGO_BOX_ID));
|