1) Write a query to show the list of number of orders for customers located in e
ID: 3840058 • Letter: 1
Question
1) 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.
2) 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.
3) 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
Customers Customer CustomerName ContactName Address City PostalCode Country Shippers Shipper D Shipper Name Phone Orders Order Id Customer Id Employeeld OrderDate ShipperID Order Details OrderDetailID OrderID ProductID Quantity Suppliers Supplier ID Suppl ContactName Address City PostalCode Country Phone Products ProductID ProductName SupplierID So Category Id Unit Price Categories I Category D Catego Name De scgu rhomExplanation / Answer
1. select Country, count(OrderId) from Customers,Orders where Customers.CustomerId=Orders. CustomerId group by Country;
2. select OrderDate,OrderId from Orders,Shippers where Orders.ShipperId=Shippers.ShipperId and Shippers.ShipperName='Speedy Express' order by OrderDate;
3. select ShipperId,ShipperName,count(OrderId) from Shippers,Orders where Shippers.ShipperId=Orders.ShipperId group by ShipperId having max(count(OrderId));
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.