db_id stringclasses 66
values | question stringlengths 24 325 | evidence stringlengths 1 673 ⌀ | gold_query stringlengths 23 804 | db_schema stringclasses 66
values |
|---|---|---|---|---|
mondial_geo | Among the countries whose government type is republic, how many of them shares a border that's longer than 200? | null | SELECT COUNT(DISTINCT T1.Name) FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country INNER JOIN borders AS T3 ON T3.Country1 = T2.Country WHERE T2.Government = 'republic' AND T3.Length > 200 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | Provide the title of the books published in British-English. | "British English" is the language_name of the book | SELECT DISTINCT T1.title FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'British English' | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
regional_sales | Calculate the average net profit of phones which have sales channel of distributor. | net profit can be computed as SUBTRACT(Unit Price, Unit Cost); AVG(net profit) where Product Name = 'Phones' and Sales Channel = 'Distributor'; | SELECT SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T2.`Product Name` = 'Phones' AND T1.`Sales Channel` = 'Distributor' | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | What is the greatest length of the border between 2 independent countries? | null | SELECT MAX(T3.Length) FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country INNER JOIN borders AS T3 ON T3.Country1 = T2.Country WHERE T2.Independence IS NOT NULL | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | Write the full name of the customers whose address is at 55 Dorton Pass, Huangqiao. | full name refers to first_name, last_name; '55' is the street_number, 'Dorton Pass' is the street_name; 'Huangqiao' is the city | SELECT DISTINCT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id WHERE T3.street_number = 55 AND T3.street_name = 'Dorton Pass' AND T3.city = 'Huangqiao' | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
mondial_geo | Among the countries with a GDP of over 1000000, how many of them have mountains higher than 1000? | null | SELECT COUNT(DISTINCT T1.Name) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country INNER JOIN economy AS T3 ON T3.Country = T1.Code INNER JOIN mountain AS T4 ON T4.Name = T2.Mountain WHERE T3.GDP > 1000000 AND T4.Height > 1000 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | Provide the ISBN and price of the book with book ID 7160. | ISBN refers to isbn13; | SELECT T1.isbn13, T2.price FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T2.book_id = 6503 | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
regional_sales | State the delivery date of cookware. | Cookware is the name of the product; | SELECT T FROM ( SELECT DISTINCT IIF(T2.`Product Name` = 'Cookware', T1.DeliveryDate, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | How many volcanic mountains are there in countries whose population is no more than 5000000? | null | SELECT COUNT(DISTINCT T3.Name) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country INNER JOIN mountain AS T3 ON T3.Name = T2.Mountain WHERE T3.Type = 'volcanic' AND T1.Population <= 5000000 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | What is the number of pages of the book in the order ID 1167? | number of pages refers to num_pages | SELECT T1.num_pages FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T2.order_id = 1167 | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
mondial_geo | Which mountain is the highest in an independent country? | null | SELECT T4.Name FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country INNER JOIN geo_mountain AS T3 ON T3.Country = T2.Country INNER JOIN mountain AS T4 ON T4.Name = T3.Mountain WHERE T2.Independence IS NOT NULL ORDER BY T4.Height DESC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | What is the language of the book titled Zorro? | "Zorro" is the title of the book; langauge refers to language_name | SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'Zorro' | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
regional_sales | List out the name of products which have been applied 10% discount. | applied 10% discount refers to Discount Applied = 0.1; | SELECT T FROM ( SELECT DISTINCT IIF(T1.`Discount Applied` = 0.1, T2.`Product Name`, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | How many deserts are there in a country where over 90% of people speaks Armenian? | null | SELECT COUNT(T2.Desert) FROM country AS T1 INNER JOIN geo_desert AS T2 ON T1.Code = T2.Country INNER JOIN language AS T3 ON T1.Code = T2.Country WHERE T3.Name = 'Armenian' AND T3.Percentage > 90 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | How many books were published by Brava in 2006? | "Brava" is the publisher_name; in 2006 refers to SUBSTR(publication_date, 1, 4) = '2006' | SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Brava' AND STRFTIME('%Y', T1.publication_date) = '2006' | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
regional_sales | List out the city name of states located in South region. | null | SELECT T FROM ( SELECT DISTINCT CASE WHEN T1.Region = 'South' THEN T2.`City Name` END AS T FROM Regions T1 INNER JOIN `Store Locations` T2 ON T2.StateCode = T1.StateCode ) WHERE T IS NOT NULL | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | Please list the deserts in the countries whose population is over 100000 and covers an area of under 500000. | null | SELECT T2.Desert FROM country AS T1 INNER JOIN geo_desert AS T2 ON T1.Code = T2.Country WHERE T1.Area > 100000 AND T1.Population < 500000 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | What is the title of the book in the order ID 931? | null | SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T2.order_id = 931 | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
mondial_geo | Among the independent countries whose type of government is republic, what is the biggest number of deserts they have? | null | SELECT COUNT(T3.Desert) FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country INNER JOIN geo_desert AS T3 ON T3.Country = T2.Country WHERE T2.Government = 'republic' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
regional_sales | Among orders in 2020, name the customers who had the greatest discount applied for 'Cocktail Glasses' | MAX(Discount Applied) where Product Name = 'Cocktail Glasses'; orders in 2020 refer to the OrderDate between 01-01-2020 and 31-12-2020; | SELECT DISTINCT T1.`Customer Names` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID WHERE T3.`Product Name` = 'Cocktail Glasses' AND SUBSTR(T2.OrderDate, -2) = '20' AND T2.`Discount Applied` = ( SELECT T2.`Discount Applied`... | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | Please list the mountains in the country with the lowest inflation rate. | null | SELECT Mountain FROM geo_mountain WHERE Country = ( SELECT Country FROM economy ORDER BY Inflation ASC LIMIT 1 ) | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | List the ISBN of the books that cost 7.5 dollars. | ISBN refers to isbn13; books cost 7.5 dollars refers to price = 7.5 | SELECT T1.isbn13 FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T2.price = 7.5 | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
regional_sales | How many orders that Medsep Group had made? | Medsep Group is the name of the customer; orders refer to OrderNumber; | SELECT SUM(CASE WHEN T1.`Customer Names` = 'Medsep Group' THEN 1 ELSE 0 END) FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | Among the countries whose agriculture takes up more than 40% of its GDP, how many of them have less than 2 mountains? | null | SELECT COUNT(T3.Country) FROM ( SELECT T1.Country FROM economy AS T1 INNER JOIN geo_mountain AS T2 ON T1.Country = T2.Country WHERE T1.Industry < 40 GROUP BY T1.Country HAVING COUNT(T1.Country) < 2 ) AS T3 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | List all books authored by Tom Clancy. | "Tom Clancy" is the author_name; books refers title | SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Tom Clancy' | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
regional_sales | Calculate the average net profit of bar tools which has ordered quantity exceed 5. | net profit can be computed as SUBTRACT(Unit Price, Unit Cost); AVG(net profit) where Product Name = 'Bar Tools' and Order Quantity > 5; | SELECT SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T2.`Product Name` = 'Bar Tools' AND T1.`Order Quantity` > 5 | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | How many mountains are there in the country with the greatest population? | null | SELECT COUNT(T2.Mountain) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY T1.Population DESC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
regional_sales | What is the region of stores which have type of "Town" in the list? | null | SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.Type = 'Town' THEN T1.Region END AS T FROM Regions T1 INNER JOIN `Store Locations` T2 ON T2.StateCode = T1.StateCode ) WHERE T IS NOT NULL | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | Please list the capital cities of the countries that have more than 4 mountains. | null | SELECT T1.Capital FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country GROUP BY T1.Name, T1.Capital HAVING COUNT(T1.Name) > 4 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | Write down the author's name of the book most recently published. | author's name refers to author_name; book most recently published refers to Max(publication_date) | SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id ORDER BY T1.publication_date DESC LIMIT 1 | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
regional_sales | State the customer name of orders which has shipped date in 7/8/2018. | shipped date in 7/8/2018 refers to ShipDate = '7/8/18' | SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.ShipDate = '7/8/18' THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | What is the most populated city of the 12th highest density country? | Population density = Population / area | SELECT T2.Name FROM country AS T1 INNER JOIN city AS T2 ON T1.Code = T2.Country WHERE T1.Name = ( SELECT Name FROM country ORDER BY CAST(Population AS REAL) / Area LIMIT 11, 1 ) ORDER BY T2.Population DESC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | Provide the email of the customers that purchased books with a price range of 3 to 5 dollars. | books with a price range of 3 to 5 dollars refers to price BETWEEN 3 AND 5 | SELECT DISTINCT T3.email FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T1.price BETWEEN 3 AND 5 | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
mondial_geo | How many more people speak English than speak Scottish in United Kingdom? | English and Scottish are two languages; United Kingdom is a country | SELECT T3.Population * (T2.Percentage - T1.Percentage) FROM ethnicGroup AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Country = T2.Country INNER JOIN country AS T3 ON T1.Country = T3.Code WHERE T1.Name = 'Scottish' AND T2.Name = 'English' AND T3.Name = 'United Kingdom' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | What is the sum of the number of pages of the books ordered by Mick Sever? | sum of the number of pages refers to Sum(num_pages) | SELECT SUM(T1.num_pages) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Mick' AND T4.last_name = 'Sever' | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
mondial_geo | What is the population density of the Petropavl's home country? | Population density = Population / area | SELECT CAST(T1.Population AS REAL) / T1.Area FROM country AS T1 INNER JOIN city AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Petropavl' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | Among the books purchased by less than 1 dollar, what is the difference between the number of books with less than 500 pages and books with greater than 500 pages? | book purchased by less than 1 dollar refers to price < 1; books with less than 500 pages refers to num_pages < 500; greater than 500 pages refers to num_pages > 500; Difference = Subtract (Count(book_id where num_pages < 500), Count(book_id where num_pages > 500)) | SELECT SUM(CASE WHEN T1.num_pages < 500 THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.num_pages > 500 THEN 1 ELSE 0 END) AS dif FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T2.price < 1 | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
app_store | What is the rating of Dragon Ball Legends and how many users dislike this App? | Dragon Ball Legends is the app; users who dislikes the app refers to Sentiment_Polarity<-0.5; | SELECT T1.Rating, COUNT(T2.Sentiment_Polarity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Dragon Ball Legends' AND CAST(Sentiment_Polarity AS INTEGER) < -0.5 | CREATE TABLE playstore
(
Rating REAL, --
Size TEXT, --
App TEXT, --
Category TEXT, --
Price TEXT, --
"Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0
Installs TEXT, --
... |
mondial_geo | What is the area of the country which became independent in 1921/3/13? | null | SELECT T1.Area FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T2.Independence = '1921-03-13' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | Give the publisher's name of the books authored by Alan Lee. | "Alan Lee" is the author_name; publisher's name refers to publisher_name | SELECT T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'Alan Lee' GROUP BY T4.publisher_name | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
mondial_geo | How many rivers finally flows to the sea of 459m in depth? | null | SELECT COUNT(*) FROM river WHERE Sea IN ( SELECT Name FROM sea WHERE Depth = 459 ) | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | In books published by Ace Book, what is the percentage of English books published? | "Ace Book" is the publisher_name; English book refers to language_name = 'English'; percentage = Divide (Count(book_id where language_name = 'English'), Count(book_id)) * 100 | SELECT CAST(SUM(CASE WHEN T1.language_name = 'English' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id INNER JOIN publisher AS T3 ON T3.publisher_id = T2.publisher_id WHERE T3.publisher_name = 'Ace Book' | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
regional_sales | Among the orders placed by Pacific Ltd, how many orders have been applied 5% discount ? | orders by Pacific Ltd refer to OrderNumber where Customer Names = 'Pacific Ltd'; applied 5% discount refers to Discount Applied = 0.05; | SELECT SUM(CASE WHEN T1.`Discount Applied` = 0.05 AND T2.`Customer Names` = 'Pacific Ltd' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | Which country has the city of 114339 in population? Give the full name of the country. | null | SELECT T1.Name FROM country AS T1 INNER JOIN city AS T2 ON T1.Code = T2.Country WHERE T2.Population = 114339 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
food_inspection_2 | Please list the full names of all the sanitarians under the supervision of Darlisha Jacobs. | full name refers to first_name, last_name | SELECT first_name, last_name FROM employee WHERE title = 'Sanitarian' AND supervisor = ( SELECT employee_id FROM employee WHERE first_name = 'Darlisha' AND last_name = 'Jacobs' ) | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
regional_sales | List out the discount levels applied for all orders from Ole Group. | Ole Group is the name of the customer; discount levels applied refer to Discount Applied NOT NULL; | SELECT T FROM ( SELECT DISTINCT CASE WHEN T1.`Customer Names` = 'Ole Group' THEN T2.`Discount Applied` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | For the third largest country, which ethinic group has the most population? | null | SELECT T2.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T1.Name = ( SELECT Name FROM country ORDER BY Area DESC LIMIT 2, 1 ) GROUP BY T2.Name ORDER BY T2.Percentage * T1.Population DESC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | Who is the author of First Things First? | "First Things First" is the title of the book; author refers to author_name | SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.title = 'First Things First' | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
regional_sales | Among the orders placed by Ei, how many orders have quantity greater than 4? | Ei is the name of the customer; orders have quantity greater than 4 refer to OrderNumber WHERE Order Quantity > 4; | SELECT SUM(CASE WHEN T1.`Order Quantity` > 4 AND T2.`Customer Names` = 'Ei ' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | Where is the capital of country which has the largest percentage of Malay people? | Malay is one of country names | SELECT T1.Capital FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Malay' ORDER BY T2.Percentage DESC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
food_inspection_2 | How many inspections were sanitarian Joshua Rosa responsible for in 2010? | in 2010 refers to inspection_date like '2010%' | SELECT COUNT(T2.inspection_id) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE strftime('%Y', T2.inspection_date) = '2010' AND T1.first_name = 'Joshua' AND T1.last_name = 'Rosa' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
mondial_geo | How many times longer is the longest border in the United States than the shortest? | How many times longer = longest border / shortest border | SELECT MAX(T2.Length) / MIN(T2.Length) FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country2 WHERE T1.Name = 'United States' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | What are the language and title of the ordered books with price less than 20% of the average price of all ordered books? | language refers to language_name; books with price less than 20% of the average price refers to price < Multiply (AVG(price), 0.2) | SELECT DISTINCT T3.language_name, T2.title FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id INNER JOIN book_language AS T3 ON T3.language_id = T2.language_id WHERE T1.price * 100 < ( SELECT AVG(price) FROM order_line ) * 20 | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
regional_sales | Which region has the most number of sales team? | the most number of sales team refers to MAX(COUNT(Sales Team)); | SELECT Region FROM `Sales Team` GROUP BY Region ORDER BY COUNT(DISTINCT `Sales Team`) DESC LIMIT 1 | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | Where does Bermuda belong to? Give the full name of the country. | Bermuda is one of countries | SELECT T3.Name FROM locatedOn AS T1 INNER JOIN island AS T2 ON T1.Island = T2.Name INNER JOIN country AS T3 ON T3.Code = T1.Country WHERE T3.Name = 'Bermuda' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
food_inspection_2 | Please list the full names of the sanitarians who did at least one inspection in May, 2010. | full name refers to first_name, last_name; in May 2010 refers to inspection_date like '2010-05%'; sanitarian refers to title = 'Sanitarian' | SELECT DISTINCT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE strftime('%Y-%m', T2.inspection_date) = '2010-05' AND T1.title = 'Sanitarian' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
mondial_geo | What kind of government does Iran have? | Uganda is one of country names | SELECT T2.Government FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Iran' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
food_inspection_2 | Among the facilities that have undergone at least one inspection in 2010, how many of them are restaurants or cafeterias? | in 2010 refers to inspection_date like '2010%'; restaurant or cafeteria refers to facility_type = 'Restaurant' | SELECT COUNT(DISTINCT T1.license_no) FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T1.inspection_date) = '2010' AND T2.facility_type = 'Restaurant' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
app_store | List all free sports Apps and their translated review. | paid sports Apps refers to type = 'Paid' and Category = 'SPORTS'; | SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Type = 'Free' AND T1.Category = 'SPORTS' | CREATE TABLE playstore
(
Rating REAL, --
Size TEXT, --
App TEXT, --
Category TEXT, --
Price TEXT, --
"Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0
Installs TEXT, --
... |
mondial_geo | When did Uganda declare independence? | Uganda is one of country names | SELECT T2.Independence FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Uganda' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
regional_sales | Please list the id and detailed position of all stores in Birmingham city. | Latitude and Longitude coordinates can be used to identify the detailed position of stores; id refers to StoreID; | SELECT StoreID, Latitude, Longitude FROM `Store Locations` WHERE `City Name` = 'Birmingham' | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | In which province is the highest volcano mountain located in? | null | SELECT T1.Province FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country INNER JOIN mountain AS T3 ON T3.Name = T2.Mountain WHERE T3.Type = 'volcano' ORDER BY T3.Height DESC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
mondial_geo | For the country in which Olsztyn is located, where is the capital? | Olsztyn is one of country names | SELECT T1.Capital FROM country AS T1 INNER JOIN city AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Olsztyn' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
regional_sales | Name the sales team and the region of order number 'SO - 000137'. | null | SELECT T2.`Sales Team`, T2.Region FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderNumber = 'SO - 000137' | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | Which city in Japan has the most people in the country? | most people refers to largest population | SELECT T2.Name FROM country AS T1 INNER JOIN city AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Japan' ORDER BY T2.Population DESC LIMIT 1 | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
regional_sales | How many CDP stores are there in California? | California is a state; CDP stores refer to StoreID where Type = 'CDP'; | SELECT SUM(CASE WHEN State = 'California' AND Type = 'CDP' THEN 1 ELSE 0 END) FROM `Store Locations` | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | What is the area of Egypt as a percentage of Asia? | null | SELECT T1.Area * 100 / T3.Area FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country INNER JOIN continent AS T3 ON T3.Name = T2.Continent WHERE T3.Name = 'Asia' AND T1.Name = 'Egypt' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
food_inspection_2 | Among the facilities that have undergone at least one inspection in 2010, how many of them are in ward no.42? | in 2010 refers to inspection_date like '2010%'; in ward no.42 refers to ward = 42 | SELECT COUNT(DISTINCT T1.license_no) FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T1.inspection_date) = '2010' AND T2.ward = 42 | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
regional_sales | What is the customer names of orders which have unit cost greater than 4000USD? | unit cost greater than 4000USD refers to Unit Cost > 4000; | SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.`Unit Cost` > 4000 THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | What is the area of Egypt as a percentage of Asia? | null | SELECT T2.Percentage FROM country AS T1 INNER JOIN encompasses AS T2 ON T1.Code = T2.Country INNER JOIN continent AS T3 ON T3.Name = T2.Continent WHERE T3.Name = 'Asia' AND T1.Name = 'Egypt' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
food_inspection_2 | Please list the assumed name of all the facilities inspected by Joshua Rosa. | assumed name refers to dba_name | SELECT DISTINCT T3.dba_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T1.first_name = 'Joshua' AND T1.last_name = 'Rosa' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
mondial_geo | Which two countries share the second highest mountain? Give the country code. | null | SELECT T1.Code FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country WHERE T2.Mountain = ( SELECT Name FROM mountain ORDER BY Height DESC LIMIT 1, 1 ) | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
food_inspection_2 | Please list the location coordinates of all the facilities that had an inspection on 2010/5/11. | location coordinates refers to latitude, longitude; on 2010/5/11 refers to inspection_date = '2010-05-11' | SELECT DISTINCT T2.latitude, T2.longitude FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T1.inspection_date = '2010-05-11' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
regional_sales | Which product has the highest net profit in 2019? | net profit can be computed as SUBTRACT(Unit Price, Unit Cost); the highest net profit in 2019 refers to MAX(Net Profit) where OrderDate LIKE '%/19'; product refers to Product Name; | SELECT T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.OrderDate LIKE '%/%/19' ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') DESC LIMIT 1 | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | What is the latitude of the island on which Mount Andrinjitra is located? | null | SELECT T1.Latitude FROM island AS T1 INNER JOIN mountainOnIsland AS T2 ON T1.Name = T2.Island WHERE T2.Mountain = 'Andringitra' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
regional_sales | Which city has the largest population? | city has the largest population refers to City Name where MAX(Population); | SELECT `City Name` FROM `Store Locations` ORDER BY Population DESC LIMIT 1 | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | What is the quantity of the mountains does Japan have? | Japan is one of country names | SELECT COUNT(DISTINCT T2.Mountain) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Japan' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
food_inspection_2 | Please list the assumed name of all the facilities that failed an inspection in 2010. | assumed name refers to dba_name; failed an inspection refers to results = 'Fail'; in 2010 refers to inspection_date like '2010%' | SELECT DISTINCT T2.dba_name FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T1.results = 'Fail' AND strftime('%Y', T1.inspection_date) = '2010' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
regional_sales | Which sales team name has the least orders in 2019? | sale team names refer to Sales Team; the least orders in 2019 refer to MIN(COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '19')); | SELECT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderDate LIKE '%/%/19' GROUP BY T2.`Sales Team` ORDER BY COUNT(T1.OrderNumber) ASC LIMIT 1 | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
mondial_geo | How many mountains are there in Indonesia? | Indonesia refers to one of countries | SELECT COUNT(DISTINCT T2.Mountain) FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Indonesia' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
books | What is the shipping method ordered by Nicolette Sadler at 6/29/2020 7:40:07 PM? | ordered at 6/29/2020 7:40:07 PM refers to order_date = '2020-06-29 19:40:07'; shipping method refers to method_name | SELECT T3.method_name FROM cust_order AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T1.shipping_method_id WHERE T2.first_name = 'Nicolette' AND T2.last_name = 'Sadler' AND T1.order_date = '2020-06-29 19:40:07' | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
mondial_geo | Which country is Mountain Cerro Chirripo located in? Give the full name of the country. | null | SELECT DISTINCT T1.Name FROM country AS T1 INNER JOIN geo_mountain AS T2 ON T1.Code = T2.Country WHERE T2.Mountain = 'Cerro Chirripo' | CREATE TABLE politics
(
Government TEXT, --
Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade,
Independence DATE, --
Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `... |
regional_sales | Please give the order number and product name of the order which has the lowest unit price. | the lowest unit price refers to MIN(Unit Price); | SELECT T1.OrderNumber, T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE REPLACE(T1.`Unit Price`, ',', '') = ( SELECT REPLACE(T1.`Unit Price`, ',', '') FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID ORDER BY REPLACE(T1.`Unit ... | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
food_inspection_2 | Among the inspections done by sanitarian Joshua Rosa, how many of them have the result of "pass"? | have the result of "pass" refers to results = 'Pass' | SELECT COUNT(T2.inspection_id) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.results = 'Pass' AND T1.first_name = 'Joshua' AND T1.last_name = 'Rosa' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
food_inspection_2 | Please list the full names of all the sanitarians who have inspected the facility Burbank. | full name refers to first_name, last_name; the facility Burbank refers to dba_name = 'Burbank' | SELECT DISTINCT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T3.dba_name = 'Burbank' AND T1.title = 'Sanitarian' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
regional_sales | Please list all sale team names which had orders on 5/31/2018. | had orders on 5/31/2018 refer to OrderDate = '5/31/18'; sale team names refer to Sales Team; | SELECT T FROM ( SELECT DISTINCT CASE WHEN T1.OrderDate = '5/31/18' THEN T2.`Sales Team` ELSE NULL END AS T FROM `Sales Orders` T1 INNER JOIN `Sales Team` T2 ON T2.SalesTeamID = T1._SalesTeamID ) WHERE T IS NOT NULL | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
food_inspection_2 | Among the facilities that had undergone at least one inspection in 2010, how many of them have the most serious food safety issues? | in 2010 refers to inspection_date like '2010%'; the most serious food safety issues refers to risk_level = 3 | SELECT COUNT(DISTINCT T2.license_no) FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T1.inspection_date) = '2010' AND T2.risk_level = 3 | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
regional_sales | Name the most expensive ordered? Who, when was it ordered? | the most expensive refers to MAX(Unit Cost); who refers to Customer Names; when refers to OrderDate; | SELECT T2.OrderNumber, T1.`Customer Names`, T2.OrderDate FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID ORDER BY T2.`Unit Cost` DESC LIMIT 1 | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
food_inspection_2 | What is the full name of the sanitarian who inspected Amundsen High School on 2010/5/11? | full name refers to first_name, last_name; Amundsen High School refers to dba_name = 'AMUNDSEN HIGH SCHOOL'; on 2010/5/11 refers to inspection_date = '2010-05-11' | SELECT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T2.inspection_date = '2010-05-11' AND T3.dba_name = 'AMUNDSEN HIGH SCHOOL' AND T1.title = 'Sanitarian' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
food_inspection_2 | After Azha Restaurant Inc. passed the inspection on 2010/1/21, when was the follow-up inspection done? | Azha Restaurant Inc. refers to dba_name = 'Azha Restaurant Inc.'; on 2010/1/21 refers to inspection_date = '2010-01-21'; follow-up inspection date refers to followup_to | SELECT T1.followup_to FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T2.dba_name = 'Azha Restaurant Inc.' AND T1.results = 'Pass' AND T1.inspection_date = '2010-01-21' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
regional_sales | What is the percentage of total orders from stores in Orange County in 2018? | DIVIDE(COUNT(OrderNumber where County = 'Orange County' and SUBSTR(OrderDate, -2) = '18'), COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '18')) as percentage; | SELECT CAST(SUM(CASE WHEN T2.County = 'Orange County' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.OrderDate LIKE '%/%/18' | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
regional_sales | What is the average unit price of a Cookware product? | AVG(Unit Price where Product Name = 'Cookware'); | SELECT AVG(REPLACE(T1.`Unit Price`, ',', '')) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T2.`Product Name` = 'Cookware' | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
food_inspection_2 | What is the point level of "Refrigeration and metal stem thermometers provided and conspicuous"? | "Refrigeration and metal stem thermometers provided and conspicuous" refers to Description = 'Refrigeration and metal stem thermometers provided and conspicuous ' | SELECT point_level FROM inspection_point WHERE Description = 'Refrigeration and metal stem thermometers provided and conspicuous ' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
regional_sales | Which sales team id has the highest number of orders in 2018? | the highest number of orders in 2018 refers to MAX(COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '18')); | SELECT _SalesTeamID FROM `Sales Orders` WHERE OrderDate LIKE '%/%/18' GROUP BY _SalesTeamID ORDER BY COUNT(_SalesTeamID) DESC LIMIT 1 | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
books | Who is the publisher of Hitchhiker's Guide To The Galaxy: The Filming of the Douglas Adams classic? | "Hitchhiker's Guide To The Galaxy: The Filming of the Douglas Adams classic" is the title of the book; publisher refers to publisher_name | SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'Hitchhiker''s Guide To The Galaxy: The Filming of the Douglas Adams classic' | CREATE TABLE order_line
(
book_id INTEGER references book, --
price REAL, --
line_id INTEGER primary key autoincrement,
order_id INTEGER references cust_order, --
);
CREATE TABLE customer
(
customer_id INTEGER primary key,
first_name TEXT, --
last_name TEXT, --
email TEXT, --
);
CREATE TABLE book_... |
food_inspection_2 | How many inspections did All Style Buffet Restaurant have? | All Style Buffet refers to dba_name = 'All Style Buffet'; Restaurant refers to facility_type = 'Restaurant' | SELECT COUNT(T2.inspection_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.facility_type = 'Restaurant' AND T1.dba_name = 'All Style Buffet' | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
regional_sales | From 2018 to 2020, which year did the George Lewis group have the highest number of orders? | George Lewis refers to Sales Team; the highest number of orders refers to MAX(COUNT(OrderNumber)); which year from 2018 to 2020 refers to SUBSTR(OrderDate, -2) IN ('18', '19', '20') GROUP BY SUBSTR(OrderDate, -2); | SELECT SUBSTR(T1.OrderDate, -2, 2) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.`Sales Team` = 'George Lewis' GROUP BY SUBSTR(T1.OrderDate, -2, 2) ORDER BY COUNT(T1.OrderNumber) DESC LIMIT 1 | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
food_inspection_2 | What is the average number of inspections carried out in the year 2010 by a sanitarian whose salary is over 70000? | in the year 2010 refers to inspection_date like '2010%'; salary is over 70000 refers to salary > 70000; average number = divide(sum(inspection where inspection_date like '2010%'), sum(employee_id where salary > 70000)) | SELECT CAST(SUM(CASE WHEN T2.inspection_date LIKE '2010%' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.salary > 70000 THEN 1 ELSE 0 END) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id | CREATE TABLE inspection
(
followup_to INTEGER, --
foreign key (employee_id) references employee(employee_id),
employee_id INTEGER, --
license_no INTEGER, --
foreign key (followup_to) references inspection(inspection_id),
foreign key (license_no) references establishment(license_no),
inspection_id INTEGER p... |
regional_sales | Which order number has the highest unit price? | the highest unit price refers to MAX(Unit Price); | SELECT OrderNumber FROM `Sales Orders` WHERE REPLACE(`Unit Price`, ',', '') = ( SELECT REPLACE(`Unit Price`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Price`, ',', '') DESC LIMIT 1 ) | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
regional_sales | In 2020, what were the total orders of all stores in Maricopa County? | total orders refer to COUNT(OrderNumber); 2020 refers to SUBSTR(OrderDate, -2) = '20'; | SELECT SUM(CASE WHEN T2.County = 'Maricopa County' AND OrderDate LIKE '%/%/20' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID | CREATE TABLE Regions
(
State TEXT, --
Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0
StateCode TEXT constraint Regions_pk primary key,
);
CREATE TABLE Sales Orders
(
OrderNumber TEXT constraint "Sales Orders_pk" primary... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.