query_id
int64 0
2.15k
| database_id
stringclasses 40
values | table_id
listlengths 1
4
| query
stringlengths 22
185
| answer
stringlengths 22
608
| difficulty
stringclasses 4
values |
---|---|---|---|---|---|
200 |
online_exams
|
[
"exams"
] |
What are the dates of the exams whose subject code contains the substring "data"? Return them in descending order of dates.
|
SELECT Exam_Date FROM Exams WHERE Subject_Code LIKE '%data%' ORDER BY Exam_Date DESC
|
hard
|
201 |
online_exams
|
[
"questions"
] |
What are the type of questions and their counts?
|
SELECT Type_of_Question_Code , COUNT(*) FROM Questions GROUP BY Type_of_Question_Code
|
medium
|
202 |
online_exams
|
[
"questions"
] |
For each question type, return its type code and its count of occurrence.
|
SELECT Type_of_Question_Code , COUNT(*) FROM Questions GROUP BY Type_of_Question_Code
|
medium
|
203 |
online_exams
|
[
"student_answers"
] |
What are the distinct student answer texts that received comments "Normal"?
|
SELECT DISTINCT Student_Answer_Text FROM Student_Answers WHERE Comments = "Normal"
|
easy
|
204 |
online_exams
|
[
"student_answers"
] |
List all the distinct student answer texts to which comments "Normal" were given?
|
SELECT DISTINCT Student_Answer_Text FROM Student_Answers WHERE Comments = "Normal"
|
easy
|
205 |
online_exams
|
[
"student_answers"
] |
How many different comments are there for student answers?
|
SELECT count(DISTINCT Comments) FROM Student_Answers
|
easy
|
206 |
online_exams
|
[
"student_answers"
] |
Count the number of different comments for student answers.
|
SELECT count(DISTINCT Comments) FROM Student_Answers
|
easy
|
207 |
online_exams
|
[
"student_answers"
] |
List all the student answer texts in descending order of count.
|
SELECT Student_Answer_Text FROM Student_Answers GROUP BY Student_Answer_Text ORDER BY COUNT(*) DESC
|
medium
|
208 |
online_exams
|
[
"student_answers"
] |
Sort the student answer texts in descending order of their frequency of occurrence.
|
SELECT Student_Answer_Text FROM Student_Answers GROUP BY Student_Answer_Text ORDER BY COUNT(*) DESC
|
medium
|
209 |
online_exams
|
[
"student_answers",
"students"
] |
Please show the first names of students and the dates of their answers.
|
SELECT T2.First_Name , T1.Date_of_Answer FROM Student_Answers AS T1 JOIN Students AS T2 ON T1.Student_ID = T2.Student_ID
|
medium
|
210 |
online_exams
|
[
"student_answers",
"students"
] |
For each student answer, find the first name of the student and the date of the answer.
|
SELECT T2.First_Name , T1.Date_of_Answer FROM Student_Answers AS T1 JOIN Students AS T2 ON T1.Student_ID = T2.Student_ID
|
medium
|
211 |
online_exams
|
[
"student_answers",
"students"
] |
Please show the email addresses of students and the dates of their answers in descending order of dates.
|
SELECT T2.Email_Adress , T1.Date_of_Answer FROM Student_Answers AS T1 JOIN Students AS T2 ON T1.Student_ID = T2.Student_ID ORDER BY T1.Date_of_Answer DESC
|
medium
|
212 |
online_exams
|
[
"student_answers",
"students"
] |
For each student answer, find the email address of the student and the date of the answer. Sort them in descending order of dates.
|
SELECT T2.Email_Adress , T1.Date_of_Answer FROM Student_Answers AS T1 JOIN Students AS T2 ON T1.Student_ID = T2.Student_ID ORDER BY T1.Date_of_Answer DESC
|
medium
|
213 |
online_exams
|
[
"student_assessments"
] |
Please show the least common assessment for students.
|
SELECT Assessment FROM Student_Assessments GROUP BY Assessment ORDER BY COUNT(*) ASC LIMIT 1
|
hard
|
214 |
online_exams
|
[
"student_assessments"
] |
Which assessment has the smallest frequency count?
|
SELECT Assessment FROM Student_Assessments GROUP BY Assessment ORDER BY COUNT(*) ASC LIMIT 1
|
hard
|
215 |
online_exams
|
[
"student_answers",
"students"
] |
Please show the first names of the students that have at least two answer records.
|
SELECT T2.First_Name FROM Student_Answers AS T1 JOIN Students AS T2 ON T1.Student_ID = T2.Student_ID GROUP BY T1.Student_ID HAVING COUNT(*) >= 2
|
medium
|
216 |
online_exams
|
[
"student_answers",
"students"
] |
Which students have 2 or more answer records? Give me their first names.
|
SELECT T2.First_Name FROM Student_Answers AS T1 JOIN Students AS T2 ON T1.Student_ID = T2.Student_ID GROUP BY T1.Student_ID HAVING COUNT(*) >= 2
|
medium
|
217 |
online_exams
|
[
"valid_answers"
] |
What is the most common valid answer text?
|
SELECT Valid_Answer_Text FROM Valid_Answers GROUP BY Valid_Answer_Text ORDER BY COUNT(*) DESC LIMIT 1
|
hard
|
218 |
online_exams
|
[
"valid_answers"
] |
Find the valid answer text that appeared most frequently.
|
SELECT Valid_Answer_Text FROM Valid_Answers GROUP BY Valid_Answer_Text ORDER BY COUNT(*) DESC LIMIT 1
|
hard
|
219 |
online_exams
|
[
"students"
] |
List the last names of the students whose gender is not "M".
|
SELECT Last_Name FROM Students WHERE Gender_MFU != "M"
|
easy
|
220 |
online_exams
|
[
"students"
] |
What are the last names of the students with gender other than "M"?
|
SELECT Last_Name FROM Students WHERE Gender_MFU != "M"
|
easy
|
221 |
online_exams
|
[
"students"
] |
List each gender and the corresponding number of students.
|
SELECT Gender_MFU , COUNT(*) FROM Students GROUP BY Gender_MFU
|
medium
|
222 |
online_exams
|
[
"students"
] |
For each gender, return the gender code and the number of students who identify as that gender.
|
SELECT Gender_MFU , COUNT(*) FROM Students GROUP BY Gender_MFU
|
medium
|
223 |
online_exams
|
[
"students"
] |
List the last names of the students whose gender is "F" or "M".
|
SELECT Last_Name FROM Students WHERE Gender_MFU = "F" OR Gender_MFU = "M"
|
medium
|
224 |
online_exams
|
[
"students"
] |
Which students identify their gender as "F" or "M"? Give me their last names.
|
SELECT Last_Name FROM Students WHERE Gender_MFU = "F" OR Gender_MFU = "M"
|
medium
|
225 |
online_exams
|
[
"student_answers",
"students"
] |
List the first names of the students who do not have any answers.
|
SELECT First_Name FROM Students WHERE Student_ID NOT IN (SELECT Student_ID FROM Student_Answers)
|
hard
|
226 |
online_exams
|
[
"student_answers",
"students"
] |
Which students do not have any answers? Find their first names.
|
SELECT First_Name FROM Students WHERE Student_ID NOT IN (SELECT Student_ID FROM Student_Answers)
|
hard
|
227 |
online_exams
|
[
"student_answers"
] |
Show the student answer texts that received both "Normal" and "Absent" as comments.
|
SELECT Student_Answer_Text FROM Student_Answers WHERE Comments = "Normal" INTERSECT SELECT Student_Answer_Text FROM Student_Answers WHERE Comments = "Absent"
|
hard
|
228 |
online_exams
|
[
"student_answers"
] |
Which student answer texts were given both "Normal" and "Absent" as comments?
|
SELECT Student_Answer_Text FROM Student_Answers WHERE Comments = "Normal" INTERSECT SELECT Student_Answer_Text FROM Student_Answers WHERE Comments = "Absent"
|
hard
|
229 |
online_exams
|
[
"questions"
] |
Show the types of questions that have at least three questions.
|
SELECT Type_of_Question_Code FROM Questions GROUP BY Type_of_Question_Code HAVING count(*) >= 3
|
easy
|
230 |
online_exams
|
[
"questions"
] |
Which types of questions have 3 or more questions? Return the questions type code.
|
SELECT Type_of_Question_Code FROM Questions GROUP BY Type_of_Question_Code HAVING count(*) >= 3
|
easy
|
231 |
online_exams
|
[
"students"
] |
Show all information on students.
|
SELECT * FROM Students
|
easy
|
232 |
online_exams
|
[
"students"
] |
What is al the available information of each student?
|
SELECT * FROM Students
|
easy
|
233 |
customers_and_orders
|
[
"addresses"
] |
How many addresses do we have?
|
SELECT count(*) FROM Addresses
|
easy
|
234 |
customers_and_orders
|
[
"addresses"
] |
Count the number of addresses.
|
SELECT count(*) FROM Addresses
|
easy
|
235 |
customers_and_orders
|
[
"addresses"
] |
List all address ids and address details.
|
SELECT address_id , address_details FROM Addresses
|
medium
|
236 |
customers_and_orders
|
[
"addresses"
] |
What are all the address ids and address details?
|
SELECT address_id , address_details FROM Addresses
|
medium
|
237 |
customers_and_orders
|
[
"products"
] |
How many products do we have?
|
SELECT count(*) FROM Products
|
easy
|
238 |
customers_and_orders
|
[
"products"
] |
Count the number of products.
|
SELECT count(*) FROM Products
|
easy
|
239 |
customers_and_orders
|
[
"products"
] |
Show all product ids, product type codes, and product name.
|
SELECT product_id , product_type_code , product_name FROM Products
|
medium
|
240 |
customers_and_orders
|
[
"products"
] |
What are the ids, type codes, and names for all products?
|
SELECT product_id , product_type_code , product_name FROM Products
|
medium
|
241 |
customers_and_orders
|
[
"products"
] |
What is the price for the product with name Monitor?
|
SELECT product_price FROM Products WHERE product_name = "Monitor"
|
easy
|
242 |
customers_and_orders
|
[
"products"
] |
Give the price of the Monitor product.
|
SELECT product_price FROM Products WHERE product_name = "Monitor"
|
easy
|
243 |
customers_and_orders
|
[
"products"
] |
Show the minimum, average, maximum price for all products.
|
SELECT min(product_price) , avg(product_price) , max(product_price) FROM Products
|
medium
|
244 |
customers_and_orders
|
[
"products"
] |
What are the minimum, average, and maximum prices across all products?
|
SELECT min(product_price) , avg(product_price) , max(product_price) FROM Products
|
medium
|
245 |
customers_and_orders
|
[
"products"
] |
What is the average price for products with type Clothes?
|
SELECT avg(product_price) FROM Products WHERE product_type_code = "Clothes"
|
easy
|
246 |
customers_and_orders
|
[
"products"
] |
Return the average price of Clothes.
|
SELECT avg(product_price) FROM Products WHERE product_type_code = "Clothes"
|
easy
|
247 |
customers_and_orders
|
[
"products"
] |
How many hardware type products do we have?
|
SELECT count(*) FROM Products WHERE product_type_code = "Hardware"
|
easy
|
248 |
customers_and_orders
|
[
"products"
] |
Count the number of products of the type Hardware.
|
SELECT count(*) FROM Products WHERE product_type_code = "Hardware"
|
easy
|
249 |
customers_and_orders
|
[
"products"
] |
Show all product names with price higher than the average.
|
SELECT product_name FROM Products WHERE product_price > (SELECT avg(product_price) FROM Products)
|
hard
|
250 |
customers_and_orders
|
[
"products"
] |
What are the names of products that have a price above the average for all products.
|
SELECT product_name FROM Products WHERE product_price > (SELECT avg(product_price) FROM Products)
|
hard
|
251 |
customers_and_orders
|
[
"products"
] |
Show all hardware product names with price higher than the average price of hardware type products.
|
SELECT product_name FROM Products WHERE product_type_code = "Hardware" AND product_price > (SELECT avg(product_price) FROM Products WHERE product_type_code = "Hardware")
|
extra
|
252 |
customers_and_orders
|
[
"products"
] |
What are the names of Hardware product with prices above the average price of Hardware products.
|
SELECT product_name FROM Products WHERE product_type_code = "Hardware" AND product_price > (SELECT avg(product_price) FROM Products WHERE product_type_code = "Hardware")
|
extra
|
253 |
customers_and_orders
|
[
"products"
] |
What is the name of the most expensive product with type Clothes?
|
SELECT product_name FROM Products WHERE product_type_code = "Clothes" ORDER BY product_price DESC LIMIT 1
|
hard
|
254 |
customers_and_orders
|
[
"products"
] |
Give the name of the most expensive Clothes product.
|
SELECT product_name FROM Products WHERE product_type_code = "Clothes" ORDER BY product_price DESC LIMIT 1
|
hard
|
255 |
customers_and_orders
|
[
"products"
] |
What is the product id and product name for the cheapest Hardware type product?
|
SELECT product_id , product_name FROM Products WHERE product_type_code = "Hardware" ORDER BY product_price ASC LIMIT 1
|
hard
|
256 |
customers_and_orders
|
[
"products"
] |
Give the id and name of the cheapest Hardware product.
|
SELECT product_id , product_name FROM Products WHERE product_type_code = "Hardware" ORDER BY product_price ASC LIMIT 1
|
hard
|
257 |
customers_and_orders
|
[
"products"
] |
List all product names in descending order of price.
|
SELECT product_name FROM Products ORDER BY product_price DESC
|
easy
|
258 |
customers_and_orders
|
[
"products"
] |
What are the names of the products, sorted by descending price?
|
SELECT product_name FROM Products ORDER BY product_price DESC
|
easy
|
259 |
customers_and_orders
|
[
"products"
] |
Show all hardware type products in ascending order of price.
|
SELECT product_name FROM Products WHERE product_type_code = "Hardware" ORDER BY product_price ASC
|
medium
|
260 |
customers_and_orders
|
[
"products"
] |
What are the names of all Hardware products, sorted by price ascending?
|
SELECT product_name FROM Products WHERE product_type_code = "Hardware" ORDER BY product_price ASC
|
medium
|
261 |
customers_and_orders
|
[
"products"
] |
List all product type codes and the number of products in each type.
|
SELECT product_type_code , count(*) FROM Products GROUP BY product_type_code
|
medium
|
262 |
customers_and_orders
|
[
"products"
] |
How many products are there for each product type?
|
SELECT product_type_code , count(*) FROM Products GROUP BY product_type_code
|
medium
|
263 |
customers_and_orders
|
[
"products"
] |
Show all product type codes and the average price for each type.
|
SELECT product_type_code , avg(product_price) FROM Products GROUP BY product_type_code
|
medium
|
264 |
customers_and_orders
|
[
"products"
] |
What is the average price of products for each product type?
|
SELECT product_type_code , avg(product_price) FROM Products GROUP BY product_type_code
|
medium
|
265 |
customers_and_orders
|
[
"products"
] |
What are the product type code with at least two products?
|
SELECT product_type_code FROM Products GROUP BY product_type_code HAVING count(*) >= 2
|
easy
|
266 |
customers_and_orders
|
[
"products"
] |
Give the product type codes of product types that have two or more products.
|
SELECT product_type_code FROM Products GROUP BY product_type_code HAVING count(*) >= 2
|
easy
|
267 |
customers_and_orders
|
[
"products"
] |
What is the product type code with most number of products?
|
SELECT product_type_code FROM Products GROUP BY product_type_code ORDER BY count(*) DESC LIMIT 1
|
hard
|
268 |
customers_and_orders
|
[
"products"
] |
What is the most frequent product type code?
|
SELECT product_type_code FROM Products GROUP BY product_type_code ORDER BY count(*) DESC LIMIT 1
|
hard
|
269 |
customers_and_orders
|
[
"customers"
] |
How many customers do we have?
|
SELECT count(*) FROM Customers
|
easy
|
270 |
customers_and_orders
|
[
"customers"
] |
Count the number of customers.
|
SELECT count(*) FROM Customers
|
easy
|
271 |
customers_and_orders
|
[
"customers"
] |
Show all customer ids and customer names.
|
SELECT customer_id , customer_name FROM Customers
|
medium
|
272 |
customers_and_orders
|
[
"customers"
] |
What are the ids and names of all customers?
|
SELECT customer_id , customer_name FROM Customers
|
medium
|
273 |
customers_and_orders
|
[
"customers"
] |
What is the customer address, customer phone, and customer email for Jeromy?
|
SELECT customer_address , customer_phone , customer_email FROM Customers WHERE customer_name = "Jeromy"
|
medium
|
274 |
customers_and_orders
|
[
"customers"
] |
Give the address, phone, and email for customers with the name Jeromy.
|
SELECT customer_address , customer_phone , customer_email FROM Customers WHERE customer_name = "Jeromy"
|
medium
|
275 |
customers_and_orders
|
[
"customers"
] |
Show all payment method codes and the number of customers in each code.
|
SELECT payment_method_code , count(*) FROM Customers GROUP BY payment_method_code
|
medium
|
276 |
customers_and_orders
|
[
"customers"
] |
How many customers use each payment method?
|
SELECT payment_method_code , count(*) FROM Customers GROUP BY payment_method_code
|
medium
|
277 |
customers_and_orders
|
[
"customers"
] |
What is the payment method code used by most number of customers?
|
SELECT payment_method_code FROM Customers GROUP BY payment_method_code ORDER BY count(*) DESC LIMIT 1
|
hard
|
278 |
customers_and_orders
|
[
"customers"
] |
Give the code of the payment method that is most commonly used.
|
SELECT payment_method_code FROM Customers GROUP BY payment_method_code ORDER BY count(*) DESC LIMIT 1
|
hard
|
279 |
customers_and_orders
|
[
"customers"
] |
Show all customer names with the payment method code used by least number of customers.
|
SELECT customer_name FROM Customers WHERE payment_method_code = ( SELECT payment_method_code FROM Customers GROUP BY payment_method_code ORDER BY count(*) ASC LIMIT 1)
|
hard
|
280 |
customers_and_orders
|
[
"customers"
] |
What are the names of customers who use the least common payment method?
|
SELECT customer_name FROM Customers WHERE payment_method_code = ( SELECT payment_method_code FROM Customers GROUP BY payment_method_code ORDER BY count(*) ASC LIMIT 1)
|
hard
|
281 |
customers_and_orders
|
[
"customers"
] |
What is the payment method and customer number for customer named Jeromy?
|
SELECT payment_method_code , customer_number FROM Customers WHERE customer_name = "Jeromy"
|
medium
|
282 |
customers_and_orders
|
[
"customers"
] |
Give the payment method code and customer number corresponding to the customer named Jeromy.
|
SELECT payment_method_code , customer_number FROM Customers WHERE customer_name = "Jeromy"
|
medium
|
283 |
customers_and_orders
|
[
"customers"
] |
What are the distinct payment methods used by customers?
|
SELECT DISTINCT payment_method_code FROM Customers
|
easy
|
284 |
customers_and_orders
|
[
"customers"
] |
Give the different payment method codes that customers use.
|
SELECT DISTINCT payment_method_code FROM Customers
|
easy
|
285 |
customers_and_orders
|
[
"products"
] |
Show the id and the product type for all products, order by product name.
|
SELECT product_id , product_type_code FROM Products ORDER BY product_name
|
medium
|
286 |
customers_and_orders
|
[
"products"
] |
What are the ids and product types for all products, sorted alphabetically by product name?
|
SELECT product_id , product_type_code FROM Products ORDER BY product_name
|
medium
|
287 |
customers_and_orders
|
[
"products"
] |
What is the product type with least number of products?
|
SELECT product_type_code FROM Products GROUP BY product_type_code ORDER BY count(*) ASC LIMIT 1
|
hard
|
288 |
customers_and_orders
|
[
"products"
] |
What is the code of the product type that is least common?
|
SELECT product_type_code FROM Products GROUP BY product_type_code ORDER BY count(*) ASC LIMIT 1
|
hard
|
289 |
customers_and_orders
|
[
"customer_orders"
] |
How many customer orders do we have?
|
SELECT count(*) FROM Customer_orders
|
easy
|
290 |
customers_and_orders
|
[
"customer_orders"
] |
Count the number of customer orders.
|
SELECT count(*) FROM Customer_orders
|
easy
|
291 |
customers_and_orders
|
[
"customer_orders",
"customers"
] |
Show the order ids, order dates, and order status codes for all orders by customer Jeromy.
|
SELECT order_id , order_date , order_status_code FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_name = "Jeromy"
|
medium
|
292 |
customers_and_orders
|
[
"customer_orders",
"customers"
] |
What were the ids, dates, and status codes for orders made by Jeromy?
|
SELECT order_id , order_date , order_status_code FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_name = "Jeromy"
|
medium
|
293 |
customers_and_orders
|
[
"customer_orders",
"customers"
] |
Show all customer names, ids and the number of orders by each customer.
|
SELECT T2.customer_name , T1.customer_id , count(*) FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
|
medium
|
294 |
customers_and_orders
|
[
"customer_orders",
"customers"
] |
What are the names, ids, and number of orders made for each customer?
|
SELECT T2.customer_name , T1.customer_id , count(*) FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
|
medium
|
295 |
customers_and_orders
|
[
"customer_orders",
"customers"
] |
What is the customer id, name, phone, and email for the customer with most orders?
|
SELECT T1.customer_id , T2.customer_name , T2.customer_phone , T2.customer_email FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
|
extra
|
296 |
customers_and_orders
|
[
"customer_orders",
"customers"
] |
Give the id, name, phone, and email corresponding to the customer who made the most orders.
|
SELECT T1.customer_id , T2.customer_name , T2.customer_phone , T2.customer_email FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
|
extra
|
297 |
customers_and_orders
|
[
"customer_orders"
] |
Show all order status and the number of orders in each status.
|
SELECT order_status_code , count(*) FROM Customer_orders GROUP BY order_status_code
|
medium
|
298 |
customers_and_orders
|
[
"customer_orders"
] |
How many orders have each order status code?
|
SELECT order_status_code , count(*) FROM Customer_orders GROUP BY order_status_code
|
medium
|
299 |
customers_and_orders
|
[
"customer_orders"
] |
What is the order status code that is most common?
|
SELECT order_status_code FROM Customer_orders GROUP BY order_status_code ORDER BY count(*) DESC LIMIT 1
|
hard
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.