Link to home
Start Free TrialLog in
Avatar of Majed Alanazi
Majed Alanazi

asked on

Microsoft sql Queries using Ms SQL Management studio and the adventureWorks2017

I'm looking for some help doing this assignment. Its due tomorrow Sunday 10/6/2019

 Please look at the attached file A07, for assignment instructions

HERE IS AN EXAMPLE of how the query going to look like


: 1.
 a) Least profitable
SELECT  prod.ProductID,
            prod.ProductNumber,
            prod.Name as ProductName,
            SUM(sod.OrderQty) AS QuantitySold,
            SUM(prod.StandardCost) AS TotalCost,
            SUM(sod.LineTotal) AS TotalRevenue,
            SUM(ListPrice-StandardCost) AS TotalProfit

FROM Production.Product prod
JOIN Sales.SalesOrderDetail sod
      ON prod.ProductID = sod.ProductID

GROUP BY prod.ProductID,
             prod.ProductNumber,
             prod.Name

ORDER BY TotalProfit

 




1. b) Most Profitable
SELECT  prod.ProductID,
            prod.ProductNumber,
            prod.Name as ProductName,
            SUM(sod.OrderQty) AS QuantitySold,
            SUM(prod.StandardCost) AS TotalCost,
            SUM(sod.LineTotal) AS TotalRevenue,
            SUM(ListPrice-StandardCost) AS TotalProfit

FROM Production.Product prod
JOIN Sales.SalesOrderDetail sod
      ON prod.ProductID = sod.ProductID

GROUP BY prod.ProductID,
             prod.ProductNumber,
             prod.Name

ORDER BY TotalProfit DESC
A07.docx
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Hmm... I would rather ask how much experts could charge for this spec implementation delivery...

EE is not intended to do the work instead of you. Experts here are volunteers and they all spent years of learning to help beginners with particular problems.

So please present your current output and ask questions if some query does not work as expected. We can help then.
use the example query to alter the query example to extract data that meets the request.

Ssms has a query designer interface ..
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.