Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help mME REMOVE ERROR SPOOL figure9.log SPOOL figure9.log DROP TABLE Dist

ID: 3795408 • Letter: P

Question

Please help mME REMOVE ERROR SPOOL figure9.log SPOOL figure9.log DROP TABLE Distributors CASCADE CONSTRAINT; DROP TABLE Catalogs CASCADE CONSTRAINT; DROP TABLE Orders CASCADE CONSTRAINT; DROP TABLE Customers CASCADE CONSTRAINT; /* Create Tables */ CREATE TABLE Customers ( Customer_id NUMBER(10) NOT NULL, CustomerFirst_name VARCHAR(20) NOT NULL, CustomerLast_name VARCHAR(20) NOT NULL, CustomerStreet_address VARCHAR(30) NOT NULL, CostumerCity VARCHAR(20) NOT NULL, CustomerState CHAR(2) NOT NULL, CostumerZip VARCHAR(9) NOT NULL, CustomerPhone_number VARCHAR(10) NOT NULL, CONSTRAINT Customer_PK PRIMARY KEY (Customer_id)); CREATE TABLE Orders ( Order_id NUMBER(10) NOT NULL, OrderDate DATE DEFAULT SYSDATE, CONSTRAINT Order_PK PRIMARY KEY (Order_id)); CREATE TABLE Products ( Product_id NUMBER(10) NOT NULL, ProductDescription VARCHAR(50), ProductMovieType NUMBER(11), Order_id NUMBER(10) NOT NULL, CONSTRAINTS Product_PK PRIMARY KEY (Product__id), CONSTRAINTS Product_FK FOREIGN KEY (Order_id) REFERENCES Order (Order_id)); CREATE TABLE Distributors ( DistributorDisc_id NUMBER(11,0) NOT NULL, DistributorPrice NUMBER(11,0) NOT NULL, DistributorOrderQuantity NUMBER(11), Order_id NUMBER(10) NOT NULL, CONSTRAINTS Distributor_PK PRIMARY KEY (DistributorDisc__id) CONSTRAINTS Distributor_FK FOREIGN KEY (Order_id) REFERENCES Order (Order_id)); CREATE TABLE Catalogs ( Catalog_id NUMBER(5,0) NOT NULL, CatalogRating VARCHAR(10) NOT NULL, CatalogAcademyAwards VARCHAR(50) NOT NULL, CatalogDateReleased DATE DEFAULT SYSDATE, Product_id NUMBER(10) NOT NULL, Order_id NUMBER(10) NOT NULL, DistributorDisc_id NUMBER(11,0) NOT NULL, CONSTRAINT Catalog_PK1 PRIMARY KEY (Catalog_id), CONSTRAINT Catalog_FK1 FOREIGN KEY (Order_id) REFERENCES Orders (Order_id), CONSTRAINT Catalog_FK2 FOREIGN KEY (Product_id) REFERENCES Product (Product_id), CONSTRAINT Catalog_FK3 FOREIGN KEY (DistributorDisc_id) REFERENCES Distributor (DistributorDisc_id)); CREATE TABLE Rentals ( Rental_id NUMBER (9) NOT NULL, RentalReturnDate DATE DEFAULT SYSDATE, RentalRentedQuantity VARCHAR(1) NOT NULL, RentalTotal_charge NUMBER(19,4) NOT NULL, RentalTax NUMBER(19,4) NOT NULL, Product_id NUMBER(10) NOT NULL CONSTRAINT Rental_PK PRIMARY KEY (Rental_id), CONSTRAINT Rental_FK FOREIGN KEY (Product_id) REFERENCES Product (Product_id)); /* Create Foreign Keys */ ALTER TABLE Rentals ADD FOREIGN KEY (DistributorDisc_id) REFERENCES Distributor (DistributorDisc_id); ALTER TABLE Distributors ADD FOREIGN KEY (Product_id) REFERENCES Product (Product_id); ALTER TABLE Products ADD FOREIGN KEY (DistributorDisc_id) REFERENCES Distributor (DistributorDisc_id); ALTER TABLE Rentals DROP COLUMN Catalog_id; ALTER TABLE Customers ADD FOREIGN KEY (RentalTotal_charge); SPOOL OFF

