File size: 38,234 Bytes
b238d4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{"Questions": "What is the forecasted sales for 2022 for Department ABC?", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(date) = 2022 and [department name] = 'abc'"}
{"Questions": "What is the forecasted sales for 2022 for Location AYZ?", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(date) = 2022 and location = 'ayz'"}
{"Questions": "What is the forecasted sales for 2022 for Account name Depreciation?", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(date) = 2022 and [Account name] like '%depreciation%'"}
{"Questions": "What is the forecasted sales for 2022 for Geography AY?", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(date) = 2022 and gepgraphy = 'ay'"}
{"Questions": "Entity Alpha has how many unique departments?", "SQL Query": "select count( distinct (department name)) from forecasted_table where enity = 'Alpha'"}
{"Questions": "Entity Alpha has how many unique locations?", "SQL Query": "select count( distinct (location)) from forecasted_table where enity = 'Alpha'"}
{"Questions": "Entity Alpha has how many unique geographies?", "SQL Query": "select count( distinct (geography)) from forecasted_table where enity = 'Alpha'"}
{"Questions": "Entity Alpha has how many unique accounts?", "SQL Query": "select count( distinct (account name)) from forecasted_table where enity = 'Alpha'"}
{"Questions": "find unique departments?", "SQL Query": "select count( distinct (department name)) from forecasted_table"}
{"Questions": "how many unique locations are there?", "SQL Query": "select count( distinct (location)) from forecasted_table"}
{"Questions": "find unique accounts?", "SQL Query": "select count( distinct (account name)) from forecasted_table"}
{"Questions": "find unique entities?", "SQL Query": "select count( distinct (entity)) from forecasted_table"}
{"Questions": "What is the total forecasted sales for 2022 for location L02?", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 and [location] = 'L02'"}
{"Questions": "What is the total forecasted sales for 2022 for print?", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 and [account name] like '%print%'"}
{"Questions": "What is the quarter 3 sales for Location L03?", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where quarter = 3 and [location] = 'L03'"}
{"Questions": "What is the quarter 3 sales for Entity Alpha?", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where quarter = 3 and [entity] = 'alpha'"}
{"Questions": "What is the quarter 3 sales for Department DL08?", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where quarter = 3 and [department name] = 'DL08'"}
{"Questions": "What is the quarter 3 sales for Sales discount?", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where quarter = 3 and [account name] like '%sales discount%'"}
{"Questions": "How many years of forecasted data do we have in the table?", "SQL Query": "select distinct (year(date)) from forecasted_table"}
{"Questions": "For Entity Alpha, what is the latest forecast available?", "SQL Query": "select max(year(date)), max(month(date)) from forecasted_table where [entity] = 'Alpha'"}
{"Questions": "what is the latest forecast available for location L76?", "SQL Query": "select max(year(date)), max(month(date)) from forecasted_table where [location] = 'L76'"}
{"Questions": "What is the latest forecast available for Geography GL877?", "SQL Query": "select max(year(date)), max(month(date)) from forecasted_table where [geography] = 'GL877'"}
{"Questions": "What is the average forecasted sales per entity?", "SQL Query": "select entity, avg(isnull(sales_forecast,0)) from forecasted_table group by entity"}
{"Questions": "What is the average forecasted sales per department?", "SQL Query": "select  [department name], avg(isnull(sales_forecast,0)) from forecasted_table group by [department name]"}
{"Questions": "What is the average forecasted sales per location?", "SQL Query": "select location, avg(isnull(sales_forecast,0)) from forecasted_table group by location"}
{"Questions": "What is the average forecasted sales per account?", "SQL Query": "select  [account name], avg(isnull(sales_forecast,0)) from forecasted_table group by [account name]"}
{"Questions": "What is the average forecasted sales per geography?", "SQL Query": "select geography, avg(isnull(sales_forecast,0)) from forecasted_table group by geography"}
{"Questions": "Find the total sales for 2023 for accounts that contain \"merchandise sales\"", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(date) = 2023 and [account name] like '%merchandise sales%'"}
{"Questions": "Find the total sales for 2023 for department name that contain \"DL\"", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(date) = 2023 and [department name] like '%DL%'"}
{"Questions": "Find the total sales for 2023 for accounts that start with \"merchandise sales\"", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(date) = 2023 and [account name] like 'merchandise sales%'"}
{"Questions": "Find the total sales for 2023 for department name that start with \"DP\"", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(date) = 2023 and [account name] like 'DP%'"}
{"Questions": "Find the unique departments that contain \"DP\"", "SQL Query": "select  distinct [department name] from forecasted_table where [department name] like '%dp%'"}
{"Questions": "Find the unique accounts that contain \"hr\"", "SQL Query": "select  distinct [account name] from forecasted_table where [account name] like '%hr%'"}
{"Questions": "find the total sales for year 2023 for locations- ABC, AHC, and JIE", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(date) = 2023 and [location] in ('ABC', 'AHC' , 'JIE')"}
{"Questions": "find the total sales for year 2023 for department name- DL001,DL002, AND DL003", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(date) = 2023 and [department name] in ('DL001', 'DL002', 'DL003')"}
{"Questions": "find the total sales for year 2023 for geography- GL001,GL002, AND GL003", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(date) = 2023 and [geography] in ('GL001', 'GL002', 'GL003')"}
{"Questions": "find the total sales for year 2023 for entity- Alpha and beta", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(date) = 2023 and [entity] in ('alpha', 'beta')"}
{"Questions": "Find accounts with sales forecast between 20000-30000 in 2023?", "SQL Query": "select [account name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2023 group by [account name] having sum(isnull(sales_forecast,0)) >=20000 and sum(isnull(sales_forecast,0)) < 30000 "}
{"Questions": "Find departments with sales forecast between 50000-80000 in 2023?", "SQL Query": "select [department name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2023 group by [department name] having sum(isnull(sales_forecast,0)) >=50000 and sum(isnull(sales_forecast,0)) < 80000 "}
{"Questions": "What is the department number for Finance", "SQL Query": "select distinct [department number] from forecasted_table where [department name] like '%Finance%'"}
{"Questions": "What is the account number for Overtime - (Hrly) - Corporate account", "SQL Query": "select distinct [account number] from forecasted_table where [account name] like '%Overtime - (Hrly) - Corporate%'"}
{"Questions": "Fine total sales in 2023 for account 401?", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2023 where [account number] = 401"}
{"Questions": "What is the total sales in 2022 for department number FD32", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2023 where [department number] = 'FD32'"}
{"Questions": "How much is forecasted department spend on Brand Marketing in 2023", "SQL Query": "select sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2023 and [department name] like '%Brand Marketing%'"}
{"Questions": "What is the forecasted location wise sales for Alpha in year 2022?", "SQL Query": "select  location ,sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 and entity = 'alpha' group by location"}
{"Questions": "Find forecasted sales in 2022 by  department for location AL001?", "SQL Query": "select  [department name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 and location = 'al001' group by [department name]"}
{"Questions": "find forecasted 2022 account wise sales for department depreciation?", "SQL Query": "select  [account name] ,sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 and [department name] = 'depreciation' group by [account name]"}
{"Questions": "find the forecasted sales by  Locations for year 2022?", "SQL Query": "select  location ,sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by location"}
{"Questions": "what is forecasted sales across different departments for year 2022?", "SQL Query": "select  [department name] ,sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [department name]"}
{"Questions": "find forecasted sales by geographies for year 2022?", "SQL Query": "select  geography ,sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by geography"}
{"Questions": " what is the forecasted sales across different accounts for year 2022?", "SQL Query": "select  [account name] ,sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [account name]"}
{"Questions": "find forecasted sales by entities for year 2022?", "SQL Query": "select  entity ,sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by entity"}
{"Questions": "find the top 2 location in Alpha projected to have highest sales_forecast for 2022", "SQL Query": "select top 2 [location], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by location order by sales_forecast desc"}
{"Questions": "find the top 5 locations in Alpha projected to have highest sales_forecast for 2022", "SQL Query": "select top 5 [location], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by location order by sales_forecast desc"}
{"Questions": "find the top 3 geography in Alpha projected to have highest sales_forecast for 2022", "SQL Query": "select top 3 [geography], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by geography order by sales_forecast desc"}
{"Questions": "find the top 10 departments in Alpha projected to have highest sales for 2022", "SQL Query": "select top 10 [department name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022  group by [department name]  order by sales_forecast desc"}
{"Questions": "Which Department has the lowest sales forecast in the year 2022?", "SQL Query": "select top 1 [department name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [department name] order by sales_forecast asc"}
{"Questions": "Which account has lowest sales in the year 2022?", "SQL Query": "select top 1 [account name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 order by sales_forecast asc"}
{"Questions": "Which location has lowest sales in the year 2022?", "SQL Query": "select top 1 [location], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by location order by sales_forecast asc"}
{"Questions": "Which geography has lowest sales in the year 2022?", "SQL Query": "select top 1 [geography], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by geography order by sales_forecast asc"}
{"Questions": "Which entity has lowest sales in the year 2022?", "SQL Query": "select top 1 [entity], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by entity order by sales_forecast asc"}
{"Questions": "Which Department has highest sales in the year 2022?", "SQL Query": "select top  1 [department name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [department name] order by sales_forecast desc"}
{"Questions": "Which Entity has the highest forecasted sales for the current year?", "SQL Query": "select top 1 entity, sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = year(getdate()) group by entity order by sales_forecast desc"}
{"Questions": "Which location has the highest forecasted sales for the current year?", "SQL Query": "select top 1 location, sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = year(getdate()) group by location order by sales_forecast desc"}
{"Questions": "Which account has the highest forecasted sales for the current year?", "SQL Query": "select top 1 [account name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = year(getdate()) group by [account name] order by sales_forecast desc"}
{"Questions": "Which geography has the highest forecasted sales for the current year?", "SQL Query": "select top 1 geography, sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = year(getdate()) group by geography order by sales_forecast desc"}
{"Questions": "find the breakdown of forecasted sales for 2022 for each Geography by Department?", "SQL Query": "select  geography, [department name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by geography, [department name]"}
{"Questions": "find the breakdown of forecasted sales for 2022 for each account by Department?", "SQL Query": "select  [account name], [department name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [account name], [department name]"}
{"Questions": "find the breakdown of forecasted sales for 2022 for each Geography by location?", "SQL Query": "select  geography, [location], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by geography, [location]"}
{"Questions": "What are the forecasted sales figures for each account over year 2022 sort by descending order?", "SQL Query": "select  [account name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [account name] order by sales_forecast desc"}
{"Questions": "What are the forecasted sales figures for each account over year 2022 sort by ascending order?", "SQL Query": "select  [account name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [account name] order by sales_forecast asc"}
{"Questions": "What are the forecasted sales figures for each department over year 2022 sort by descending order?", "SQL Query": "select  [department name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [department name] order by sales_forecast desc"}
{"Questions": "What are the forecasted sales figures for each department over year 2022 sort by ascending order?", "SQL Query": "select  [department name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [department name] order by sales_forecast asc"}
{"Questions": "What are the forecasted sales figures for each location over year 2022 sort by ascending order?", "SQL Query": "select  [location], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [location] order by sales_forecast asc"}
{"Questions": "What are the forecasted sales figures for each location over year 2022 sort by descending order?", "SQL Query": "select  [account name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [account name] order by sales_forecast desc"}
{"Questions": "What is the average forecasted sales for year 2022  in each location?", "SQL Query": "select location, avg(isnull(sales_forecast,0)) from forecasted_table where year(Date)  = 2022 group by location"}
{"Questions": "What is the average forecasted sales for year 2022  in each department?", "SQL Query": "select [department name], avg(isnull(sales_forecast,0)) from forecasted_table where year(Date)  = 2022 group by [department name]"}
{"Questions": "What is the average forecasted sales for year 2022  in each entity?", "SQL Query": "select entity, avg(isnull(sales_forecast,0)) from forecasted_table where year(Date)  = 2022 group by entity"}
{"Questions": "What is the average forecasted sales for year 2022  in each account?", "SQL Query": "select [account name], avg(isnull(sales_forecast,0)) from forecasted_table where year(Date)  = 2022 group by [account name]"}
{"Questions": "What is the average forecasted sales for year 2022  in each geography?", "SQL Query": "select geography, avg(isnull(sales_forecast,0)) from forecasted_table where year(Date)  = 2022 group by geography"}
{"Questions": "What is the average forecasted sales  in each location?", "SQL Query": "select location, avg(isnull(sales_forecast,0)) from forecasted_table group by location"}
{"Questions": "What is the average forecasted sales  in each department?", "SQL Query": "select [department name], avg(isnull(sales_forecast,0)) from forecasted_table group by [department name]"}
{"Questions": "What is the average forecasted sales  in each entity?", "SQL Query": "select entity, avg(isnull(sales_forecast,0)) from forecasted_table group by entity"}
{"Questions": "Account wise projected sales for Wholesale department in 2022?", "SQL Query": "select [account name], sum(isnull(sales_forecast,0)) from forecasted_table where [department name] = 'wholesale' and year(Date) = 2022 group by [account name]"}
{"Questions": "Location wise projected sales for Sales discount account in 2022?", "SQL Query": "select location, sum(isnull(sales_forecast,0)) from forecasted_table where [account name] = 'sales discount' and year(Date) = 2022 group by location"}
{"Questions": "Geography wise projected sales for ABC entity in 2022?", "SQL Query": "select geography, sum(isnull(sales_forecast,0)) from forecasted_table where [entity] = 'abc' and year(Date) = 2022 group by geography"}
{"Questions": "Entity wise projected sales for Wholesale department in 2022?", "SQL Query": "select entity, sum(isnull(sales_forecast,0)) from forecasted_table where [entity] = 'abc' and year(Date) = 2022 group by entity"}
{"Questions": "What is the average forecasted sales  in each account?", "SQL Query": "select [account name], avg(isnull(sales_forecast,0)) from forecasted_table group by [account name]"}
{"Questions": "What is the average forecasted sales  in each geography?", "SQL Query": "select geography, avg(isnull(sales_forecast,0)) from forecasted_table group by geography"}
{"Questions": "Departments projected to have yearly sales below 150,000 are termed as \"Low expense departments\". How many such departments do we have in 2022?", "SQL Query": "select count(*) from (select [department number], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [department number] having sum(isnull(sales_forecast,0)) < 150000) "}
{"Questions": "Accounts projected to have yearly sales below 50,000 are termed as \"Low activity accounts\". How many such accounts do we have in 2022?", "SQL Query": "select count(*) from (select [account number], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [account number] having sum(isnull(sales_forecast,0)) < 50000) "}
{"Questions": "Location wise projected sales for Wholesale department in 2022?", "SQL Query": "select location, sum(isnull(sales_forecast,0)) from forecasted_table where [department name] like '%wholesale%' and year(Date) = 2022 group by location"}
{"Questions": "find average sales for each entity, geography, department and location for the year 2022?", "SQL Query": "select entity, geography , [department name], location, sum(isnull(sales_forecast,0))/count(distinct [department number]) from forecasted_table where year(date) = 2022 group by entity, geography ,[department name], location"}
{"Questions": "find average sales per department for each entity, geography and location?", "SQL Query": "select entity, geography , location, sum(isnull(sales_forecast,0))/count(distinct [department number]) from forecasted_table group by entity, geography , location"}
{"Questions": "For product cost account, what is the forecasted sales growth in the month of 5 year 2022 compared to previous month?", "SQL Query": "SELECT \n   [account name],year(Date),month(date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [account name] ORDER BY year(Date),month(date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [account name] ORDER BY year(Date),month(date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [account name] ORDER BY year(Date),month(date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere  [account name] like '%product cost%' and year(date) = 2022 and month(date) = 5\n    group by   [account name] ,year(Date),month(date)\nORDER BY \n  [account name] ,year(Date),month(date)"}
{"Questions": "For finance department, what is the forecasted sales growth in the month of 7 year 2022 compared to previous month?", "SQL Query": "SELECT \n   [department name],year(Date),month(date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [department name] ORDER BY year(Date),month(date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [department name] ORDER BY year(Date),month(date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [department name] ORDER BY year(Date),month(date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere  [department name] = 'finance' and year(date) = 2022 and month(date) = 7\n    group by   [department name] ,year(Date),month(date)\nORDER BY \n  [department name] ,year(Date),month(date)"}
{"Questions": "What is the forecasted sales growth for entity ABC in the month of 6 year 2022 compared to previous month?", "SQL Query": "SELECT \n   [entity],year(Date),month(date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [entity] ORDER BY year(Date),month(date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [entity] ORDER BY year(Date),month(date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [entity] ORDER BY year(Date),month(date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere  [entity] = 'ABC' and year(date) = 2022 and month(date) = 6\n    group by   [entity] ,year(Date),month(date)\nORDER BY \n  [entity] ,year(Date),month(date)"}
{"Questions": "What is the forecasted sales growth for Location AB23 in the month of 5 year 2022 compared to previous month?", "SQL Query": "SELECT \n   [location],year(Date),month(date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [location] ORDER BY year(Date),month(date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [location] ORDER BY year(Date),month(date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [location] ORDER BY year(Date),month(date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere  [location] = 'AB23' and year(date) = 2022 and month(date) = 5\n    group by   [location] ,year(Date),month(date)\nORDER BY \n  [location] ,year(Date),month(date)"}
{"Questions": "For customer service department , what is the forecasted sales growth in the month of 2 year 2022 compared to previous month?", "SQL Query": "SELECT \n   [department name],year(Date),month(date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [department name] ORDER BY year(Date),month(date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [department name] ORDER BY year(Date),month(date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY  [department name] ORDER BY year(Date),month(date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere  [department name] = 'customer service' and year(date) = 2022 and month(date) = 2\n    group by   [department name] ,year(Date),month(date)\nORDER BY \n  [department name] ,year(Date),month(date)"}
{"Questions": "What is the difference in forecasted sales for HR Department for year 2023 Vs 2022", "SQL Query": "SELECT \n    [department name],year(Date),\n   sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] ORDER BY year(Date)) AS sales_forecastDifference\nFROM \n    forecasted_table\nwhere [department name] like '%hr%' and year(date) = 2023\n    group by  [department name],year(Date)\nORDER BY \n   [department name],year(Date)"}
{"Questions": "What is the difference in forecasted sales for sales rebate account for year 2022 and 2023", "SQL Query": "SELECT \n    [account name],year(Date),\n   sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [account name] ORDER BY year(Date)) AS sales_forecastDifference\nFROM \n    forecasted_table\nwhere [account name] like '%sales rebate%' and year(date) = 2023\n    group by  [account name],year(Date)\nORDER BY \n   [account name],year(Date)"}
{"Questions": "What is the difference in forecasted sales for entity ABC for year 2022 and 2023", "SQL Query": "SELECT \n    [entity],year(Date),\n   sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [entity] ORDER BY year(Date)) AS sales_forecastDifference\nFROM \n    forecasted_table\nwhere [entity] = 'ABC' and year(date) = 2023\n    group by  [entity],year(Date)\nORDER BY \n   [account name],year(Date)"}
{"Questions": "find the percentage change in forecasted sales compared to the previous year for each Entity?", "SQL Query": "SELECT \n    entity, year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY entity ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY entity ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY entity \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\n    group by  entity, year(Date)\nORDER BY \n   entity, year(Date)"}
{"Questions": "For each department, find the percentage change in forecasted sales compared to the previous year?", "SQL Query": "SELECT \n    [department name],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\n    group by [department name],year(Date)\nORDER BY \n   [department name],year(Date)"}
{"Questions": "For each location, find the percentage change in forecasted sales compared to the previous year?", "SQL Query": "SELECT \n    [location],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [location] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [ location] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [location] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\n    group by [location],year(Date)\nORDER BY \n   [location],year(Date)"}
{"Questions": "For each geography, find the percentage change in forecasted sales compared to the previous year?", "SQL Query": "SELECT \n    [geography],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [geography] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [ geography] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [geography] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\n    group by [geography],year(Date)\nORDER BY \n   [geography],year(Date)"}
{"Questions": "Which Department is expected to see the most significant growth in the 2023?", "SQL Query": "SELECT top 1\n    [department name],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere year(date) = 2023\n    group by  [department name],year(Date)\nORDER BY \n   sales_forecast_growth desc"}
{"Questions": "Which Account is expected to see the most significant growth in sales in the 2023?", "SQL Query": "SELECT top 1\n    [account name],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [account name] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [account name] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [account name] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere year(date) = 2023\n    group by  [account name],year(Date)\nORDER BY \n   sales_forecast_growth desc"}
{"Questions": "Which Entity is expected to see the most significant growth in sales in the 2023?", "SQL Query": "SELECT top 1\n    [entity],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [entity] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [entity] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [entity] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere year(date) = 2023\n    group by  [entity],year(Date)\nORDER BY \n   sales_forecast_growth desc"}
{"Questions": "Which Location is expected to see the most significant growth in sales in the 2023?", "SQL Query": "SELECT top 1\n    [location],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [location] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [location] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [location] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere year(date) = 2023\n    group by  [location],year(Date)\nORDER BY \n   sales_forecast_growth desc"}
{"Questions": "How many departments are projected to have sales greater than 1 million in 2022?", "SQL Query": "select count(*) from (select [department name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [department name] having sum(isnull(sales_forecast,0)) > 1000000) "}
{"Questions": "How many locations are projected to have sales greater than 1 million in 2022?", "SQL Query": "select count(*) from (select [location], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [location] having sum(isnull(sales_forecast,0)) > 1000000) "}
{"Questions": "How many accounts are projected to have sales greater than 1 million in 2022?", "SQL Query": "select count(*) from (select [account name], sum(isnull(sales_forecast,0)) from forecasted_table where year(Date) = 2022 group by [account name] having sum(isnull(sales_forecast,0)) > 1000000) "}
{"Questions": "Top 5 accounts in 2023 having highest growth rate of forecasted sales?", "SQL Query": "SELECT top 5\n    [account name],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [account name] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [account name] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [account name] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere year(date) = 2023\n    group by  [account name],year(Date)\nORDER BY \n   sales_forecast_growth desc"}
{"Questions": "Top 5 departments in 2023 having highest growth rate of forecasted sales?", "SQL Query": "SELECT top 5\n    [department name],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere year(date) = 2023\n    group by  [department name],year(Date)\nORDER BY \n   sales_forecast_growth desc"}
{"Questions": "Top 5 location in 2023 having highest growth rate of forecasted sales?", "SQL Query": "SELECT top 5\n    [location],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [location] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [location] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [location] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere year(date) = 2023\n    group by  [location],year(Date)\nORDER BY \n   sales_forecast_growth desc"}
{"Questions": "Top 5 geography in 2023 having highest growth rate of forecasted sales?", "SQL Query": "SELECT top 5\n    [geography],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [geography] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [geography] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [geography] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere year(date) = 2023\n    group by  [geography],year(Date)\nORDER BY \n   sales_forecast_growth desc"}
{"Questions": "Top 5 entity in 2023 having highest growth rate of forecasted sales?", "SQL Query": "SELECT top 5\n    [entity],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [entity] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [entity] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [entity] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere year(date) = 2023\n    group by  [entity],year(Date)\nORDER BY \n   sales_forecast_growth desc"}
{"Questions": "Which Department is expected to see the least significant growth in the 2023?", "SQL Query": "SELECT top 1\n    [department name],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [department name] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere year(date) = 2023\n    group by  [department name],year(Date)\nORDER BY \n   sales_forecast_growth asc"}
{"Questions": "Which Account is expected to see the least significant growth in sales in the 2023?", "SQL Query": "SELECT top 1\n    [account name],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [account name] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [account name] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [account name] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere year(date) = 2023\n    group by  [account name],year(Date)\nORDER BY \n   sales_forecast_growth asc"}
{"Questions": "Which Entity is expected to see the least significant growth in sales in the 2023?", "SQL Query": "SELECT top 1\n    [entity],year(Date),\n    case when LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [entity] ORDER BY year(Date))  = 0 then null \n    else decimal(((sum(isnull(sales_forecast,0)) - LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [entity] ORDER BY year(Date))) /LAG(sum(isnull(sales_forecast,0))) OVER (PARTITION BY [entity] \nORDER BY year(Date)))*100),2)  end as sales_forecast_growth\nFROM \n    forecasted_table\nwhere year(date) = 2023\n    group by  [entity],year(Date)\nORDER BY \n   sales_forecast_growth asc"}