Question
Please write queries based on the following requirements using DML In-Class Data Set. 1. List the total number of parts ordered on each day. Rank
Please write queries based on the following requirements using DML In-Class Data Set.
1. List the total number of parts ordered on each day. Rank your results in ascending order on order date. 2. List the full name and mailing address of customers who placed an order on 04-AUG-2013. If same customer has placed more than one order on this day, only show his/her information once. 3. List the order date, order number, total quoted price for each order placed between 03-AUG- 2013 and 06-AUG-2013. 4. List the average commission rate (rename to AVG_RATE) and the highest total commission (rename to MAX_COMMISSION) of sales representatives who sold SG class items. 5. List the warehouse number and the total number of orders from each warehouse. 6. List the full name of the sales representatives, order number, and total quoted price for each order (rename to TQP) handled by each sales representative. 7. List the part number and part description of parts with units on hand higher than the average units on hand across all parts. 8. List the full name and credit limit of customer who bought a Gas Grill. 9. List the warehouse number and total dollar amount of all items sold from that warehouse. Rename the calculated column TOTAL_VALUE. TOTAL_VALUE=SUM(NUMBER_ORDERED*QUOTED_PRICE). 10. List the part description of the part with the most units on hand. 11. List the part description of the part that was sold the most (in terms of total number ordered). 12. List the full name and number of different parts for each order each customer has placed. Rename the calculated column as TOTAL_PARTS. 13. List the order date of an order containing a part description with letter D (or d) in it. 14. List the customer name of those who purchased products with a unit price of more than $150. 15. List sales representative number and the number of customers handled by each sales representative who got paid at most as the average total commission. Rename the number of transactions as NO_Customers.
create table sales_rep (slsrep_number number(5) constraint pk_sales_rep primary key,srlast varchar2(8),srfirst varchar2(7),street varchar2(13),city varchar2(7),state varchar2(2),zip_code number(5),total_commission number(7,2),commission_rate number(3,2));
create table customer(c_number number(3) not null,clast varchar2(8),cfirst varchar2(7),street varchar2(13),city varchar2(7),state varchar2(2),zip_code number(5),balance number(7,2),credit_limit number(4),slsrep_number number(3),constraint customer_pk primary key (c_number),constraint fk1_customer foreign key (slsrep_number) references sales_rep(slsrep_number)); create table part (part_number varchar2(5) constraint pk_part primary key,part_description varchar2(12),units_on_hand number,item_class char(2),warehouse_number number,unit_price number(7,2));
create table orders (order_number number(5) constraint pk_orders primary key,order_date date,c_number number(3) constraint fk1_orders references customer(c_number));
create table order_line (order_number number(5),part_number varchar2(5),number_ordered number,quoted_price number(6,2),constraint pk_order_line primary key (order_number, part_number),constraint fk1_order_line foreign key (order_number) references orders(order_number),constraint fk2_order_line foreign key (part_number) references part(part_number));
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started