PLZ help with the following: Use oracle live sql to change the following commands so that they work with creating the table CREATE TABLE `book`( `num` INT(20) NOT NULL AUTO_INCREMENT, `title` VARCHAR(20), `year` DATE, `subject` VARCHAR(20), `checkedout` DATETIME, `checkedin` DATETIME, PRIMARY KEY (`num`) ); CREATE TABLE `client`( `CID` INT(20) NOT NULL AUTO_INCREMENT, `fname` VARCHAR(25), `lname` VARCHAR(25), `type` VARCHAR(25), `num` INT(20), PRIMARY KEY (`CID`), FOREIGN KEY (`num`) REFERENCES `emp`.`state`(`state_id`) ); CREATE TABLE `author`( `id` INT(10) NOT NULL AUTO_INCREMENT, `year` DATE, `fName` VARCHAR(20), `lname` VARCHAR(20), `num` INT(20), PRIMARY KEY (`id`) ); ALTER TABLE `author` ADD FOREIGN KEY (`num`) REFERENCES `book`(`num`); ALTER TABLE `client` ADD CONSTRAINT `client_ibfk_1` FOREIGN KEY (`num`) REFERENCES `book`(`num`);
PLZ help with the following:
Use oracle live sql to change the following commands so that they work with creating the table
CREATE TABLE `book`( `num` INT(20) NOT NULL AUTO_INCREMENT, `title` VARCHAR(20), `year` DATE, `subject` VARCHAR(20), `checkedout` DATETIME, `checkedin` DATETIME, PRIMARY KEY (`num`) );
CREATE TABLE `client`( `CID` INT(20) NOT NULL AUTO_INCREMENT, `fname` VARCHAR(25), `lname` VARCHAR(25), `type` VARCHAR(25), `num` INT(20), PRIMARY KEY (`CID`), FOREIGN KEY (`num`) REFERENCES `emp`.`state`(`state_id`) );
CREATE TABLE `author`( `id` INT(10) NOT NULL AUTO_INCREMENT, `year` DATE, `fName` VARCHAR(20), `lname` VARCHAR(20), `num` INT(20), PRIMARY KEY (`id`) );
ALTER TABLE `author` ADD FOREIGN KEY (`num`) REFERENCES `book`(`num`);
ALTER TABLE `client` ADD CONSTRAINT `client_ibfk_1` FOREIGN KEY (`num`) REFERENCES `book`(`num`);
Step by step
Solved in 2 steps