question
string
answer
string
context
string
dialect
string
spider_hardness
string
extended_hardness
string
classification_status
string
syntax_status
string
ddl_syntax_status
string
schema_status
string
syntax_errors
list
ddl_syntax_errors
list
schema_errors
list
classification_errors
list
status_history
list
correction_status
string
component1
int64
component2
int64
others
int64
validation_source
dict
Give me a list of distinct product ids from orders placed between 1975-01-01 and 1976-01-01?
SELECT DISTINCT T2.product_id FROM orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id WHERE T1.date_order_placed >= '1975-01-01' AND T1.date_order_placed <= '1976-01-01'
CREATE TABLE order_items (product_id VARCHAR(255), order_id VARCHAR(255)); CREATE TABLE orders (order_id VARCHAR(255), date_order_placed VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3905 }
Find the names of the customers who have order status both "On Road" and "Shipped".
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'On Road' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'Shipped'
CREATE TABLE orders (customer_id VARCHAR(255), order_status VARCHAR(255)); CREATE TABLE customers (customer_name VARCHAR(255), customer_id VARCHAR(255))
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
1
0
{ "split": "train", "row_index": 3906 }
Find the id of the customers who have order status both "On Road" and "Shipped".
SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'On Road' INTERSECT SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'Shipped'
CREATE TABLE customers (customer_id VARCHAR(255), customer_name VARCHAR(255)); CREATE TABLE orders (customer_id VARCHAR(255), order_status VARCHAR(255))
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
1
0
{ "split": "train", "row_index": 3907 }
When was the order placed whose shipment tracking number is 3452? Give me the date.
SELECT T1.date_order_placed FROM orders AS T1 JOIN shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.shipment_tracking_number = 3452
CREATE TABLE shipments (order_id VARCHAR(255), shipment_tracking_number VARCHAR(255)); CREATE TABLE orders (date_order_placed VARCHAR(255), order_id VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
0
{ "split": "train", "row_index": 3908 }
What is the placement date of the order whose invoice number is 10?
SELECT T1.date_order_placed FROM orders AS T1 JOIN shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.invoice_number = 10
CREATE TABLE orders (date_order_placed VARCHAR(255), order_id VARCHAR(255)); CREATE TABLE shipments (order_id VARCHAR(255), invoice_number VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
0
{ "split": "train", "row_index": 3909 }
List the count and id of each product in all the orders.
SELECT COUNT(*), T3.product_id FROM orders AS T1 JOIN order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id
CREATE TABLE orders (order_id VARCHAR(255), date_order_placed VARCHAR(255)); CREATE TABLE order_items (order_id VARCHAR(255), product_id VARCHAR(255)); CREATE TABLE products (product_id VARCHAR(255), product_name VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
0
1
{ "split": "train", "row_index": 3910 }
List the name and count of each product in all orders.
SELECT T3.product_name, COUNT(*) FROM orders AS T1 JOIN order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id
CREATE TABLE orders (order_id VARCHAR(255), date_order_placed VARCHAR(255)); CREATE TABLE products (product_name VARCHAR(255), product_id VARCHAR(255)); CREATE TABLE order_items (order_id VARCHAR(255), product_id VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
0
1
{ "split": "train", "row_index": 3911 }
Find the ids of orders which are shipped after 2000-01-01.
SELECT order_id FROM shipments WHERE shipment_date > '2000-01-01'
CREATE TABLE shipments (order_id VARCHAR(255), shipment_date INTEGER)
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
0
{ "split": "train", "row_index": 3912 }
Find the id of the order which is shipped most recently.
SELECT order_id FROM shipments WHERE shipment_date = (SELECT MAX(shipment_date) FROM shipments)
CREATE TABLE shipments (order_id VARCHAR(255), shipment_date INTEGER)
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
1
0
{ "split": "train", "row_index": 3913 }
List the names of all distinct products in alphabetical order.
SELECT DISTINCT product_name FROM products ORDER BY product_name
CREATE TABLE products (product_name VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
0
{ "split": "train", "row_index": 3914 }
List the ids of all distinct orders ordered by placed date.
SELECT DISTINCT order_id FROM orders ORDER BY date_order_placed
CREATE TABLE orders (order_id VARCHAR(255), date_order_placed VARCHAR(255))
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
0
{ "split": "train", "row_index": 3915 }
What is the id of the order which has the most items?
SELECT T1.order_id FROM orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id GROUP BY T1.order_id ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE orders (order_id VARCHAR(255), date_order_placed VARCHAR(255)); CREATE TABLE order_items (order_id VARCHAR(255), product_id VARCHAR(255))
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
4
0
0
{ "split": "train", "row_index": 3916 }
Find the invoice numbers which are created before 1989-09-03 or after 2007-12-25.
SELECT invoice_number FROM invoices WHERE invoice_date < '1989-09-03' OR invoice_date > '2007-12-25'
CREATE TABLE invoices (invoice_number VARCHAR(255), invoice_date VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3917 }
Find the distinct details of invoices which are created before 1989-09-03 or after 2007-12-25.
SELECT DISTINCT invoice_details FROM invoices WHERE invoice_date < '1989-09-03' OR invoice_date > '2007-12-25'
CREATE TABLE invoices (invoice_details VARCHAR(255), invoice_date VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3918 }
For each customer who has at least two orders, find the customer name and number of orders made.
SELECT T2.customer_name, COUNT(*) FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING COUNT(*) >= 2
CREATE TABLE orders (customer_id VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT); CREATE TABLE customers (customer_name VARCHAR(255), customer_id VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3919 }
Find the name of the customers who have at most two orders.
SELECT T2.customer_name FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING COUNT(*) <= 2
CREATE TABLE orders (customer_id VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT); CREATE TABLE customers (customer_name VARCHAR(255), customer_id VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
0
{ "split": "train", "row_index": 3920 }
List the names of the customers who have once bought product "food".
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T4.product_name = 'food' GROUP BY T1.customer_id HAVING COUNT(*) >= 1
CREATE TABLE products (product_name VARCHAR(255), product_id VARCHAR(255)); CREATE TABLE orders (customer_id VARCHAR(255), order_id VARCHAR(255)); CREATE TABLE customers (customer_name VARCHAR(255), customer_id VARCHAR(255)); CREATE TABLE order_items (product_id VARCHAR(255), order_id VARCHAR(255))
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
5
0
0
{ "split": "train", "row_index": 3921 }
List the names of customers who have once canceled the purchase of the product "food" (the item status is "Cancel").
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T3.order_item_status = 'Cancel' AND T4.product_name = 'food' GROUP BY T1.customer_id HAVING COUNT(*) >= 1
CREATE TABLE orders (customer_id VARCHAR(255), order_id VARCHAR(255)); CREATE TABLE customers (customer_name VARCHAR(255), customer_id VARCHAR(255)); CREATE TABLE products (product_id VARCHAR(255), product_name VARCHAR(255)); CREATE TABLE order_items (product_id VARCHAR(255), order_item_status VARCHAR(255), order_id VA...
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
5
0
1
{ "split": "train", "row_index": 3922 }
How many architects are female?
SELECT COUNT(*) FROM architect WHERE gender = 'female'
CREATE TABLE architect (gender VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
0
{ "split": "train", "row_index": 3923 }
List the name, nationality and id of all male architects ordered by their names lexicographically.
SELECT name, nationality, id FROM architect WHERE gender = 'male' ORDER BY name
CREATE TABLE architect (name VARCHAR(255), nationality VARCHAR(255), id VARCHAR(255), gender VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3924 }
What is the maximum length in meters for the bridges and what are the architects' names?
SELECT MAX(T1.length_meters), T2.name FROM bridge AS T1 JOIN architect AS T2 ON T1.architect_id = T2.id
CREATE TABLE architect (name VARCHAR(255), id VARCHAR(255)); CREATE TABLE bridge (length_meters INTEGER, architect_id VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 3925 }
What is the average length in feet of the bridges?
SELECT AVG(length_feet) FROM bridge
CREATE TABLE bridge (length_feet INTEGER, id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
0
0
0
{ "split": "train", "row_index": 3926 }
What are the names and year of construction for the mills of 'Grondzeiler' type?
SELECT name, built_year FROM mill WHERE TYPE = 'Grondzeiler'
CREATE TABLE mill (name VARCHAR(255), built_year VARCHAR(255), TYPE VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 3927 }
What are the names of the mills which are not located in 'Donceel'?
SELECT name FROM mill WHERE LOCATION <> 'Donceel'
CREATE TABLE mill (name VARCHAR(255), LOCATION VARCHAR(255))
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
0
{ "split": "train", "row_index": 3929 }
What are the ids and names of the architects who built at least 3 bridges ?
SELECT T1.id, T1.name FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING COUNT(*) >= 3
CREATE TABLE architect (id VARCHAR(255), name VARCHAR(255)); CREATE TABLE bridge (architect_id VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3931 }
What is the id, name and nationality of the architect who built most mills?
SELECT T1.id, T1.name, T1.nationality FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE architect (id VARCHAR(255), name VARCHAR(255), nationality VARCHAR(255)); CREATE TABLE mill (architect_id VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
4
0
1
{ "split": "train", "row_index": 3932 }
What are the ids, names and genders of the architects who built two bridges or one mill?
SELECT T1.id, T1.name, T1.gender FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING COUNT(*) = 2 UNION SELECT T1.id, T1.name, T1.gender FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING COUNT(*) = 1
CREATE TABLE mill (architect_id VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT); CREATE TABLE architect (id VARCHAR(255), name VARCHAR(255), gender VARCHAR(255)); CREATE TABLE bridge (architect_id VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
1
1
{ "split": "train", "row_index": 3933 }
What is the location of the bridge named 'Kolob Arch' or 'Rainbow Bridge'?
SELECT LOCATION FROM bridge WHERE name = 'Kolob Arch' OR name = 'Rainbow Bridge'
CREATE TABLE bridge (LOCATION VARCHAR(255), name VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3934 }
Which of the mill names contains the french word 'Moulin'?
SELECT name FROM mill WHERE name LIKE '%Moulin%'
CREATE TABLE mill (name VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
0
{ "split": "train", "row_index": 3935 }
What are the distinct name of the mills built by the architects who have also built a bridge longer than 80 meters?
SELECT DISTINCT T1.name FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id JOIN bridge AS T3 ON T3.architect_id = T2.id WHERE T3.length_meters > 80
CREATE TABLE architect (Id VARCHAR(255), name VARCHAR(255)); CREATE TABLE mill (name VARCHAR(255), architect_id VARCHAR(255)); CREATE TABLE bridge (architect_id VARCHAR(255), length_meters INTEGER)
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
0
0
{ "split": "train", "row_index": 3936 }
What is the most common mill type, and how many are there?
SELECT TYPE, COUNT(*) FROM mill GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE mill (TYPE VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
0
2
{ "split": "train", "row_index": 3937 }
How many architects haven't built a mill before year 1850?
SELECT COUNT(*) FROM architect WHERE NOT id IN (SELECT architect_id FROM mill WHERE built_year < 1850)
CREATE TABLE mill (id VARCHAR(255), architect_id VARCHAR(255), built_year INTEGER); CREATE TABLE architect (id VARCHAR(255), architect_id VARCHAR(255), built_year INTEGER)
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
1
1
{ "split": "train", "row_index": 3938 }
show the name of all bridges that was designed by american archtect, and sort the result by the bridge feet length.
SELECT t1.name FROM bridge AS t1 JOIN architect AS t2 ON t1.architect_id = t2.id WHERE t2.nationality = 'American' ORDER BY t1.length_feet
CREATE TABLE bridge (name VARCHAR(255), architect_id VARCHAR(255), length_feet VARCHAR(255)); CREATE TABLE architect (id VARCHAR(255), nationality VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
0
0
{ "split": "train", "row_index": 3939 }
How many book clubs are there?
SELECT COUNT(*) FROM book_club
CREATE TABLE book_club (Id VARCHAR(255), club_name VARCHAR(255))
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
0
0
0
{ "split": "train", "row_index": 3940 }
show the titles, and authors or editors for all books made after the year 1989.
SELECT book_title, author_or_editor FROM book_club WHERE YEAR > 1989
CREATE TABLE book_club (book_title VARCHAR(255), author_or_editor VARCHAR(255), YEAR INTEGER)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 3941 }
Show all distinct publishers for books.
SELECT DISTINCT publisher FROM book_club
CREATE TABLE book_club (publisher VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
0
0
0
{ "split": "train", "row_index": 3942 }
Show the years, book titles, and publishers for all books, in descending order by year.
SELECT YEAR, book_title, publisher FROM book_club ORDER BY YEAR DESC
CREATE TABLE book_club (YEAR VARCHAR(255), book_title VARCHAR(255), publisher VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 3943 }
Show all publishers and the number of books for each publisher.
SELECT publisher, COUNT(*) FROM book_club GROUP BY publisher
CREATE TABLE book_club (publisher VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 3944 }
What is the publisher with most number of books?
SELECT publisher FROM book_club GROUP BY publisher ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE book_club (publisher VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
0
0
{ "split": "train", "row_index": 3945 }
Show all book categories and the number of books in each category.
SELECT category, COUNT(*) FROM book_club GROUP BY category
CREATE TABLE book_club (category VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 3946 }
List categories that have at least two books after year 1989.
SELECT category FROM book_club WHERE YEAR > 1989 GROUP BY category HAVING COUNT(*) >= 2
CREATE TABLE book_club (category VARCHAR(255), YEAR INTEGER)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
0
{ "split": "train", "row_index": 3947 }
Show publishers with a book published in 1989 and a book in 1990.
SELECT publisher FROM book_club WHERE YEAR = 1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR = 1990
CREATE TABLE book_club (publisher VARCHAR(255), YEAR VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
1
0
{ "split": "train", "row_index": 3948 }
Show all publishers which do not have a book in 1989.
SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR = 1989
CREATE TABLE book_club (publisher VARCHAR(255), YEAR VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
0
1
0
{ "split": "train", "row_index": 3949 }
Show all movie titles, years, and directors, ordered by budget.
SELECT title, YEAR, director FROM movie ORDER BY budget_million
CREATE TABLE movie (title VARCHAR(255), YEAR VARCHAR(255), director VARCHAR(255), budget_million VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 3950 }
How many movie directors are there?
SELECT COUNT(DISTINCT director) FROM movie
CREATE TABLE movie (director VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
0
0
0
{ "split": "train", "row_index": 3951 }
What is the title and director for the movie with highest worldwide gross in the year 2000 or before?
SELECT title, director FROM movie WHERE YEAR <= 2000 ORDER BY gross_worldwide DESC LIMIT 1
CREATE TABLE movie (title VARCHAR(255), director VARCHAR(255), YEAR VARCHAR(255), gross_worldwide VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
0
1
{ "split": "train", "row_index": 3952 }
Show all director names who have a movie in both year 1999 and 2000.
SELECT director FROM movie WHERE YEAR = 2000 INTERSECT SELECT director FROM movie WHERE YEAR = 1999
CREATE TABLE movie (director VARCHAR(255), YEAR VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
1
0
{ "split": "train", "row_index": 3953 }
Show all director names who have a movie in the year 1999 or 2000.
SELECT director FROM movie WHERE YEAR = 1999 OR YEAR = 2000
CREATE TABLE movie (director VARCHAR(255), YEAR VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3954 }
List all company names with a book published by Alyson.
SELECT T1.company_name FROM culture_company AS T1 JOIN book_club AS T2 ON T1.book_club_id = T2.book_club_id WHERE T2.publisher = 'Alyson'
CREATE TABLE culture_company (company_name VARCHAR(255), book_club_id VARCHAR(255)); CREATE TABLE book_club (book_club_id VARCHAR(255), publisher VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
0
{ "split": "train", "row_index": 3956 }
Show the movie titles and book titles for all companies in China.
SELECT T1.title, T3.book_title FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id JOIN book_club AS T3 ON T3.book_club_id = T2.book_club_id WHERE T2.incorporated_in = 'China'
CREATE TABLE movie (title VARCHAR(255), movie_id VARCHAR(255)); CREATE TABLE culture_company (movie_id VARCHAR(255), book_club_id VARCHAR(255), incorporated_in VARCHAR(255)); CREATE TABLE book_club (book_title VARCHAR(255), book_club_id VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
0
1
{ "split": "train", "row_index": 3957 }
Show all company names with a movie directed in year 1999.
SELECT T2.company_name FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id WHERE T1.year = 1999
CREATE TABLE movie (movie_id VARCHAR(255), year VARCHAR(255)); CREATE TABLE culture_company (company_name VARCHAR(255), movie_id VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
0
{ "split": "train", "row_index": 3958 }
How many singers do we have?
SELECT COUNT(*) FROM singer
CREATE TABLE singer (Id VARCHAR(255), name VARCHAR(255))
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
0
0
0
{ "split": "train", "row_index": 3959 }
Show name, country, age for all singers ordered by age from the oldest to the youngest.
SELECT name, country, age FROM singer ORDER BY age DESC
CREATE TABLE singer (name VARCHAR(255), country VARCHAR(255), age VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 3960 }
What is the average, minimum, and maximum age of all singers from France?
SELECT AVG(age), MIN(age), MAX(age) FROM singer WHERE country = 'France'
CREATE TABLE singer (age INTEGER, country VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
2
{ "split": "train", "row_index": 3961 }
Show the name and the release year of the song by the youngest singer.
SELECT song_name, song_release_year FROM singer ORDER BY age LIMIT 1
CREATE TABLE singer (song_name VARCHAR(255), song_release_year VARCHAR(255), age VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3962 }
What are all distinct countries where singers above age 20 are from?
SELECT DISTINCT country FROM singer WHERE age > 20
CREATE TABLE singer (country VARCHAR(255), age INTEGER)
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
0
{ "split": "train", "row_index": 3963 }
Show all countries and the number of singers in each country.
SELECT country, COUNT(*) FROM singer GROUP BY country
CREATE TABLE singer (country VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 3964 }
List all song names by singers above the average age.
SELECT song_name FROM singer WHERE age > (SELECT AVG(age) FROM singer)
CREATE TABLE singer (song_name VARCHAR(255), age INTEGER)
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
1
0
{ "split": "train", "row_index": 3965 }
Show location and name for all stadiums with a capacity between 5000 and 10000.
SELECT LOCATION, name FROM stadium WHERE capacity BETWEEN 5000 AND 10000
CREATE TABLE stadium (LOCATION VARCHAR(255), name VARCHAR(255), capacity INTEGER)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 3966 }
What is the maximum capacity and the average of all stadiums ?
SELECT MAX(capacity), average FROM stadium
CREATE TABLE stadium (average VARCHAR(255), capacity INTEGER)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
0
0
1
{ "split": "train", "row_index": 3967 }
What is the average and maximum capacities for all stadiums ?
SELECT AVG(capacity), MAX(capacity) FROM stadium
CREATE TABLE stadium (capacity INTEGER, id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
0
0
2
{ "split": "train", "row_index": 3968 }
What is the name and capacity for the stadium with highest average attendance?
SELECT name, capacity FROM stadium ORDER BY average DESC LIMIT 1
CREATE TABLE stadium (name VARCHAR(255), capacity VARCHAR(255), average VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3969 }
How many concerts are there in year 2014 or 2015?
SELECT COUNT(*) FROM concert WHERE YEAR = 2014 OR YEAR = 2015
CREATE TABLE concert (YEAR VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3970 }
Show the stadium name and the number of concerts in each stadium.
SELECT T2.name, COUNT(*) FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id GROUP BY T1.stadium_id
CREATE TABLE stadium (name VARCHAR(255), stadium_id VARCHAR(255)); CREATE TABLE concert (stadium_id VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3971 }
Show the stadium name and capacity with most number of concerts in year 2014 or after.
SELECT T2.name, T2.capacity FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.year >= 2014 GROUP BY T2.stadium_id ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE stadium (name VARCHAR(255), capacity VARCHAR(255), stadium_id VARCHAR(255)); CREATE TABLE concert (stadium_id VARCHAR(255), year VARCHAR(255))
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
5
0
1
{ "split": "train", "row_index": 3972 }
What is the name and capacity of the stadium with the most concerts after 2013 ?
SELECT t2.name, t2.capacity FROM concert AS t1 JOIN stadium AS t2 ON t1.stadium_id = t2.stadium_id WHERE t1.year > 2013 GROUP BY t2.stadium_id ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE concert (stadium_id VARCHAR(255), year INTEGER); CREATE TABLE stadium (name VARCHAR(255), capacity VARCHAR(255), stadium_id VARCHAR(255))
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
5
0
1
{ "split": "train", "row_index": 3973 }
Which year has most number of concerts?
SELECT YEAR FROM concert GROUP BY YEAR ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE concert (YEAR VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
0
0
{ "split": "train", "row_index": 3974 }
Show the stadium names without any concert.
SELECT name FROM stadium WHERE NOT stadium_id IN (SELECT stadium_id FROM concert)
CREATE TABLE stadium (name VARCHAR(255), stadium_id VARCHAR(255)); CREATE TABLE concert (name VARCHAR(255), stadium_id VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
1
0
{ "split": "train", "row_index": 3975 }
Show countries where a singer above age 40 and a singer below 30 are from.
SELECT country FROM singer WHERE age > 40 INTERSECT SELECT country FROM singer WHERE age < 30
CREATE TABLE singer (country VARCHAR(255), age INTEGER)
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
1
0
{ "split": "train", "row_index": 3976 }
Show the name and theme for all concerts and the number of singers in each concert.
SELECT T2.concert_name, T2.theme, COUNT(*) FROM singer_in_concert AS T1 JOIN concert AS T2 ON T1.concert_id = T2.concert_id GROUP BY T2.concert_id
CREATE TABLE singer_in_concert (concert_id VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT); CREATE TABLE concert (concert_name VARCHAR(255), theme VARCHAR(255), concert_id VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3978 }
What are the names , themes , and number of singers for every concert ?
SELECT t2.concert_name, t2.theme, COUNT(*) FROM singer_in_concert AS t1 JOIN concert AS t2 ON t1.concert_id = t2.concert_id GROUP BY t2.concert_id
CREATE TABLE singer_in_concert (concert_id VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT); CREATE TABLE concert (concert_name VARCHAR(255), theme VARCHAR(255), concert_id VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3979 }
List singer names and number of concerts for each singer.
SELECT T2.name, COUNT(*) FROM singer_in_concert AS T1 JOIN singer AS T2 ON T1.singer_id = T2.singer_id GROUP BY T2.singer_id
CREATE TABLE singer_in_concert (singer_id VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT); CREATE TABLE singer (name VARCHAR(255), singer_id VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3980 }
List all singer names in concerts in year 2014.
SELECT T2.name FROM singer_in_concert AS T1 JOIN singer AS T2 ON T1.singer_id = T2.singer_id JOIN concert AS T3 ON T1.concert_id = T3.concert_id WHERE T3.year = 2014
CREATE TABLE singer_in_concert (singer_id VARCHAR(255), concert_id VARCHAR(255)); CREATE TABLE concert (concert_id VARCHAR(255), year VARCHAR(255)); CREATE TABLE singer (name VARCHAR(255), singer_id VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
0
0
{ "split": "train", "row_index": 3981 }
what is the name and nation of the singer who have a song having 'Hey' in its name?
SELECT name, country FROM singer WHERE song_name LIKE '%Hey%'
CREATE TABLE singer (name VARCHAR(255), country VARCHAR(255), song_name VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3982 }
Find the name and location of the stadiums which some concerts happened in the years of both 2014 and 2015.
SELECT T2.name, T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2014 INTERSECT SELECT T2.name, T2.location FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.stadium_id WHERE T1.Year = 2015
CREATE TABLE stadium (name VARCHAR(255), location VARCHAR(255), stadium_id VARCHAR(255)); CREATE TABLE concert (stadium_id VARCHAR(255), Year VARCHAR(255))
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
1
1
{ "split": "train", "row_index": 3983 }
Find the number of concerts happened in the stadium with the highest capacity .
SELECT COUNT(*) FROM concert WHERE stadium_id = (SELECT stadium_id FROM stadium ORDER BY capacity DESC LIMIT 1)
CREATE TABLE concert (stadium_id VARCHAR(255), capacity VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT); CREATE TABLE stadium (stadium_id VARCHAR(255), capacity VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
1
0
{ "split": "train", "row_index": 3984 }
Find the number of pets whose weight is heavier than 10.
SELECT COUNT(*) FROM pets WHERE weight > 10
CREATE TABLE pets (weight INTEGER, id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
0
{ "split": "train", "row_index": 3985 }
Find the weight of the youngest dog.
SELECT weight FROM pets ORDER BY pet_age LIMIT 1
CREATE TABLE pets (weight VARCHAR(255), pet_age VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
0
{ "split": "train", "row_index": 3986 }
Find the maximum weight for each type of pet. List the maximum weight and pet type.
SELECT MAX(weight), petType FROM pets GROUP BY petType
CREATE TABLE pets (petType VARCHAR(255), weight INTEGER, id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 3987 }
Find number of pets owned by students who are older than 20.
SELECT COUNT(*) FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid WHERE T1.age > 20
CREATE TABLE student (stuid VARCHAR(255), age INTEGER); CREATE TABLE has_pet (stuid VARCHAR(255), petid VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
0
{ "split": "train", "row_index": 3988 }
Find the number of dog pets that are raised by female students (with sex F).
SELECT COUNT(*) FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T2.petid = T3.petid WHERE T1.sex = 'F' AND T3.pettype = 'dog'
CREATE TABLE has_pet (stuid VARCHAR(255), petid VARCHAR(255)); CREATE TABLE pets (petid VARCHAR(255), pettype VARCHAR(255)); CREATE TABLE student (stuid VARCHAR(255), sex VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
0
1
{ "split": "train", "row_index": 3989 }
Find the number of distinct type of pets.
SELECT COUNT(DISTINCT pettype) FROM pets
CREATE TABLE pets (pettype VARCHAR(255), id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
0
0
0
{ "split": "train", "row_index": 3990 }
Find the first name of students who have cat or dog pet.
SELECT DISTINCT T1.Fname FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pettype = 'cat' OR T3.pettype = 'dog'
CREATE TABLE has_pet (stuid VARCHAR(255), petid VARCHAR(255)); CREATE TABLE student (Fname VARCHAR(255), stuid VARCHAR(255)); CREATE TABLE pets (petid VARCHAR(255), pettype VARCHAR(255))
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
4
0
1
{ "split": "train", "row_index": 3991 }
Find the first name of students who have both cat and dog pets .
SELECT t1.fname FROM student AS t1 JOIN has_pet AS t2 ON t1.stuid = t2.stuid JOIN pets AS t3 ON t3.petid = t2.petid WHERE t3.pettype = 'cat' INTERSECT SELECT t1.fname FROM student AS t1 JOIN has_pet AS t2 ON t1.stuid = t2.stuid JOIN pets AS t3 ON t3.petid = t2.petid WHERE t3.pettype = 'dog'
CREATE TABLE student (fname VARCHAR(255), stuid VARCHAR(255)); CREATE TABLE has_pet (stuid VARCHAR(255), petid VARCHAR(255)); CREATE TABLE pets (petid VARCHAR(255), pettype VARCHAR(255))
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
1
0
{ "split": "train", "row_index": 3992 }
What are the students' first names who have both cats and dogs as pets?
SELECT T1.Fname FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pettype = 'cat' INTERSECT SELECT T1.Fname FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pettype = 'dog'
CREATE TABLE has_pet (stuid VARCHAR(255), petid VARCHAR(255)); CREATE TABLE student (Fname VARCHAR(255), stuid VARCHAR(255)); CREATE TABLE pets (petid VARCHAR(255), pettype VARCHAR(255))
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
1
0
{ "split": "train", "row_index": 3993 }
Find the id of students who do not have a cat pet.
SELECT stuid FROM student EXCEPT SELECT T1.stuid FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pettype = 'cat'
CREATE TABLE has_pet (stuid VARCHAR(255), petid VARCHAR(255)); CREATE TABLE pets (petid VARCHAR(255), pettype VARCHAR(255)); CREATE TABLE student (stuid VARCHAR(255), fname VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
0
1
0
{ "split": "train", "row_index": 3995 }
Find the first name and age of students who have a dog but do not have a cat as a pet.
SELECT T1.fname, T1.age FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pettype = 'dog' AND NOT T1.stuid IN (SELECT T1.stuid FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pettype = 'cat')
CREATE TABLE has_pet (stuid VARCHAR(255), petid VARCHAR(255)); CREATE TABLE student (fname VARCHAR(255), age VARCHAR(255), stuid VARCHAR(255)); CREATE TABLE pets (petid VARCHAR(255), pettype VARCHAR(255))
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
1
2
{ "split": "train", "row_index": 3996 }
Find the type and weight of the youngest pet.
SELECT pettype, weight FROM pets ORDER BY pet_age LIMIT 1
CREATE TABLE pets (pettype VARCHAR(255), weight VARCHAR(255), pet_age VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 3997 }
Find the id and weight of all pets whose age is older than 1.
SELECT petid, weight FROM pets WHERE pet_age > 1
CREATE TABLE pets (petid VARCHAR(255), weight VARCHAR(255), pet_age INTEGER)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 3998 }
Find the average and maximum age for each type of pet.
SELECT AVG(pet_age), MAX(pet_age), pettype FROM pets GROUP BY pettype
CREATE TABLE pets (pettype VARCHAR(255), pet_age INTEGER, id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
2
{ "split": "train", "row_index": 3999 }
Find the average weight for each pet type.
SELECT AVG(weight), pettype FROM pets GROUP BY pettype
CREATE TABLE pets (pettype VARCHAR(255), weight INTEGER, id INTEGER PRIMARY KEY AUTO_INCREMENT)
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 4000 }
Find the first name and age of students who have a pet.
SELECT DISTINCT T1.fname, T1.age FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid
CREATE TABLE student (fname VARCHAR(255), age VARCHAR(255), stuid VARCHAR(255)); CREATE TABLE has_pet (stuid VARCHAR(255), petid VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
0
1
{ "split": "train", "row_index": 4001 }
Find the id of the pet owned by student whose last name is ‘Smith’.
SELECT T2.petid FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid WHERE T1.Lname = 'Smith'
CREATE TABLE has_pet (petid VARCHAR(255), stuid VARCHAR(255)); CREATE TABLE student (stuid VARCHAR(255), Lname VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
0
{ "split": "train", "row_index": 4002 }
Find the number of pets for each student who has any pet and student id.
SELECT COUNT(*), T1.stuid FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid GROUP BY T1.stuid
CREATE TABLE has_pet (stuid VARCHAR(255), petid VARCHAR(255)); CREATE TABLE student (stuid VARCHAR(255), name VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 4003 }
For students who have pets , how many pets does each student have ? list their ids instead of names .
SELECT COUNT(*), t1.stuid FROM student AS t1 JOIN has_pet AS t2 ON t1.stuid = t2.stuid GROUP BY t1.stuid
CREATE TABLE has_pet (stuid VARCHAR(255), petid VARCHAR(255)); CREATE TABLE student (stuid VARCHAR(255), name VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 4004 }
Find the first name and gender of student who have more than one pet.
SELECT T1.fname, T1.sex FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid GROUP BY T1.stuid HAVING COUNT(*) > 1
CREATE TABLE student (fname VARCHAR(255), sex VARCHAR(255), stuid VARCHAR(255)); CREATE TABLE has_pet (stuid VARCHAR(255), petid VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 4005 }
Find the last name of the student who has a cat that is age 3.
SELECT T1.lname FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid JOIN pets AS T3 ON T3.petid = T2.petid WHERE T3.pet_age = 3 AND T3.pettype = 'cat'
CREATE TABLE student (lname VARCHAR(255), stuid VARCHAR(255)); CREATE TABLE has_pet (stuid VARCHAR(255), petid VARCHAR(255)); CREATE TABLE pets (petid VARCHAR(255), pet_age VARCHAR(255), pettype VARCHAR(255))
generic
hard
hard
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
3
0
1
{ "split": "train", "row_index": 4006 }
Find the average age of students who do not have any pet .
SELECT AVG(age) FROM student WHERE NOT stuid IN (SELECT stuid FROM has_pet)
CREATE TABLE student (age INTEGER, stuid VARCHAR(255)); CREATE TABLE has_pet (age INTEGER, stuid VARCHAR(255))
generic
extra
extra
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
1
1
1
{ "split": "train", "row_index": 4007 }
How many continents are there?
SELECT COUNT(*) FROM CONTINENTS
CREATE TABLE CONTINENTS (Id VARCHAR(255), name VARCHAR(255))
generic
easy
easy
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
0
0
0
{ "split": "train", "row_index": 4008 }
How many countries does each continent have? List the continent id, continent name and the number of countries.
SELECT T1.ContId, T1.Continent, COUNT(*) FROM CONTINENTS AS T1 JOIN COUNTRIES AS T2 ON T1.ContId = T2.Continent GROUP BY T1.ContId
CREATE TABLE COUNTRIES (Continent VARCHAR(255), CountryId VARCHAR(255)); CREATE TABLE CONTINENTS (Continent VARCHAR(255), ContId VARCHAR(255))
generic
medium
medium
classified
valid
valid
valid
[]
[]
[]
[]
[ "validated", "extended", "classified" ]
null
2
0
1
{ "split": "train", "row_index": 4009 }