Please write queries based on the following requirements using DML In-Class Data Set. For each question, you are required to submit 1) SQL query code; 2) a screen shot of your query result.You should copy and paste your SQL query code to the word document instead of taking a screenshot of your code. Missing either part for each question will result in 0 for this question.
1.List unique itemclasses stored in my database.
2.List the warehouse number and the number of different partsstored in each warehouse, only include those warehouse with more than 2 different parts.
3.List the warehouse number and the maximum number of units on hand for parts stored in each of the warehouse. Rename the new column Max_UOH.
4.List the part number, total dollar amount for each part stored, and the warehouse number for the part.Renamethe calculatedcolumn TOTAL_AMOUNT. TOTAL_AMOUNT=Units_ON_HAND*UNIT_PRICE
5.List theclass and totalnumber of units on hand for each class. Rank your resultsin descending order on the total number of units on hand.
6.List stored information for all the orders placed between August 3rdand August 6thof 2013.(not including August 3rd2013 and August 6th2013).
7.List all the order date and the number of orders placed on each date. Rank your results in descending order on the number of orders.
8.List the warehouse number and the average unit price for warehouses other than number 2.
9.List the stored part information for SG parts stored in warehouse 2 or 3.
10.List the part number and part description for each part with letter D(or d) in the part_description. Rank your results in ascending order on itemclass and then descending order on units_on_hand.
11.List the average unit price among all the parts. Rename the column as AVG_UNIT_PRICE
12.List the part number and part description for each part with nine characters or ten characters in the part_description. Rank your results in ascending order on part number.
13.Find the itemclasses and the number of parts under each class. Only show those classes with at least3 types of parts.
14.List the stored part information for SG parts or parts with more than 60 units stored in warehouse 3.
15.List the number of different part stored in each warehouse, only include those warehouse with at most3parts.
1. SELECT DISTINCT(ITEM_CLASS) FROM PART;
2.
SELECT WAREHOUSE_NUMBER,
COUNT(PART_NUMBER) AS "NO. OF PARTS"
FROM PART
GROUP BY WAREHOUSE_NUMBER
HAVING "NO. OF PARTS" > 2;
3.
SELECT WAREHOUSE_NUMBER,
MAX(UNITS_ON_HAND) AS "Max_UOH"
FROM PART
GROUP BY WAREHOUSE_NUMBER;
4.
SELECT PART_NUMBER, (UNITS_ON_HAND *
UNIT_PRICE) AS "TOTAL AMOUNT" ,
WAREHOUSE_NUMBER
FROM PART
GROUP BY PART_NUMBER;
5.
SELECT ITEM_CLASS,
SUM(UNITS_ON_HAND) AS "Total No. Of Units"
FROM PART
GROUP BY ITEM_CLASS
ORDER BY "Total No. Of Units" DESC;
6.
SELECT * FROM ORDERS
WHERE ORDER_DATE > 03-AUG-2013
AND
ORDER_DATE < 06-AUG-2013;
7.
SELECT ORDER_DATE, COUNT (ORDER_NUMBER) AS "NO. OF ORDERS"
FROM ORDERS
GROUP BY ORDER_DATE
ORDER BY "NO. OF ORDERS" DESC;
8.
SELECT WAREHOUSE_NUMBER, AVG(UNIT_PRICE)
FROM PART
WHERE WAREHOUSE_NUMBER NOT IN (2)
GROUP BY WAREHOUSE_NUMBER;
Please write queries based on the following requirements using DML In-Class Data Set. For each question,...
Instructions Try to answer all the questions using what you have learned in class. Please make your query general not data related This schema is used for inventory management for an OEM Part Inventory p_id Name Cost Supplier Location 1 Traction motor 200 Melco Japan 2 Alternator 400 kato USA 3 HVAC 300 Melco Japan p_id Warehouse_id quantity 1 A1 100 2 A2 250 3 B1 300 Customer Model c_id Name Location CN Canada National Canada UP Union Pacific USA...
Please answer each question using these tables above, it is
SQL
Display the descriptions and prices of the 5 most expensive
parts, in descending order by price.
For each part, display the On Hand Value, which is calculated
by multiplying the quantity on hand by price.
Display a summary with part number, description, on hand and
warehouse for all parts in class HW or AP, and in warehouse 1 or
2.
Display the names of customers who do NOT live...
Express the following queries in SQL. Only standard SQL syntax is allowed. Each query should be answered in a single SQL statement: 1. Find the name of suppliers that are located in Mumbai. 2. Find the name of suppliers and the names of parts they sell. List the result in descending order suppliers name. 3. Find the names of parts that are sold by exactly two suppliers. 4. Find the names of parts that are sold by all suppliers. 5....
Answer the following questions using mysql. Please show screenshots to make sure the queries work. 1. Use a sub-query and the IN operator to find the number and name of each customer that placed an order on October 23, 2007. 2. Repeat step 2, but this time use the EXISTS operator in your answer. 3. Using a sub-query, find the number and name of each customer that did not place an order on October 23, 2007. 4. Using a sub-query,...
There are 7 problems that require using joins. Each problem has 10 points. 1. Write an SQL command that will find any customers who have not placed orders and sort them out by CustomerID in ascending order. 2. List the employees and supervisors names for each supervisor who supervises more than two employees. 3. List the name of each employee, his or her birth date, the name of his or her manager, and the manager’s birth date for those employees...
SQL Queries – in this assignment you will be asked to create several SQL queries relating to the Sakila database that we installed in class. You may freely use DBeaver to create these queries, but I will expect your solution to show me the SQL code to answer or complete the tasks below. Write a query that produces the last name, first name, address, district, and phone number for every customer in the customer table. (You don’t need to include...
The Ch07_ConstructCo database stores data for a consulting company that tracks all charges to projects. The charges are based on the hours each employee works on each project. The structure and contents of the Ch07_ConstructCo database are shown in Figure P7.1.Note that the ASSIGNMENT table in Figure P7.1 stores the JOB_CHG_HOUR values as an attribute (ASSIGN_CHG_HR) to maintain historical accuracy of the data. The JOB_CHG_HOUR values are likely to change over time. In fact, a JOB_CHG_ HOUR change will be...
Using the following tables write a sql command:
List the full name and the total number of transactions handled
by the full time
employee. Rank your results in descending order on the total
number of transactions.
Table: MEMBERS Column Data Type Length Precision Scale Nullable MEMBERID NUMBER 4 0 No MFIRST VARCHAR2 25 No MLAST VARCHAR2 25 No STREET VARCHAR2 64 No CITY VARCHAR2 25 . No STATE VARCHAR2 2 . No ZIPCODE NUMBER 0 No CREDITLIMIT NUMBER 7 2...
Sample data is provided for the database for the sales system. Using the sample data, you will determine the entities, key components of the entities, and business rules for the entities. Using the entities and business rules you will then create an ERD. Tasks: 1. For each entity provide the name, description, fields, data type, primary key, and foreign key. 2. For each direct entity type pair, provide the business rules. 3. Provide the ERD. Customer Table Customer ID, Last...
CUSTTYPE (TID, TypeDesc) CUSTOMER (CID, Lname, Fname, TID, Address, ZIPcode) CUSTORDER (OrderNo, OrderDate, PromiseDate, ShippedDate, ShippingTerm, SalesID, CID) SALESREP (SalesID, Name, Phone, Address, ZIPcode, RepType) ORDERLINE (OrderNo, PID, Qty, Qty_RETD) FTSALESREP (SalesID, MonthPay, Rank) PTSALESREP (SalesID, HourlyRate, WeekHours) ZIP_TABLE (ZIPcode, City, State) VENDOR (VID, Name, Phone ZIPcode) PRODUCT (PID, CateID, ProdName, ProdFinish, Price, Qty_on_Hand, Description, VID) CATEGORY (CateID, CateType) Local View #1: Use three base tables to develop a SQL statement that will list the following information for a customer,...