Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

ITS 4300 – SQL Assignment

Read the brief case below. Using Oracle Live SQL, complete the questions.

Downtown Office Supply


Downtown Office supply is a small family owned store. In order to maintain and grow the
business the owners want to do some analysis to see how their sales are doing.
Management wants to see how the company did last year and make some decisions about
what products to keep along with staffing for busy times of the year.

Instructions:
1. Visit Oracle Live SQL - https://livesql.oracle.com
2. Create an account and login. The account should be created using your UTD email
address.
3. Click on “My Scripts” on the left menu.
4. Upload the “OfficeSupply.sql” script by clicking the upload Script button in the
upper right corner.

5. Fill in the required fields and upload the script.


6. Once the script is uploaded click Run Script in the upper righ corner.

7. Click on the “Run” on the top right corner

You will see this.

Click the X in the right corener.


8. To verify if your script ran fine – Click on “Schema” from the menu on the left.
You ll find the tables listed as described below. Take a Screen shot and paste it
into the document.
Refer to the below ERD:

Respond to the questions below. Paste the query and a screenshot of the result for each of
the questions. Take the Screenshot in a way that the Username is captured. For example:

Your Username should be visible


1. List all the different product categories and subcategories in alphabetical order, list
only the product category and product subcategory. Sort by the product subcategory.

2. How many orders had a “critical” order priority?


3. Display the order date and the ship date for all orders that were made April 1
through April 15. List the order date, ship date, order priority, and ship mode.
Order the results by order_date. Do you notice anything unusual about the data?
You will need to limit the result set by the date field order_date <=
to_date('04/15/2018', 'mm/dd/yyyy'). You could use the “between” function if you
prefer.
4. How much sales and profit was made from the sales for items with Prod_8 ID?
5. List the sales, order_quantity, and profit for all products in the “TECHNOLOGY”
category. Display the product sub category name, the sales, order quantity, and profit.
Order by the product sub category name.

6. Display the smallest and largest profit amounts.


7. What are the unique values for the field “order_priority”?

8. How many product categories have resulted in sales greater than $1000?
9. How many orders do not have a shipping date?

10. Display everything in the Market table.


Sort the result by descending profit amounts and display only the first 5 rows.
Queries

1. Select PROD_CATEGORY, PROD_SUB_CATEGORY


From PRODUCT
Order by PROD_CATEGORY, PROD_SUB_CATEGORY;

2. Select count (*) from ORDERS where ORDER_PRIORITY = 'CRITICAL';

3. Select ORDER_DATE, SHIP_DATE, ORDER_PRIORITY, SHIP_MODE


From SHIPPING, ORDERS
where ORDERS.ORDER_ID = SHIPPING.ORDER_ID and order_date between
to_date('04/01/2018', 'mm/dd/yyyy') and to_date('04/15/2018', 'mm/dd/yyyy')
order by ORDER_DATE;

4. Select sum(Sales), sum(Profit) from Market where Prod_ID = 'Prod_8';

5. Select PROD_SUB_CATEGORY, Sales, Order_Quantity, Profit


from Market, Product
Where Market.PROD_ID = PRODUCT.PROD_ID and PROD_CATEGORY = 'TECHNOLOGY'
Order by PROD_SUB_CATEGORY;

6. Select min(Profit), max(Profit) from Market;

7. Select distinct (ORDER_PRIORITY) from ORDERS;

8. Select count (PROD_CATEGORY)


from Market, Product
where Market.PROD_ID = PRODUCT.PROD_ID and SALES > 1000;

9. Select count (*) from SHIPPING where SHIP_DATE is null;

10. Select * from MARKET


order by PROFIT desc
fetch first 5 rows only;

You might also like