| 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 "
|
| |