Hello! I need help creating some queries for Microsoft SQL Server. I need these
ID: 3728699 • Letter: H
Question
Hello! I need help creating some queries for Microsoft SQL Server. I need these queries created, assuming that the following table already exists in SQL, that achieve the requirements listed below:
tblAddress AddressID tblCompany CompanylD CompanyName BillingAddressID IsCustomer CustomerVenderSince DateLastModified tblProduct 9 ProductiD City StateProvince PostalCode Country ProductName CurrentStandardUnitPrice tblOrderLine tblCustomerOrder tblEmployee OrderNo EmployeelD LastName FirstName UserName UserPassword Phone SupervisorlD JobPositionlD OrderNo ProductID QuantityOrdered UnitPriceCharged DiscountRate QuantityPicked OrderDate FilledYesNo CompanylD ShippingAddressID EmployeelDTookOrder EmployeelDFilledOrder - tblJobPosition JobPositionID JobTitleExplanation / Answer
1. select OrderNo,ProductID,UnitPriceCharged,DiscountRate,QuantityOrdered, Round(((UnitPriceCharged*QuantityOrdered)-DiscountRate*(UnitPriceCharged*QuantityOrdered)),2) as Total,QuantityPicked from tblOrderLine where OrderNo=610 order by ProductID
2. select OrderNo,SUM(Round(((UnitPriceCharged*QuantityOrdered)-DiscountRate*(UnitPriceCharged*QuantityOrdered)),2)) as GrandTotal from tblOrderLine where OrderNo=610
3. select YEAR(OrderDate) Year,MONTH(OrderDate) Month,count(*) as MonthlyTotalNoOfOrders from tblCustomerOrder GROUP BY YEAR(OrderDate),MONTH(OrderDate) HAVING MonthlyTotalNoOfOrders<20 ORDER BY MonthlyTotalNoOfOrders DESC,Year ASC, Month ASC
4. select DISTINCT StateProvince,Country from tblAddress where StateProvince like '%on%' order by StateProvince
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.