Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help with 2 question SQL(summary query) Questions Administrators AdminlD Em

ID: 3750052 • Letter: N

Question

Need help with 2 question SQL(summary query)

Questions

Administrators AdminlD EmailAddress Password FirstName LastName Orderltems ItemID OrderID ProductiD temPrice DiscountAmount Products ProductiD CategoryID ProductName Description ListPrice DiscountPercent DateAdded Orders Addresses OrderlD CustomerlD OrderDate ShipAmount TaxAmount ShipDate ShipAddressID AddresSID CustomeriD Line1 Line2 Customers CustomerID EmailAddress Password FirstName State ZipCode ShippingAddressID BillingAddressID Categories CategoryID CategoryName CardNumber CardExpires BillingAddressID

Explanation / Answer

If you have any doubts, please give me comment...

SELECT ProductName, SUM(ItemPrice*Quantity) AS total_amount

FROM Products P, OrderItems O

WHERE P.ProductID = O.ProductID

GROUP BY ProductID, ProductName;

SELECT EmailAddress, COUNT(DISTINCT(ProductID))

FROM Customers C, Orders O, OrderItems OI

WHERE C.CustomerID = O.CustomerID AND O.OrderID = OI.OrderID

GROUP BY C.CustomerID, EmailAddress;