Question

SQL help (all parts are related to each other so please answer them all, thank you!)...

SQL help (all parts are related to each other so please answer them all, thank you!)

https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all

A. Find the EmployeeID who has the highest order amount(e.g. the total dollar amount for an order)in July 1996
B. Find the top three countries where consumers purchased the most(e.g. the total dollar amount for all orders placed for goods originated from a country)in all periods

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a)

we just need to find the sum of order amount of each employee per order and sort the table in descending order and take the first row

Below is the query

SELECT o.EmployeeID FROM OrderDetails od, Orders o,Products p WHERE od.OrderID = o.OrderID AND od.productID = p.ProductID AND o.OrderDate like '1996-07%' GROUP BY o.EmployeeID ORDER BY sum(od.Quantity*p.price) DESC limit 1

b)

Select c.Country from Customers c, Orders o, OrderDetails od, Products p where c.CustomerID = o.CustomerID and od.productID = p.ProductID and o.OrderID = od.OrderId GROUP BY c.Country ORDER BY sum(od.Quantity*p.price) DESC limit 3

Add a comment
Know the answer?
Add Answer to:
SQL help (all parts are related to each other so please answer them all, thank you!)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • SQL help (all parts are related to each other so please answer them all, thank you!)...

    SQL help (all parts are related to each other so please answer them all, thank you!) https://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all A.Find the number of suppliers for each of the product category B.Find the totalprice for each order, sort them based on pricein descending order C.Find the category name and description for each product in Table Products D.Find the EmployeeID who has the highest order amount(e.g. the total dollar amount for an order)in July 1996 E.Find the top three countries whereconsumers purchased the most(e.g....

  • Need help with all parts please. Thank you. 1. Orders. [Purpose: Apply theorems about orders in...

    Need help with all parts please. Thank you. 1. Orders. [Purpose: Apply theorems about orders in Zn and in direct products.] (a) Find the order of ([12]28. [8]60,岡63) in the group Z2eX Z60 × Z63. (The notation kn is to emphasize we are working mod n in that particular coordinate.) (b) Find all elements of order 6 in 24 × Z6 or explain why none exist. (c) Find all elements of order 8 in Z Zg or explain why none...

  • If possible please just send the SQL statement. Thank you Each question within deliverable 3 must begin on a new page and be sure to document the question as the title of each item at the top o...

    If possible please just send the SQL statement. Thank you Each question within deliverable 3 must begin on a new page and be sure to document the question as the title of each item at the top of each page. Also, using a 12-point font, include the SQL statement and then provide a screen shot of each query. The screen shots must include both the SQL statement and the results for each item below based on the data entered in...

  • I need some help with all three parts. Please and thank you. specific tax to a...

    I need some help with all three parts. Please and thank you. specific tax to a good where the demand elasticity, e, is 1.4, and the supply elasticity, Suppose the government applies a n, is 1.6 If a specific tax, T, of $1.75 was placed on the good, to the nearest cent, what is the price increase that consumers would pay? S.93 (round your answer to two decimal places) To the nearest cent, what is the price decrease that producers...

  • Please answer all parts of the question. Thank you. Consider the iron structure in the figure...

    Please answer all parts of the question. Thank you. Consider the iron structure in the figure below. Assume u = 00 in the iron. The struc- ture has uniform cross sectional area of A = 1 cm2 in each leg. All air gaps have equal length of g 1 mm. Neglect fringing at the air gaps. Let each coil carry a current of i The directions of the current are as shown in the figure. Assume each coil has N...

  • please answer all the parts and show the work. THank you so much An active filter...

    please answer all the parts and show the work. THank you so much An active filter circuit is given in the Figure 1 a) Obtain the filter transfer function. What is the order of the filter? b) Sketch the magnitude of the frequency transfer function. What type of filter does it represent? c) Estimate the cutoff frequency and the roll-off slope of the filter. R1 C1 C2 R2 (K-1)R Figure 1. Circuit for Problem 6

  • can someone solve these quick please and thank you! sql chapter 4 Query #1: List the...

    can someone solve these quick please and thank you! sql chapter 4 Query #1: List the company name, contact name, contact title and the phone number for customers who HAVE NOT put in an order. Use an outer join. Query #2: Create a listing displaying the employee first name, last name and the full name (First name space Last Name) of the person they report to (Supervisor). This is a self-join. If an employee does not report to anyone then...

  • Please write queries based on the following requirements using DML In-Class Data Set. For each question,...

    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...

  • please answer all questions In details. Thank you A company requires 30,000 units of a product...

    please answer all questions In details. Thank you A company requires 30,000 units of a product in a single year. It takes $300 for them to place a single order of the product. If the product is carried in inventory, the carrying cost equals 196 of the price of the product on a single unit of the product held in inventory. The product costs $200 per unit and the company works for a total of 300 days in the year....

  • Please help in all parts of the question. Thank you in advance. Find at least 3...

    Please help in all parts of the question. Thank you in advance. Find at least 3 different organisms (yeast cannot be one of the 3) that produce ATP without the use of oxygen. Search the WWW  to find information on this phenomenon and write a paragraph for each (200-250 words in total) in your own words, addressing at least the following points: 1. What is the name of the organism and what general kind of organism is it? 2. What is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT