File size: 11,186 Bytes
033706d | 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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | instruction,input,output
The task is to determine the order details of pizzas sold on '2015-01-01' .,"How many pizzas of each type were sold on ""2015-01-01"" ?","SELECT order_details$.pizza_id, COUNT(order_details$.pizza_id) FROM order_details$ , orders$
WHERE orders$.order_id=order_details$.order_id
AND orders$.order_date='2015-01-01'
GROUP BY order_details$.pizza_id
ORDER BY COUNT(order_details$.pizza_id) DESC"
The task is to determine the number of pizzas were sold daily .,How many pizzas were sold daily ?,"SELECT CONVERT(date,orders$.order_date) , COUNT(order_details$.order_details_id*order_details$.quantity)
FROM order_details$ ,orders$
WHERE order_details$.order_id=orders$.order_id
GROUP BY CONVERT(date,orders$.order_date)
ORDER BY CONVERT(date,orders$.order_date)"
The task is to determine the number of pizzas sold monthly .,How many pizzas were sold monthly ?,"SELECT month(CONVERT(date,orders$.order_date)) , COUNT(order_details$.order_details_id*order_details$.quantity)
FROM order_details$ ,orders$
WHERE order_details$.order_id=orders$.order_id
GROUP BY month(CONVERT(date,orders$.order_date))
ORDER BY month(CONVERT(date,orders$.order_date))"
The task is to determine the number of orders placed daily .,How many orders were there daily ?,"SELECT CONVERT(date,order_date) , COUNT(order_id)
FROM orders$
GROUP BY CONVERT(date,order_date)
ORDER BY CONVERT(date,order_date)"
The task is to determine the number of orders monthly .,How many orders were there monthly ?,"SELECT DATENAME(MONTH, order_date) ,COUNT(*)
FROM orders$
GROUP BY DATENAME(MONTH, order_date), MONTH(order_date)
ORDER BY MONTH(order_date)"
The task is to determine the number of pizzas of each type sold daily .,How many many pizzas of each type were sold ?,"SELECT pizza_id , COUNT(pizza_id)
FROM order_details$
GROUP BY pizza_id "
The task is to determine the number of pizzas of each type sold monthly .,How many pizzas of each type were sold every month ?,"SELECT DATENAME(month,o.order_date) AS Order_month, od.pizza_id , COUNT(od.pizza_id) AS Num_pizzas
FROM order_details$ AS od, orders$ AS o
WHERE od.order_id=o.order_id
GROUP BY od.pizza_id ,DATENAME(month,o.order_date),MONTH(CONVERT(date,o.order_date))
ORDER BY MONTH(CONVERT(date,o.order_date)) , COUNT(od.pizza_id) DESC"
The task is to determine the order details for order id 27 .,what are the order details for pizza of order_id 27 ?,"SELECT
pt.pizza_name,
p.order_size,
od.quantity
FROM order_details$ AS od
JOIN pizzas$ p ON od.pizza_id = p.pizza_id
JOIN pizza_types$ pt ON p.pizza_type_id = pt.pizza_type_id
WHERE od.order_id = 27;"
The task is to determine the most sold pizza each month .,which pizza was ordered the most each month ?,"with table1 AS
(
SELECT
DATENAME(month,o.order_date) AS Order_month,
MONTH(CONVERT(date,o.order_date)) AS Month_num ,
od.pizza_id ,
COUNT(od.pizza_id) AS Num_pizzas ,
ROW_NUMBER() over (partition by DATENAME(month,o.order_date) ORDER BY MONTH(CONVERT(date,o.order_date)) , COUNT(od.pizza_id) DESC) AS row_num
FROM order_details$ AS od, orders$ AS o
WHERE od.order_id=o.order_id
GROUP BY od.pizza_id ,DATENAME(month,o.order_date),MONTH(CONVERT(date,o.order_date))
)
SELECT Order_month , pizza_id , Num_pizzas
FROM table1
WHERE row_num=1
ORDER BY Month_num"
The task is to determine the number of average orders per month .,How many orders were there on average each month ?,"SELECT cast((max(order_id)/12)AS int)
FROM orders$"
the task is to determine the number of average orders per day .,How many orders were there on average each day ?,"SELECT cast((MAX(order_id)/COUNT(distinct order_date)) AS int)
FROM orders$"
The task is to determine the day on which most pizzas were sold .,Which day were the most pizzas sold ?,"SELECT TOP 1 CONVERT(date,orders$.order_date) , COUNT(order_details$.order_details_id*order_details$.quantity)
FROM order_details$ ,orders$
WHERE order_details$.order_id=orders$.order_id
GROUP BY CONVERT(date,orders$.order_date)
ORDER BY COUNT(order_details$.order_details_id*order_details$.quantity) DESC"
The task is to determine the month in which most pizzas were sold .,Which month were the most pizzas sold ?,"SELECT TOP 1 DATENAME(MONTH, order_date) ,COUNT(*)
FROM orders$
GROUP BY DATENAME(MONTH, order_date), MONTH(order_date)
ORDER BY COUNT(*) DESC"
"The task is to determine the day with the highest revenue ,",Which day had the highest revenue ?,"SELECT TOP 1 CONVERT(date,o.order_date) , sum(od.quantity*p.order_price)
FROM order_details$ AS od
JOIN pizzas$ AS p
ON od.pizza_id=p.pizza_id
JOIN orders$ AS o
ON o.order_id = od.order_id
GROUP BY CONVERT(date,o.order_date)
ORDER BY sum(od.quantity*p.order_price) DESC"
The task is to determine the month with the highest revenue .,Which month had the highest revenue ?,"SELECT TOP 1 DATENAME(MONTH,o.order_date) AS Month_Name , sum(od.quantity*p.order_price) AS Revenue
FROM order_details$ AS od
JOIN pizzas$ AS p
ON od.pizza_id=p.pizza_id
JOIN orders$ AS o
ON o.order_id = od.order_id
GROUP BY DATENAME(MONTH,o.order_date) , MONTH(o.order_date)
ORDER BY sum(od.quantity*p.order_price) DESC "
The task is to determine the total revenue each day .,What was the total revenue each day ?,"SELECT CONVERT(date,o.order_date) , sum(od.quantity*p.order_price)
FROM order_details$ AS od
JOIN pizzas$ AS p
ON od.pizza_id=p.pizza_id
JOIN orders$ AS o
ON o.order_id = od.order_id
GROUP BY CONVERT(date,o.order_date)
ORDER BY CONVERT(date,o.order_date) "
The task is to determine the total revenue each month .,What was the total revenue each month ?,"SELECT DATENAME(MONTH,o.order_date) , sum(od.quantity*p.order_price)
FROM order_details$ AS od
JOIN pizzas$ AS p
ON od.pizza_id=p.pizza_id
JOIN orders$ AS o
ON o.order_id = od.order_id
GROUP BY DATENAME(MONTH,o.order_date) , MONTH(o.order_date)
ORDER BY MONTH(o.order_date)"
The task is to determine the total revenue of the pizza place .,What was the total revenue of the pizza place?,"SELECT cast(sum(od.quantity*p.order_price) AS int)
FROM order_details$ AS od
full JOIN pizzas$ AS p
ON od.pizza_id=p.pizza_id"
The task is to determine how many pizzas were sold in each category .,Which pizza category has sold how many pizzas ?,"SELECT
pt.pizza_category ,
COUNT(pt.pizza_category) AS Number_of_pizzas
FROM order_details$ AS od
JOIN orders$ AS o
ON od.order_id=o.order_id
JOIN pizzas$ AS p
ON od.pizza_id=p.pizza_id
JOIN pizza_types$ AS pt
ON p.pizza_type_id=pt.pizza_type_id
GROUP BY pt.pizza_category"
The task is to determine the most sold pizza category in terms of sales .,Which pizza category is the most sold till now?,"SELECT TOP 1
pt.pizza_category ,
COUNT(pt.pizza_category) AS Number_of_pizzas
FROM order_details$ AS od
JOIN orders$ AS o
ON od.order_id=o.order_id
JOIN pizzas$ AS p
ON od.pizza_id=p.pizza_id
JOIN pizza_types$ AS pt
ON p.pizza_type_id=pt.pizza_type_id
GROUP BY pt.pizza_category
ORDER BY COUNT(pt.pizza_category) DESC"
The task is to determine the most sold pizza category in terms of sales each month .,Which pizza category is the most sold each month ?,"with table1 AS
(
SELECT
DATENAME(month,o.order_date) AS Order_month,
MONTH(CONVERT(date,o.order_date)) AS Month_num ,
pt.pizza_category ,
COUNT(pt.pizza_category) AS Num_pizzas ,
ROW_NUMBER() over (partitiON by DATENAME(month,o.order_date) ORDER BY MONTH(CONVERT(date,o.order_date)) , COUNT(pt.pizza_category) DESC) AS row_num
FROM orders$ AS o
JOIN order_details$ AS od
ON od.order_id=o.order_id
JOIN pizzas$ AS p
ON p.pizza_id=od.pizza_id
JOIN pizza_types$ AS pt
ON pt.pizza_type_id=p.pizza_type_id
GROUP BY pt.pizza_category ,DATENAME(month,o.order_date),MONTH(CONVERT(date,o.order_date))
)
SELECT Order_month , pizza_category , Num_pizzas
FROM table1
WHERE row_num=1
ORDER BY Month_num"
The task is to determine the month with the highest number of orders .,Which month had the highest number of orders ?,"SELECT TOP 1 DATENAME(month,CONVERT(date,order_date)) , COUNT(order_id)
FROM orders$
GROUP BY DATENAME(month,CONVERT(date,order_date))
ORDER BY COUNT(order_id) DESC"
The task is to determine the date with the highest number of orders .,Which day had the highest number of orders ?,"SELECT TOP 1 CONVERT(date,order_date) , COUNT(order_id)
FROM orders$
GROUP BY CONVERT(date,order_date)
ORDER BY COUNT(order_id) DESC"
The task is to determine the number of pizzas of each category sold everyday .,How much pizzas of each category were sold each day ?,"SELECT
CONVERT(date,o.order_date) AS Date_,
pt.pizza_category ,
COUNT(pt.pizza_category) AS Number_of_pizzas
FROM order_details$ AS od
JOIN orders$ AS o
ON od.order_id=o.order_id
JOIN pizzas$ AS p
ON od.pizza_id=p.pizza_id
JOIN pizza_types$ AS pt
ON p.pizza_type_id=pt.pizza_type_id
GROUP BY CONVERT(date,o.order_date) , pt.pizza_category
ORDER BY CONVERT(date,o.order_date)"
The task is to determine the number of pizzas of each category sold each month.,How much pizzas of each category were sold each month ?,"SELECT
DATENAME(MONTH,o.order_date) AS Month_name,
pt.pizza_category ,
COUNT(pt.pizza_category) AS Number_of_pizzas
FROM order_details$ AS od
JOIN orders$ AS o
ON od.order_id=o.order_id
JOIN pizzas$ AS p
ON od.pizza_id=p.pizza_id
JOIN pizza_types$ AS pt
ON p.pizza_type_id=pt.pizza_type_id
GROUP BY DATENAME(MONTH,o.order_date) , pt.pizza_category,MONTH(o.order_date)
ORDER BY MONTH(o.order_date)"
The task is to determine the number of orders placed each day .,How many orders were placed each day ?,"SELECT CONVERT(date,order_date) , COUNT(order_id)
FROM orders$
GROUP BY CONVERT(date,order_date)
ORDER BY CONVERT(date,order_date)"
The task is to determine the number of orders placed each month .,How many orders were placed each month ?,"SELECT DATENAME(month,CONVERT(date,order_date)) , COUNT(order_id)
FROM orders$
GROUP BY DATENAME(month,CONVERT(date,order_date)) , MONTH(order_date)
ORDER BY MONTH(order_date)"
The task is to determine the revenue corresponding to each order .,What is the revenue correponding to each order ?,"SELECT od.order_id , sum(od.quantity*p.order_price) AS revenue
FROM order_details$ AS od , pizzas$ AS p
WHERE od.pizza_id = p.pizza_id
GROUP BY od.order_id
ORDER BY od.order_id"
The task is to determine the top 5 months in terms of revenue .,Which 5 months had the most revenue ?,"SELECT TOP 5 DATENAME(MONTH,o.order_date) AS Month_Name , sum(od.quantity*p.order_price) AS Revenue
FROM order_details$ AS od
JOIN pizzas$ AS p
ON od.pizza_id=p.pizza_id
JOIN orders$ AS o
ON o.order_id = od.order_id
GROUP BY DATENAME(MONTH,o.order_date) , MONTH(o.order_date)
ORDER BY sum(od.quantity*p.order_price) DESC "
The task is to detemine the last 5 months in terms of revenue .,Which 5 months had the least revenue ?,"SELECT TOP 5 DATENAME(MONTH,o.order_date) AS Month_Name , sum(od.quantity*p.order_price) AS Revenue
FROM order_details$ AS od
JOIN pizzas$ AS p
ON od.pizza_id=p.pizza_id
JOIN orders$ AS o
ON o.order_id = od.order_id
GROUP BY DATENAME(MONTH,o.order_date) , MONTH(o.order_date)
ORDER BY sum(od.quantity*p.order_price) DESC "
|