March 4, 2017 at 12:18 am
Table: UnitsSold
Columns:
• ProductID
• Quantity
• Date
• ForecastOrActual – can be “A” for actual and “F” for forecast.
Sample Data would look like this:
UnitsSold
ProductID Quantity Date ForecastOrActual
Widget 100 1-June-2015 F
Widget 120 1-June-2015 A
Gizmo 90 1-June-2015 F
Gizmo 80 1-June-2015 A
Doohickey 200 1-June-2015 A
Write an SQL query which returns a single aggregate metric indicating how well actuals met forecast for a given week. What assumptions did you make?
March 4, 2017 at 1:06 am
jeswar - Saturday, March 4, 2017 12:18 AMTable: UnitsSold
Columns:
• ProductID
• Quantity
• Date
• ForecastOrActual – can be “A†for actual and “F†for forecast.Sample Data would look like this:
UnitsSold
ProductID Quantity Date ForecastOrActual
Widget 100 1-June-2015 F
Widget 120 1-June-2015 A
Gizmo 90 1-June-2015 F
Gizmo 80 1-June-2015 A
Doohickey 200 1-June-2015 AWrite an SQL query which returns a single aggregate metric indicating how well actuals met forecast for a given week. What assumptions did you make?
looks very much like a homework question to me......what have you tried so far and what are the results you expect to return?
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
March 5, 2017 at 1:54 pm
jeswar - Saturday, March 4, 2017 12:18 AMTable: UnitsSold
Columns:
• ProductID
• Quantity
• Date
• ForecastOrActual – can be “A†for actual and “F†for forecast.Sample Data would look like this:
UnitsSold
ProductID Quantity Date ForecastOrActual
Widget 100 1-June-2015 F
Widget 120 1-June-2015 A
Gizmo 90 1-June-2015 F
Gizmo 80 1-June-2015 A
Doohickey 200 1-June-2015 AWrite an SQL query which returns a single aggregate metric indicating how well actuals met forecast for a given week. What assumptions did you make?
Agreed. Looks like homework or a test.
Either your instructor just got done teaching about self-joins or just got done teaching about Lead/Lag. Review what your instructor taught and give it a shot. For goodness sake, do it on your own so that you actually know something about T-SQL if you happen to pass the course.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply