Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

: ( 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).

  1. 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.
  2. 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.
  3. Write a query to calculate the number of customers who made their payments by cash.
  4. 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

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

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago