Chapter 5 Assignment - *ex5-1 SELECT COUNT SUM(TaxAmount...

This preview shows page 1 out of 1 page.

/*ex5-1*/ SELECT COUNT (*), SUM (TaxAmount) FROM Orders /*ex5-2*//* Could not figure this on out*/ /*ex5-3*/ /* Could not figure this on out*/ SELECT EmailAddress, SUM (ItemPrice*Quantity) FROM OrderItems /*ex5-4*/ /* Not sure why this wouldn't execute I thought it was correct.*/ SELECT EmailAddress, COUNT(o1.orderID) AS OrderCount, SUM ((ItemPrice-DiscountAmount)*Quantity) AS TotalAmount FROM Customers AS c1 JOIN Orders AS o1 ON c1.CustomerID=o1.CustomerID JOIN OrderItems AS o2 ON o2.orderID=o1.orderID GROUP BY EmailAddress
Image of page 1

Unformatted text preview: HAVING COUNT (o1.OrderID) > 1 ORDER BY OrderCount DESC /*ex5-5*//* Could not figure this on out*/ /*ex5-6*//*The ROLLUP has me a little confused. Worked problem to that point.*/ SELECT p1.ProductName, SUM ((p1.ListPrice-p1.DiscountAmount)*Quantity) AS TotalAmount FROM Products AS p1 JOIN OrderItems AS oi ON p1.ProductID=oi.ProductID GROUP BY GROUPING SETS ((ROLLUP /*ex5-7*//* Could not figure this on out*/ SELECT EmailAddress, COUNT([ALL DISTINCT]) Products FROM Customers...
View Full Document

  • Fall '14

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern