Question: Data base lab:Midterm Assignment:The database for this assignment contains data that supports a simple orderprocessing application for a small distribution company. It consists of fivetables:

Data base lab:Midterm Assignment:The database for this assignment contains data that supports a simple orderprocessing application for a small distribution company. It consists of fivetables:1. The CUSTOMERS table stores data about each customer, such as thecompany name, credit limit, and the salesperson who calls on thecustomer.2. The SALESREP table stores the employee number, name, age, year-to-date sales and other data about each salesperson.3. The OFFICES table stores data about each of the five sales officesincluding the city where the office is located, the sales region to which itbelongs, an so on.4. The ORDERS table keeps track of every order placed by a customer,identifying the salesperson who took the order (not necessarily thesalesperson who calls on the customer), the product ordered, the quantityand amount of the order, and so on. For simplicity, each order is for onlyone product.5. The PRODUCTS table stores data about each product available for sale,such as the manufacturer, product number, description, and price.Queries:(Unless otherwise instructed, you should assume the query is asking for names,not id numbers of customers, people, product or city offices; rename attributesif the meaning of the resultant table is not clear.)1. Show the name, sales, and quota of Bill Adams2. Show the total value of the inventory on hand for each product. Arrangein descending order by total value3. List the offices with a target over $600,000.4. What is the average of all the sales people?5. What is the total order size for each salesperson whose orders total morethan $30,000?1-Use the following code to create the data base :drop table orders;drop table products;drop table customers;drop table offices;drop table salesreps;create table ORDERS(ORDER_NUM varchar(6) constraint pk_orders primary key,ORDER_DATA date,CUST char(4),REP char(3),MFR char(3),PRODUCT varchar(10),QTY int,AMOUNT money);create table PRODUCTS(MFR_ID char(3),PRODUCT_ID varchar(10),DESCRIPTION varchar(20),PRICE money,QTY_ON_HAND int,constraint pk_products primary key(MFR_ID, PRODUCT_ID));create table CUSTOMERS(CUST_NUM char(4) constraint pk_customers primary key,COMPANY varchar(20),CUST_REP char(3),CREDIT_LIMIT money);create table OFFICES(OFFICE char(2) constraint pk_offices primary key,CITY varchar(20),REGION varchar(10),MGR char(3),TARGET money,SALES money );create table SalesReps(emp_num char(3) constraint pk_salesRep primary key,name varchar(20),age int,rep_office char(2),title varchar(10),manager char(3),hire_date date,quota money,sales money );INSERT INTO CUSTOMERS VALUES('2101', 'Jones Mfg.','106','$65000');INSERT INTO CUSTOMERS VALUES('2102', 'First Corp.','101','$65000');INSERT INTO CUSTOMERS VALUES('2103', 'Acme Mfg.','105','$50000');INSERT INTO CUSTOMERS VALUES('2105', 'AAA Investments','101','$45000');INSERT INTO CUSTOMERS VALUES('2106', 'Fred Lewis Corp.','102','$65000');INSERT INTO CUSTOMERS VALUES('2107', 'Ace International', '110','$35000');INSERT INTO CUSTOMERS VALUES('2108', 'Holm & Landis', '109','$55000');INSERT INTO CUSTOMERS VALUES('2109', 'Chen Associates', '103','$25000');INSERT INTO CUSTOMERS VALUES('2111','JCP Inc.','103','$50000');INSERT INTO CUSTOMERS VALUES('2112', 'Zetacorp', '108','$50000');INSERT INTO CUSTOMERS VALUES('2113', 'Ian & Schmidt', '104','$20000');INSERT INTO CUSTOMERS VALUES('2114', 'Orion Corp.','102','$20000');INSERT INTO CUSTOMERS VALUES('2115', 'Smithson Corp.','101','$20000');INSERT INTO CUSTOMERS VALUES('2117','J.P. Sinclair', '106','$35000');INSERT INTO CUSTOMERS VALUES('2118', 'Miswest Sytems', '108','$60000');INSERT INTO CUSTOMERS VALUES('2119', 'Solomon Inc.','109','$25000');INSERT INTO CUSTOMERS VALUES('2120', 'Rico Enterprises', '102','$50000');INSERT INTO CUSTOMERS VALUES('2121', 'QMA Assoc.','103','$54000');INSERT INTO CUSTOMERS VALUES('2122', 'Three-Way Lines', '105','$30000');INSERT INTO CUSTOMERS VALUES('2123', 'Carter & sons', '102','$40000');INSERT INTO CUSTOMERS VALUES('2124', 'Peter Brothers', '107','$40000');INSERT INTO OFFICES VALUES ('11','NewYork','Eastern','106','$575000','$692637');INSERT INTO OFFICES VALUES('12','Chicago','Eastern','104','$800000','$735042');INSERT INTO OFFICES VALUES('13','Atlanta','Eastern','105','$350000','$367911');INSERT INTO OFFICES VALUES ('21','LosAngeles','Western','108','$725000','$835915');INSERT INTO OFFICES VALUES('22','Denver','Western','108','$300000','$186042');INSERT INTO ORDERS VALUES ('112961','17-Dec-99','2117','106','REI','2A44L',7,'$31500');INSERT INTO ORDERS VALUES ('112963','17-Dec-99','2103','105','ACI','41004',28,'$3276');INSERT INTO ORDERS VALUES ('112968','12-Oct-99','2102','101','ACI','41004',34,'$3978');INSERT INTO ORDERS VALUES ('112975','12-Oct-99','2111','103','REI','2A44G',6,'$2100');INSERT INTO ORDERS VALUES ('112979','12-Oct-99','2114','102','ACI','4100Z',6,'$15000');INSERT INTO ORDERS VALUES ('112983','27-Dec-99','2103','105','ACI','41004',6,'$702');INSERT INTO ORDERS VALUES ('112987','31-Dec-99','2103','105','ACI','4100Y',11,'$27500');INSERT INTO ORDERS VALUES ('112989','03-Jan-00','2101','106','FEA','114',6,'$1458');INSERT INTO ORDERS VALUES ('112992','04-Nov-99','2118','108','ACI','41002',10,'$760');INSERT INTO ORDERS VALUES ('112993','04-Jan-99','2106','102','REI','2A45C',24,'$1896');INSERT INTO ORDERS VALUES ('112997','08-Jan-00','2124','107','BIC','41003',1,'$652');INSERT INTO ORDERS VALUES ('113003','25-Jan-00','2108','109','IMM','779C',3,'$5625');INSERT INTO ORDERS VALUES ('113007','08-Jan-00','2112','108','IMM','773C',3,'$292

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!