Explanation / Answer

SPOOL figure9.log DROP TABLE Distributors CASCADE CONSTRAINT; DROP TABLE Catalogs CASCADE CONSTRAINT;

DROP TABLE Orders CASCADE CONSTRAINT;

DROP TABLE Customers CASCADE CONSTRAINT;

CREATE TABLE Customers ( Customer_id NUMBER(10) NOT NULL, CustomerFirst_name VARCHAR(20) NOT NULL, CustomerLast_name VARCHAR(20) NOT NULL, CustomerStreet_address VARCHAR(30) NOT NULL, CostumerCity VARCHAR(20) NOT NULL, CustomerState CHAR(2) NOT NULL, CostumerZip VARCHAR(9) NOT NULL, CustomerPhone_number VARCHAR(10) NOT NULL, CONSTRAINT Customer_PK PRIMARY KEY (Customer_id));

CREATE TABLE Orders ( Order_id NUMBER(10) NOT NULL, OrderDate DATE DEFAULT SYSDATE, CONSTRAINT Order_PK PRIMARY KEY (Order_id));

CREATE TABLE Products ( Product_id NUMBER(10) NOT NULL, ProductDescription VARCHAR2(50), ProductMovieType NUMBER(11), Order_id NUMBER(10) NOT NULL, CONSTRAINT Product_PK PRIMARY KEY(Product_id), CONSTRAINT Product_FK FOREIGN KEY(Order_id) REFERENCES Orders (Order_id));

CREATE TABLE Distributors ( DistributorDisc_id NUMBER(11,0) NOT NULL, DistributorPrice NUMBER(11,0) NOT NULL, DistributorOrderQuantity NUMBER(11), Order_id NUMBER(10) NOT NULL, CONSTRAINT Distributor_PK PRIMARY KEY (DistributorDisc_id) ,CONSTRAINT Distributor_FK FOREIGN KEY (Order_id) REFERENCES Orders (Order_id));

CREATE TABLE Catalogs ( Catalog_id NUMBER(5,0) NOT NULL, CatalogRating VARCHAR(10) NOT NULL, CatalogAcademyAwards VARCHAR(50) NOT NULL, CatalogDateReleased DATE DEFAULT SYSDATE, Product_id NUMBER(10) NOT NULL, Order_id NUMBER(10) NOT NULL, DistributorDisc_id NUMBER(11,0) NOT NULL, CONSTRAINT Catalog_PK1 PRIMARY KEY (Catalog_id), CONSTRAINT Catalog_FK1 FOREIGN KEY (Order_id) REFERENCES Orders (Order_id), CONSTRAINT Catalog_FK2 FOREIGN KEY (Product_id) REFERENCES Product (Product_id), CONSTRAINT Catalog_FK3 FOREIGN KEY (DistributorDisc_id) REFERENCES Distributor (DistributorDisc_id));

CREATE TABLE Rentals(Rental_id NUMBER(9) NOT NULL,RentalReturnDate DATE DEFAULT SYSDATE,RentalRentedQuantity VARCHAR(1) NOT NULL, RentalTotal_charge NUMBER(19,4) NOT NULL,RentalTax NUMBER(19,4) NOT NULL,Product_id NUMBER(10) NOT NULL,CONSTRAINT Rental_PK PRIMARY KEY(Rental_id), CONSTRAINT Rental_FK FOREIGN KEY(Product_id) REFERENCES Product(Product_id));

/* Create Foreign Keys */

ALTER TABLE Rentals ADD FOREIGN KEY (DistributorDisc_id) REFERENCES Distributors (DistributorDisc_id);

ALTER TABLE Distributors ADD FOREIGN KEY (Product_id) REFERENCES Product (Product_id);

ALTER TABLE Products ADD FOREIGN KEY (DistributorDisc_id) REFERENCES Distributor (DistributorDisc_id);

ALTER TABLE Rentals DROP COLUMN Catalog_id;

ALTER TABLE Customers ADD FOREIGN KEY (RentalTotal_charge); SPOOL OFF

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote