input
stringclasses 1
value | output
stringlengths 0
482
| instruction
stringlengths 25
714
|
---|---|---|
Database Schema:
```sql
Table: customers
Column: CustomerID int(11) NO PRI None auto_increment
Column: Name varchar(255) YES None
Column: Email varchar(255) YES None
Column: Phone varchar(50) YES None
Table: orderdetails
Column: OrderDetailID int(11) NO PRI None auto_increment
Column: OrderID int(11) YES MUL None
Column: ProductID int(11) YES MUL None
Column: Quantity int(11) YES None
Table: orders
Column: OrderID int(11) NO PRI None auto_increment
Column: CustomerID int(11) YES MUL None
Column: OrderDate date YES None
Table: products
Column: ProductID int(11) NO PRI None auto_increment
Column: Name varchar(255) YES None
Column: Price decimal(10,2) YES None
``` |
||
Sample scripts for table: customers
```sql
SELECT * FROM customers WHERE 1 = '1';
SELECT * FROM customers WHERE 2 = '2';
SELECT * FROM customers WHERE 3 = '3';
SELECT * FROM customers WHERE 4 = '4';
SELECT * FROM customers WHERE 5 = '5';
``` |
||
Sample scripts for table: orderdetails
```sql
SELECT * FROM orderdetails WHERE 1 = '1';
SELECT * FROM orderdetails WHERE 2 = '2';
SELECT * FROM orderdetails WHERE 3 = '3';
SELECT * FROM orderdetails WHERE 4 = '4';
SELECT * FROM orderdetails WHERE 5 = '5';
``` |
||
Sample scripts for table: orders
```sql
SELECT * FROM orders WHERE 1 = '1';
SELECT * FROM orders WHERE 2 = '2';
SELECT * FROM orders WHERE 3 = '3';
SELECT * FROM orders WHERE 4 = '4';
SELECT * FROM orders WHERE 5 = '5';
``` |
||
Sample scripts for table: products
```sql
SELECT * FROM products WHERE 1 = '1';
SELECT * FROM products WHERE 2 = '2';
SELECT * FROM products WHERE 3 = '3';
SELECT * FROM products WHERE 4 = '4';
SELECT * FROM products WHERE 5 = '5';
``` |
||
The average price of all products is $X. | Find the average price of all products. |
|
Customers whose name starts with 'A':
- Customer 1
- Customer 2
- ... | List all customers whose name starts with 'A'. |
|
Customer 1: X orders
Customer 2: Y orders
... | Calculate the total number of orders for each customer. |
|
The email of the customer with CustomerID 1 is pagemichelle@example.com. | What is the email of the customer with CustomerID 1? |
|
The name of the customer with CustomerID 1 is Katherine Riley. | What is the name of the customer with CustomerID 1? |
|
The email of the customer with CustomerID 2 is kelsey13@example.com. | What is the email of the customer with CustomerID 2? |
|
The name of the customer with CustomerID 2 is Patricia Holmes. | What is the name of the customer with CustomerID 2? |
|
The email of the customer with CustomerID 3 is krystalbanks@example.com. | What is the email of the customer with CustomerID 3? |
|
The name of the customer with CustomerID 3 is Kathleen Lopez. | What is the name of the customer with CustomerID 3? |
|
The email of the customer with CustomerID 4 is stevenfrank@example.net. | What is the email of the customer with CustomerID 4? |
|
The name of the customer with CustomerID 4 is Melissa Herrera. | What is the name of the customer with CustomerID 4? |
|
The email of the customer with CustomerID 5 is turnerheather@example.org. | What is the email of the customer with CustomerID 5? |
|
The name of the customer with CustomerID 5 is Richard Gillespie. | What is the name of the customer with CustomerID 5? |
|
The email of the customer with CustomerID 6 is amanda13@example.com. | What is the email of the customer with CustomerID 6? |
|
The name of the customer with CustomerID 6 is Amber Bennett. | What is the name of the customer with CustomerID 6? |
|
The email of the customer with CustomerID 7 is claytonmelinda@example.com. | What is the email of the customer with CustomerID 7? |
|
The name of the customer with CustomerID 7 is Nicholas Butler. | What is the name of the customer with CustomerID 7? |
|
The email of the customer with CustomerID 8 is rose75@example.net. | What is the email of the customer with CustomerID 8? |
|
The name of the customer with CustomerID 8 is Victor Cardenas. | What is the name of the customer with CustomerID 8? |
|
The email of the customer with CustomerID 9 is nguyenderek@example.org. | What is the email of the customer with CustomerID 9? |
|
The name of the customer with CustomerID 9 is Anita Stewart. | What is the name of the customer with CustomerID 9? |
|
The email of the customer with CustomerID 10 is perrysamantha@example.org. | What is the email of the customer with CustomerID 10? |
|
The name of the customer with CustomerID 10 is David Clark. | What is the name of the customer with CustomerID 10? |
|
The customer with CustomerID 1 placed 2 orders. | How many orders did the customer with CustomerID 1 place? |
|
The customer with CustomerID 3 placed 3 orders. | How many orders did the customer with CustomerID 3 place? |
|
The customer with CustomerID 4 placed 3 orders. | How many orders did the customer with CustomerID 4 place? |
|
The customer with CustomerID 5 placed 2 orders. | How many orders did the customer with CustomerID 5 place? |
|
The customer with CustomerID 6 placed 4 orders. | How many orders did the customer with CustomerID 6 place? |
|
The customer with CustomerID 7 placed 2 orders. | How many orders did the customer with CustomerID 7 place? |
|
The customer with CustomerID 8 placed 1 orders. | How many orders did the customer with CustomerID 8 place? |
|
The customer with CustomerID 9 placed 6 orders. | How many orders did the customer with CustomerID 9 place? |
|
The customer with CustomerID 10 placed 1 orders. | How many orders did the customer with CustomerID 10 place? |
|
The customer with CustomerID 11 placed 1 orders. | How many orders did the customer with CustomerID 11 place? |
|
The price of reduce is $95.71. | What is the price of reduce? |
|
The price of suddenly is $295.39. | What is the price of suddenly? |
|
The price of happen is $373.73. | What is the price of happen? |
|
The price of player is $251.23. | What is the price of player? |
|
The price of likely is $333.92. | What is the price of likely? |
|
The price of experience is $160.00. | What is the price of experience? |
|
The price of improve is $378.76. | What is the price of improve? |
|
The price of structure is $425.14. | What is the price of structure? |
|
The price of arm is $196.57. | What is the price of arm? |
|
The price of which is $7.95. | What is the price of which? |
|
```sql
SELECT Orders.OrderID, Customers.Name AS CustomerName, Products.Name AS ProductName, OrderDetails.Quantity
FROM Orders
JOIN Customers ON Orders.CustomerID = Customers.CustomerID
JOIN OrderDetails ON Orders.OrderID = OrderDetails.OrderID
JOIN Products ON OrderDetails.ProductID = Products.ProductID
LIMIT 10;
``` | Fetch all orders with customer names and product details. |
|
```sql
SELECT Name, Email
FROM Customers
WHERE CustomerID IN (
SELECT CustomerID
FROM Orders
GROUP BY CustomerID
HAVING COUNT(OrderID) > 1
)
LIMIT 10;
``` | Find customers who have placed more than one order. |
|
```sql
SELECT Products.Name, SUM(OrderDetails.Quantity * Products.Price) AS TotalSales
FROM OrderDetails
JOIN Products ON OrderDetails.ProductID = Products.ProductID
GROUP BY Products.Name
LIMIT 10;
``` | Calculate the total sales for each product. |
|
```sql
SELECT Orders.OrderID, Orders.CustomerID, Customers.Name,
Orders.OrderDate,
SUM(OrderDetails.Quantity * Products.Price) OVER (PARTITION BY Orders.CustomerID ORDER BY Orders.OrderDate) AS RunningTotal
FROM Orders
JOIN Customers ON Orders.CustomerID = Customers.CustomerID
JOIN OrderDetails ON Orders.OrderID = OrderDetails.OrderID
JOIN Products ON OrderDetails.ProductID = Products.ProductID
LIMIT 10;
``` | Calculate running total of orders for each customer. |