Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have an Oracle Problem. Well. I have done 80%, but I am unsure about the two last questions. Can you please revise my work

I have an Oracle Problem. Well. I have done 80%, but I am unsure about the two last questions. Can you please revise my work and helo me finish it?

Thank you

Here is the task:

******************************************************************************************************************************

1. List all columns and rows in the stock table.

2. List the last name, first name, and company of all customers (List the columns in that

order). Place the list in alphabetical order by company name.

3. List the company names for all customers from Sunnyvale, Redwood City, or San Francisco.

4. List all orders that were placed between the dates12/31/1999 and 01/03/2000. List

order number, order date, customer number, ship date, and paid date. (Hint: Specify

year in single quotes ?DD-MMM-YYYY)

5. List the order number, order date, and shipping charges for all orders that are not on

backlog and for which the shipping charge is over $15.00.

6. List all stock items which are baseball items which have a unit price greater than

$200.00 and a manufacturer code which starts with ?H. (Hint: use LIKE)

7. List the company name for all customers who have orders. Don not list a companymore than once.

8. List the customer number and the description (from the stock table) of all items

ordered by customers with customer numbers 104108. Order the output by

customer number and description. (There should be no duplicate rows in your output).

9. List the number of (distinct) customers having an order. Label the column ? Total_Customers_with_Orders?.

10. For each customer having an order, list the customer number, the

number of orders that customer has, the total quantity of items on those orders, and the total price for

the items. Order the output by customer number. (Hint: You must use a GROUP BY

clause in this query)

******************************************************************************************************************************

Here is my answer:

******************************************************************************************************************************

SELECT * FROM stock;

SELECT lname, fname, company FROM CUSTOMER Order BY company;

SELECT company from CUSTOMER where city IN ('Sunnyvale', 'Redwood City', 'San Francisco');

SELECT order_num, order_date, customer_num, ship_date, paid_date from ORDERS where order_date Between '31-DEC-1999' AND '03-JAN-2000';

SELECT order_num, order_date, ship_charge from ORDERS where BACKLOG = 'n' AND ship_charge > '15';

SELECT * FROM STOCK where description LIKE '%baseball%' AND unit_price>'200' AND manu_code LIKE 'H%';

SELECT DISTINCT customer_num, company FROM CUSTOMER NATURAL JOIN ORDERS;

SELECT DISTINCT customer_num, description from ORDERS NATURAL JOIN STOCK where customer_num BETWEEN '104' AND '108' ORDER BY customer_num, description;

SELECT distinct customer_num "Total_Customers_with_Orders" from ORDERS;

SELECT DISTINCT customer_num, company FROM CUSTOMER NATURAL JOIN ORDERS;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

3. Evaluate your listeners and tailor your speech to them

Answered: 1 week ago