File size: 8,269 Bytes
ac35dc9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
    "examples": [
        {
            "input": "List all customers in France with a credit limit over 20,000.",
            "query": "SELECT * FROM customers WHERE country = 'France' AND creditLimit > 20000;"
        },
        {
            "input": "Get the highest payment amount made by any customer.",
            "query": "SELECT MAX(amount) FROM payments;"
        },
        {
            "input": "Show product details for products in the 'Motorcycles' product line.",
            "query": "SELECT * FROM products WHERE productLine = 'Motorcycles';"
        },
        {
            "input": "Retrieve the names of employees who report to employee number 1002.",
            "query": "SELECT firstName, lastName FROM employees WHERE reportsTo = 1002;"
        },
        {
            "input": "List all products with a stock quantity less than 7000.",
            "query": "SELECT productName, quantityInStock FROM products WHERE quantityInStock < 7000;"
        },
        {
            "input": "what is price of `1968 Ford Mustang`",
            "query": "SELECT `buyPrice`, `MSRP` FROM products WHERE `productName` = '1968 Ford Mustang' LIMIT 1;"
        },
        {
            "input": "Find all albums for the artist AC/DC",
            "query": "SELECT * FROM Album WHERE ArtistId = (SELECT ArtistId FROM Artist WHERE Name = AC/DC);"
        },
        {
            "input": "List all tracks in the 'Rock' genre.",
            "query": "SELECT * FROM Track WHERE GenreId = (SELECT GenreId FROM Genre WHERE Name = 'Rock');"
        },
        {
            "input": "Find the total duration of all tracks.",
            "query": "SELECT SUM(Milliseconds) FROM Track;"
        },
        {
            "input": "List all customers from Canada.",
            "query": "SELECT * FROM Customer WHERE Country = 'Canada';"
        },
        {
            "input": "How many tracks are there in the album with ID 5?",
            "query": "SELECT COUNT(*) FROM Track WHERE AlbumId = 5;"
        },
        {
            "input": "Find the total number of invoices.",
            "query": "SELECT COUNT(*) FROM Invoice;"
        },
        {
            "input": "List all tracks that are longer than 5 minutes.",
            "query": "SELECT * FROM Track WHERE Milliseconds > 300000;"
        },
        {
            "input": "Who are the top 5 customers by total purchase?",
            "query": "SELECT CustomerId, SUM(Total) AS TotalPurchase FROM Invoice GROUP BY CustomerId ORDER BY TotalPurchase DESC LIMIT 5;"
        },
        {
            "input": "Which albums are from the year 2000?",
            "query": "SELECT * FROM Album WHERE strftime('%Y', ReleaseDate) = '2000';"
        },
        {
            "input": "How many employees are there",
            "query": "SELECT COUNT(*) FROM 'Employee'"
        },
        {
            "input": "Retrieve the first name and last name of all employees.",
            "query": "SELECT firstName, lastName FROM employees;"
        },
        {
            "input": "List the product names and their respective buy prices.",
            "query": "SELECT productName, buyPrice FROM products;"
        },
        {
            "input": "Find the names and cities of all customers.",
            "query": "SELECT customerName, city FROM customers;"
        },
        {
            "input": "Get the order dates and statuses of all orders.",
            "query": "SELECT orderDate, status FROM orders;"
        },
        {
            "input": "Retrieve the product codes and quantities of all items ordered.",
            "query": "SELECT productCode, quantityOrdered FROM orderdetails;"
        },
        {
            "input": "List the customer names and their sales representatives' employee numbers.",
            "query": "SELECT customerName, salesRepEmployeeNumber FROM customers;"
        },
        {
            "input": "Find the names of products that have a quantity in stock greater than 100.",
            "query": "SELECT productName FROM products WHERE quantityInStock > 100;"
        },
        {
            "input": "Retrieve the office codes and their corresponding cities and countries.",
            "query": "SELECT officeCode, city, country FROM offices;"
        },
        {
            "input": "Get the last name and job title of employees who work in office '1'.",
            "query": "SELECT lastName, jobTitle FROM employees WHERE officeCode = '1';"
        },
        {
            "input": "Find all orders placed in 2020.",
            "query": "SELECT * FROM orders WHERE YEAR(orderDate) = 2020;"
        },
        {
            "input": "List the customer names and the total amount they have ordered.",
            "query": "SELECT customerName, SUM(quantityOrdered * priceEach) AS totalAmount FROM customers c JOIN orders o ON c.customerNumber = o.customerNumber JOIN orderdetails od ON o.orderNumber = od.orderNumber GROUP BY customerName;"
        },
        {
            "input": "Retrieve the names of employees who have the title 'Sales Rep'.",
            "query": "SELECT firstName, lastName FROM employees WHERE jobTitle = 'Sales Rep';"
        },
        {
            "input": "List the product lines and the number of products in each line.",
            "query": "SELECT productLine, COUNT(*) AS numberOfProducts FROM products GROUP BY productLine;"
        },
        {
            "input": "Find the customers who have placed more than 10 orders.",
            "query": "SELECT customerName FROM customers c JOIN orders o ON c.customerNumber = o.customerNumber GROUP BY customerName HAVING COUNT(*) > 10;"
        },
        {
            "input": "Retrieve the top 5 most expensive products.",
            "query": "SELECT productName, buyPrice FROM products ORDER BY buyPrice DESC LIMIT 5;"
        },
        {
            "input": "List the employees who report to employee number 1143.",
            "query": "SELECT firstName, lastName FROM employees WHERE reportsTo = 1143;"
        },
        {
            "input": "Find the total number of orders for each customer.",
            "query": "SELECT customerName, COUNT(*) AS totalOrders FROM customers c JOIN orders o ON c.customerNumber = o.customerNumber GROUP BY customerName;"
        },
        {
            "input": "Retrieve the names of all customers who are located in 'USA'.",
            "query": "SELECT customerName FROM customers WHERE country = 'USA';"
        },
        {
            "input": "List the product codes and names of products that belong to the 'Classic Cars' product line.",
            "query": "SELECT productCode, productName FROM products WHERE productLine = 'Classic Cars';"
        },
        {
            "input": "Find the offices where the state is 'CA'.",
            "query": "SELECT officeCode, city FROM offices WHERE state = 'CA';"
        },
        {
            "input": "List the customer names along with the names of their sales representatives.",
            "query": "SELECT c.customerName, e.firstName, e.lastName FROM customers c INNER JOIN employees e ON c.salesRepEmployeeNumber = e.employeeNumber;"
        },
        {
            "input": "Retrieve the order numbers and product names for all orders.",
            "query": "SELECT o.orderNumber, p.productName FROM orders o INNER JOIN orderdetails od ON o.orderNumber = od.orderNumber INNER JOIN products p ON od.productCode = p.productCode;"
        },
        {
            "input": "List all customers and their orders, including those who have not placed any orders (LEFT JOIN).",
            "query": "SELECT c.customerName, o.orderNumber FROM customers c LEFT JOIN orders o ON c.customerNumber = o.customerNumber;"
        },
        {
            "input": "Find all orders and their corresponding customers, including orders without associated customers (RIGHT JOIN).",
            "query": "SELECT o.orderNumber, c.customerName FROM orders o RIGHT JOIN customers c ON o.customerNumber = c.customerNumber;"
        },
        {
            "input": "Return the number of employees in Paris.",
            "query": "SELECT COUNT(*) AS numberOfEmployees FROM employees e JOIN offices o ON e.officeCode = o.officeCode WHERE o.city = 'Paris';"
        }

    ]
}