Which query in this relational database (represented by relational diagram) will provide you with the list of 3 customers from Germany who bought most iPhones 11 phones? Select one: a. SELECT TOP(3)...



Which query in this relational database (represented by relational diagram) will provide you with the list of 3 customers from Germany who bought mostiPhones 11 phones?





Select one:


a.

SELECT TOP(3) c.CustomerID, c.CompanyName, Count(od.Quantity)

FROM Products p

LEFT JOIN [Order Details] od ON p.ProductID = od.ProductID

LEFT JOIN Orders o ON od.OrderID = o.OrderID

LEFT JOIN Customers c ON o.CustomerID = c.CustomerID

WHERE c.Country = 'Germany' AND p.ProductName = 'iPhone 11'

GROUP BY c.CustomerID, c.CompanyName

ORDER BY Count(od.Quantity) DESC

b.

SELECT TOP(3) c.CompanyName, SUM(od.Quantity)

FROM Products p

INNER JOIN [Order Details] od ON p.ProductID = od.ProductID

INNER JOIN Orders o ON od.OrderID = o.OrderID

INNER JOIN Customers c ON o.CustomerID = c.CustomerID

WHERE c.Country = 'Germany' AND p.ProductName = 'iPhone 11'

GROUP BY c.CustomerID, c.CompanyName

ORDER BY SUM(od.Quantity) DESC

c.

SELECT TOP(3) c.CompanyName, p.ProductID, Sum(od.Quantity)

FROM Products p

LEFT JOIN [Order Details] od ON p.ProductID = od.ProductID

LEFT JOIN Orders o ON od.OrderID = o.OrderID

LEFT JOIN Customers c ON o.CustomerID = c.CustomerID

WHERE c.Country = 'Germany' AND p.ProductName = 'iPhone 11'

GROUP BY p.ProductID, p.ProductName

ORDER BY Sum(od.Quantity) DESC


d.

SELECT TOP(3) c.CustomerID, c.CompanyName, Count(p.ProductID)

FROM Products p

RIGHT JOIN [Order Details] od ON p.ProductID = od.ProductID

RIGHT JOIN Orders o ON od.OrderID = o.OrderID

RIGHT JOIN Customers c ON o.CustomerID = c.CustomerID

WHERE p.ProductName = 'iPhone 11' AND c.Country = 'Germany'

GROUP BY c.CustomerID, c.CompanyName, p.ProductID

ORDER BY Count(p.ProductID) DESC




Employees<br>* EmployeelD<br>EmployeeTerritories<br>* EmployeelD<br>CustomerDemographics<br>* CustomerTypelD<br>LastName<br>* TerritoryID<br>CustomerDesc<br>FirstName<br>Title<br>TitleOfCourtesy<br>Territories<br>BirthDate<br>CustomerCustomerDemo<br>* TerritorylD<br>HireDate<br>* CustomerlD<br>TerritoryDescription<br>* CustomerTypelD<br>Address<br>RegionID<br>City<br>Region<br>PostalCode<br>Region<br>* RegionID<br>Country<br>Customers<br>HomePhone<br>* CustomerlD<br>Extension<br>RegionDescription<br>CompanyName<br>Photo<br>ContactName<br>Notes<br>ContactTitle<br>ReportsTo<br>Address<br>PhotoPath<br>City<br>Region<br>PostalCode<br>Country<br>Phone<br>Order Details<br>Fax<br>* OrderlD<br>Products<br>* ProductID<br>* ProductiD<br>UnitPrice<br>ProductName<br>Quantity<br>SupplierlD<br>Discount<br>CategoryID<br>QuantityPerUnit<br>Orders<br>UnitPrice<br>* OrderlD<br>UnitsinStock<br>CustomerlD<br>UnitsOnOrder<br>EmployeelD<br>Categories<br>* CategorylD<br>Reorderlevel<br>OrderDate<br>Discontinued<br>Required Date<br>CategoryName<br>Shipped Date<br>Description<br>ShipVia<br>Picture<br>Freight<br>ShipName<br>Suppliers<br>ShipAddress<br>-O Y SupplierlD<br>ShipCity<br>CompanyName<br>ShipRegion<br>ContactName<br>ShipPostalCode<br>ContactTitle<br>Shippers<br>* ShipperID<br>ShipCountry<br>Address<br>City<br>CompanyName<br>Region<br>Phone<br>PostalCode<br>Country<br>Phone<br>Fax<br>HomePage<br>

Extracted text: Employees * EmployeelD EmployeeTerritories * EmployeelD CustomerDemographics * CustomerTypelD LastName * TerritoryID CustomerDesc FirstName Title TitleOfCourtesy Territories BirthDate CustomerCustomerDemo * TerritorylD HireDate * CustomerlD TerritoryDescription * CustomerTypelD Address RegionID City Region PostalCode Region * RegionID Country Customers HomePhone * CustomerlD Extension RegionDescription CompanyName Photo ContactName Notes ContactTitle ReportsTo Address PhotoPath City Region PostalCode Country Phone Order Details Fax * OrderlD Products * ProductID * ProductiD UnitPrice ProductName Quantity SupplierlD Discount CategoryID QuantityPerUnit Orders UnitPrice * OrderlD UnitsinStock CustomerlD UnitsOnOrder EmployeelD Categories * CategorylD Reorderlevel OrderDate Discontinued Required Date CategoryName Shipped Date Description ShipVia Picture Freight ShipName Suppliers ShipAddress -O Y SupplierlD ShipCity CompanyName ShipRegion ContactName ShipPostalCode ContactTitle Shippers * ShipperID ShipCountry Address City CompanyName Region Phone PostalCode Country Phone Fax HomePage
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here