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: The CUSTOMERS table stores data about each customer, such as thecompany name, credit limit and the salesperson who calls on thecustomer The SALESREP table stores the employee number, name, age, yeartodate sales and other data about each salesperson 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 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 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. Show the name, sales, and quota of Bill Adams Show the total value of the inventory on hand for each product. Arrangein descending order by total value List the offices with a target over $ What is the average of all the sales people? What is the total order size for each salesperson whose orders total morethan $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 ORDERSORDERNUM varchar constraint pkorders primary key,ORDERDATA date,CUST charREP charMFR charPRODUCT varcharQTY int,AMOUNT money;create table PRODUCTSMFRID charPRODUCTID varcharDESCRIPTION varcharPRICE money,QTYONHAND int,constraint pkproducts primary keyMFRID PRODUCTID;create table CUSTOMERSCUSTNUM char constraint pkcustomers primary key,COMPANY varcharCUSTREP charCREDITLIMIT money;create table OFFICESOFFICE char constraint pkoffices primary key,CITY varcharREGION varcharMGR charTARGET money,SALES money ;create table SalesRepsempnum char constraint pksalesRep primary key,name varcharage int,repoffice chartitle varcharmanager charhiredate date,quota money,sales money ;INSERT INTO CUSTOMERS VALUES 'Jones Mfg$;INSERT INTO CUSTOMERS VALUES 'First Corp.$;INSERT INTO CUSTOMERS VALUES 'Acme Mfg$;INSERT INTO CUSTOMERS VALUES 'AAA Investments',$;INSERT INTO CUSTOMERS VALUES 'Fred Lewis Corp.$;INSERT INTO CUSTOMERS VALUES 'Ace International', $;INSERT INTO CUSTOMERS VALUES 'Holm & Landis', $;INSERT INTO CUSTOMERS VALUES 'Chen Associates', $;INSERT INTO CUSTOMERS VALUESJCP Inc.$;INSERT INTO CUSTOMERS VALUES 'Zetacorp', $;INSERT INTO CUSTOMERS VALUES 'Ian & Schmidt', $;INSERT INTO CUSTOMERS VALUES 'Orion Corp.$;INSERT INTO CUSTOMERS VALUES 'Smithson Corp.$;INSERT INTO CUSTOMERS VALUESJP Sinclair', $;INSERT INTO CUSTOMERS VALUES 'Miswest Sytems', $;INSERT INTO CUSTOMERS VALUES 'Solomon Inc.$;INSERT INTO CUSTOMERS VALUES 'Rico Enterprises', $;INSERT INTO CUSTOMERS VALUES 'QMA Assoc.$;INSERT INTO CUSTOMERS VALUES 'ThreeWay Lines', $;INSERT INTO CUSTOMERS VALUES 'Carter & sons', $;INSERT INTO CUSTOMERS VALUES 'Peter Brothers', $;INSERT INTO OFFICES VALUES 'NewYork','Eastern',$$;INSERT INTO OFFICES VALUES'Chicago','Eastern',$$;INSERT INTO OFFICES VALUES'Atlanta','Eastern',$$;INSERT INTO OFFICES VALUES 'LosAngeles','Western',$$;INSERT INTO OFFICES VALUES'Denver','Western',$$;INSERT INTO ORDERS VALUES Dec'REI',AL$;INSERT INTO ORDERS VALUES Dec'ACI',$;INSERT INTO ORDERS VALUES Oct'ACI',$;INSERT INTO ORDERS VALUES Oct'REI',AG$;INSERT INTO ORDERS VALUES Oct'ACI',Z$;INSERT INTO ORDERS VALUES Dec'ACI',$;INSERT INTO ORDERS VALUES Dec'ACI',Y$;INSERT INTO ORDERS VALUES Jan'FEA',$;INSERT INTO ORDERS VALUES Nov'ACI',$;INSERT INTO ORDERS VALUES Jan'REI',AC$;INSERT INTO ORDERS VALUES Jan'BIC',$;INSERT INTO ORDERS VALUES Jan'IMM',C$;INSERT INTO ORDERS VALUES Jan'IMM',C$
