Question: : ( 1) A script file named P3_FirstLastName.sql. This script file must be uploaded to the D2L assignment folder of the group leader before its
: (1) A script file named P3_FirstLastName.sql. This script file must be uploaded to the D2L assignment folder of the group leader before its due (one submission per group). It must contain all the code you wrote for this project. It must run without error messages in its entirety (10% off if unexpected compilation or run time error occurs).
- Write a query to show total number of orders for each customer. Show full names and sort the records by Last name in ascending order.
- Write a query to show best-selling products (IDs, product name, and Sold quantity). Show top five best-selling products. Sort by sold quantity in descending order.
- Write a query to calculate the number of customers who made their payments by cash.
- Write a query to find the most popular shipment method.
-- Use an anonymous PL/SQL script to -- drop all tables and sequences in the current schema and -- suppress any error messages that may displayed -- if these objects don't exist BEGIN EXECUTE IMMEDIATE 'DROP TABLE Order_Lines'; EXECUTE IMMEDIATE 'DROP TABLE Products'; EXECUTE IMMEDIATE 'DROP TABLE Orders'; EXECUTE IMMEDIATE 'DROP TABLE Payment_method'; EXECUTE IMMEDIATE 'DROP TABLE Shipment_method'; EXECUTE IMMEDIATE 'DROP TABLE CATEGORIES'; EXECUTE IMMEDIATE 'DROP TABLE Customers'; EXECUTE IMMEDIATE 'DROP TABLE Employees'; EXECUTE IMMEDIATE 'DROP TABLE Jobs'; EXECUTE IMMEDIATE 'DROP TABLE Departments'; EXECUTE IMMEDIATE 'DROP TABLE Product_Inventory'; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(''); END; /
CREATE TABLE DEPARTMENTS ( DEPARTMENT_ID NUMBER(2) NOT NULL, DEPARTMENT_NAME VARCHAR2(20) NULL, CITY VARCHAR2(30) NULL, STATE CHAR(2) NULL );
ALTER TABLE DEPARTMENTS ADD CONSTRAINT Departments_PK PRIMARY KEY (DEPARTMENT_ID);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
