A) Write a query to show the list of number of orders for customers located in e
ID: 3839855 • Letter: A
Question
A) Write a query to show the list of number of orders for customers located in each country. Your query results should show Country name, and number of orders from the customers of that country. Partial credit (25% of the credit) will be given if you correctly identify the tables to be joined.
B) Write a query to list the orders shipped by “Speedy Express”. Your query should show the Order Date and Order ID. The results should appear in the sort order of Order Date.
C) Which of the three shippers “Speedy Express”, “United Package”, or “Federal Shipping” shipped the most number of orders? Please explain how you arrived at your response?
Is it correct these solutions below?
A)
SELECT Country,
count(Country) as NumberOfOrdersfromtheCustomers
FROM Customers
GROUP BY Country
B) I need help for the solution here
C)
SELECT
ShipperID,
ShipperName,
count(ShipperID) as Orders
FROM
(SELECT
o.ShipperID,
s.ShipperName
FROM Orders as o
JOIN Shippers as s
ON o.ShipperID = s.ShipperID)
GROUP BY ShipperID;
Explanation / Answer
A: Correct
B:
select date, orderid from Orders where shipperid in (select shipperid from shippers where shippername = "Speedy Express")
C:
select shippername from shipper where shipperid in (
select shipperid from orders group by shipperid having count(shipperid) = (
select max(count(shipperid) from orders group by shipperid
)
)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.