Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create Oracle database tables using SQL Data Definition Language (DDL) for each table listed in the metadata of Assignment 1. You may need to use

Create Oracle database tables using SQL Data Definition Language (DDL) for each table listed in the metadata of Assignment 1. You may need to use a combination of DROP TABLE, CREATE TABLE, and ALTER TABLE SQL statements. Make sure that entity and referential integrity are enforced by declaring a primary key for each table (these may be composite keys) and declaring all appropriate foreign keys. Your CREATE TABLE and ALTER TABLE statements (if desired) must show integrity constraints, as appropriate, for NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, REFERENCES, and CHECK constraints. Be sure to save your SQL script file used to create these tables with a .sql extension and your output SPOOL file with a .lst or .txt extension. You should rerun and test your SQL script file until it runs without any errors (this is why youll want to include DROP TABLE statements). Submit your SPOOL file showing that all SQL in your SQL script file worked properly.

Populate each of your tables with at least five valid rows of data each and show the SQL INSERT statements as you executed them. Populate other tables in your database, as necessary, to satisfy referential integrity. Save your SQL script file and SPOOL file with the correct extensions. You should test and rerun your SQL script file until it runs without any error. Submit your SPOOL file showing that all SQL in your SQL script file worked properly.

Develop an SQL script file to perform the following queries and updates. You should test your SQL script file until it runs without any errors.

Retrieve all of your customers' names, account numbers, and addresses (street and zip code only), sorted by account number.

Retrieve all of the videos rented in the last 30 days and sort in chronological rental date order.

Produce a list of your distributors and all their information sorted in order by company name.

Update a customer name to change their maiden name to a married name. You can choose which row to update. Make sure that you use the primary key column in your WHERE clause to affect only a specific row. You may want to include a ROLLBACK statement to undo your data update.

Delete a customer from the database. You can choose which row to delete. Make sure that you use the primary key column in your WHERE clause to affect only a specific row. You may want to include a ROLLBACK statement to undo your data deletion.

Ensure that you use the commands below in order to create your single SPOOL file and showing that all SQL in your SQL script files worked properly. Show the actual SQL statements executed and the results the SQL produced below the code by making sure that you have a SET ECHO STATEMENT in your SQL script file(s).

You will be submitting a number of files.

A Word/PDF document with our ERD and documentation.

Submit your SPOOL file(s) showing that all SQL in your SQL script file worked properly. Show the actual SQL statements executed and the results the SQL produced below the code.

You should also submit all of your .sql scripts.

pLEASE HELP COMPILE WITHOUT ERROR SPOOL figure8.log -- Customers INSERT INTO Customers (Customer_id, CustomerFirst_name, CustomerLast_name, CustomerStreet_address, CostumerCity, CustomerState, CostumerZip, CustomerPhone_number) VALUES ('100', 'Ben', 'Bill', '201 Ash Street', 'San Silva', 'MD', '20850', '443-123-4567'); INSERT INTO Customers (Customer_id, CustomerFirst_name, CustomerLast_name, CustomerStreet_address, CostumerCity, CustomerState, CostumerZip, CustomerPhone_number) VALUES ('101', 'James', 'Seth', '142 Athens Avenue', 'Silver Boro', 'MD', '20841', '443-230-4444'); INSERT INTO Customers (Customer_id, CustomerFirst_name, CustomerLast_name, CustomerStreet_address, CostumerCity, CustomerState, CostumerZip, CustomerPhone_number) VALUES ('200', 'Victor', 'Jones', '124 Flower Street', 'Rockville','MD', '20857', '301-547-2036'); INSERT INTO Customers (Customer_id, CustomerFirst_name, CustomerLast_name, CustomerStreet_address, CostumerCity, CustomerState, CostumerZip, CustomerPhone_number) VALUES ('300', 'Ashley', 'Maverick', '105 University Boulevard', 'Baltimore', 'MD', '21593', '228-567-8174'); INSERT INTO Customers (Customer_id, CustomerFirst_name, CustomerLast_name, CustomerStreet_address, CostumerCity, CustomerState, CostumerZip, CustomerPhone_number) VALUES ('450', 'Bill','Booker', '208 New Hampshire Avenue', 'Wheaton', 'MD', '20103', '250-413-7020'); -- Order INSERT INTO Order (Order_id, OrderDate) VALUES ('1', TO_DATE('02/05/2007','MM/DD/YYYY')); INSERT INTO Order (Order_id, OrderDate) VALUES ('2', TO_DATE('2/20/2011','MM/DD/YYYY')); INSERT INTO Order (Order_id, OrderDate) VALUES ('3', TO_DATE('02/05/2003','MM/DD/YYYY')); INSERT INTO Order (Order_id, OrderDate) VALUES ('4', TO_DATE('02/05/2005','MM/DD/YYYY')); INSERT INTO Order (Order_id, OrderDate) VALUES ('5', TO_DATE('02/05/2006','MM/DD/YYYY')); -- Product INSERT INTO Product (Product_id, ProductDescription, ProductMovieType, Order_id) VALUES ('1', 'Beauty and the Beast', 'Romance','6'); INSERT INTO Product (Product_id, ProductDescription, ProductMovieType, Order_id) VALUES ('2', 'Mist', 'Thriller','7'); INSERT INTO Product (Product_id, ProductDescription, ProductMovieType, Order_id) VALUES ('3', 'Police Academy', 'Comedy','8'); INSERT INTO Product (Product_id, ProductDescription, ProductMovieType, Order_id) VALUES ('5', 'When Sally met Harry', 'Romance','9'); INSERT INTO Product (Product_id, ProductDescription, ProductMovieType, Order_id) VALUES ('6', 'Rambo', 'Action','10'); -- Distributor INSERT INTO Distributor (DistributorDisc_id, DistributorPrice, DistributorOrderQuantity, Order_id) VALUES ('1', '5','10', '11'); INSERT INTO Distributor (DistributorDisc_id, DistributorPrice, DistributorOrderQuantity, Order_id) VALUES ('2', '5','10', '12'); INSERT INTO Distributor (DistributorDisc_id, DistributorPrice, DistributorOrderQuantity, Order_id) VALUES ('3', '15','10','13'); INSERT INTO Distributor (DistributorDisc_id, DistributorPrice, DistributorOrderQuantity, Order_id) VALUES ('4', '5','10', '14'); INSERT INTO Distributor (DistributorDisc_id, DistributorPrice, DistributorOrderQuantity, Order_id) VALUES ('5', '5','10', '15'); -- Catalog INSERT INTO Catalog (Catalog_id, CatalogRating, CatalogAcademyAwards, CatalogDateRelease, Product_id, Order_id, DistributorDisc_id) VALUES ('1', 'Rated R','2', TO_DATE('02/05/2000','MM/DD/YYYY'),'7','16','6'); INSERT INTO Catalog (Catalog_id, CatalogRating, CatalogAcademyAwards, CatalogDateRelease, Product_id, Order_id, DistributorDisc_id) VALUES ('2', 'Parental Guide', '12', TO_DATE('02/05/2001','MM/DD/YYYY'),'8',,'17','7'); INSERT INTO Catalog (Catalog_id, CatalogRating, CatalogAcademyAwards, CatalogDateRelease, Product_id, Order_id, DistributorDisc_id) VALUES ('3', 'Youth','3',TO_DATE('02/05/2002','MM/DD/YYYY'), '9','18','8'); INSERT INTO Catalog (Catalog_id, CatalogRating, CatalogAcademyAwards, CatalogDateRelease, Product_id, Order_id, DistributorDisc_id) VALUES ('4', 'Everyone','8', TO_DATE('02/05/2003','MM/DD/YYYY'),'10','19','9'); INSERT INTO Catalog (Catalog_id, CatalogRating, CatalogAcademyAwards, CatalogDateRelease, Product_id, Order_id, DistributorDisc_id) VALUES ('5', 'Preschool','9',TO_DATE('02/05/2004','MM/DD/YYYY'),'11','20','10'); -- Rental INSERT INTO Rental (Rental_id, RentalReturnDate, RentalRentedQuantity, RentalTotal_charge, RentalTax, Product_id) VALUES ('1', TO_DATE('04/05/2009','MM/DD/YYYY'), '35','17.99', '0.3','11'); INSERT INTO Rental (Rental_id, RentalReturnDate, RentalRentedQuantity, RentalTotal_charge, RentalTax, Product_id) VALUES ('2', TO_DATE('03/04/2001','MM/DD/YYYY'), '34','17.99', '0.3','12'); INSERT INTO Rental (Rental_id, RentalReturnDate, RentalRentedQuantity, RentalTotal_charge, RentalTax, Product_id) VALUES ('3', TO_DATE('04/03/2002','MM/DD/YYYY'), '33','17.99', '0.3','13'); INSERT INTO Rental (Rental_id, RentalReturnDate, RentalRentedQuantity, RentalTotal_charge, RentalTax, Product_id) VALUES ('4', TO_DATE('04/01/2003','MM/DD/YYYY'), '32','17.99', '0.3','14'); INSERT INTO Rental (Rental_id, RentalReturnDate, RentalRentedQuantity, RentalTotal_charge, RentalTax, Product_id) VALUES ('5', TO_DATE('04/03/2004','MM/DD/YYYY'), '31','17.99', '0.3','15'); SPOOL OFF;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

What is required for effective management of IMC?

Answered: 1 week ago

Question

How would you define IMC?

Answered: 1 week ago

Question

How can the barriers to IMC be overcome?

Answered: 1 week ago