Need help with SQL coding 1., Make a SQL code that will retrieve the average pri
ID: 3768362 • Letter: N
Question
Need help with SQL coding
1., Make a SQL code that will retrieve the average price and sum of year_to_date sales, and GROUP them by their product_ID and offer_ID in the Product.ProductOrderDetail table. What is the code?
2.Use the table Product.ProductOrderDetail and make a SQL Code that uses CAST and CONVERT. What is the code?
3. Use the tables Product.ProductOrderDetail and Product.ProductShipMethod to write a SQL code that shows shipping methods where the yearly total due is greater than 1 million. What is the code?
4. Make a STORED procedure that retrieves all the data from Product.ProductOrderDetail table. What is the code?
5. Make a LEFT join and RIGHT join statement from Product.ProductOrderDetail table. What is the code?
6. . Make any PIVOT statement from the picture below. What is the code?
See pic:
http://imgur.com/wCECZ3l
Explanation / Answer
1) select avg(Product.Price),sum (Product.year_to_date) from Product.ProductOrderDetail where group by Product.product_ID,Product.Offer_id desc;
2) SELECT CAST(Product.year_to_date AS char(2)) FROM Product.ProductOrderDetail;
3) select shipping method from Product.ProductOrderDetail,Product.ProductShipMethod where total due < 1;
4)
5) select P.Price,P.shipping method from Product.ProductOrderDetail as P left join Product.ProductShipMethod as S
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.