db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
retail_world
How many condiments were sold in 1997?
"Condiments" is the CategoryName; in 1997 refers to year(OrderDate) = 1997;
SELECT COUNT(T2.ProductID) FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID INNER JOIN `Order Details` AS T3 ON T2.ProductID = T3.ProductID INNER JOIN Orders AS T4 ON T3.OrderID = T4.OrderID WHERE T1.CategoryName = 'Condiments' AND T1.CategoryID = 2 AND T4.OrderDate LIKE '1997%'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
What is the full name of the team that has the most players from UCLA?
"UCLA" is the college; team with most players refers to tmID where Max(Count(playerID))
SELECT T3.name FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID INNER JOIN teams AS T3 ON T3.tmID = T2.tmID WHERE T1.college = 'UCLA' GROUP BY T3.name ORDER BY COUNT(DISTINCT T1.playerID) DESC LIMIT 1
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
synthea
When did Mrs. Ira Deckow have the standard pregnancy test?
standard pregnancy test refers to DESCRIPTION = 'Standard pregnancy test' from procedures;
SELECT T2.date FROM patients AS T1 INNER JOIN procedures AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mrs.' AND T1.first = 'Ira' AND T1.last = 'Deckow' AND T2.description = 'Standard pregnancy test'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are teenagers?
RESPONSE = 'true'; teenagers are people aged between 13 and 19 years;
SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.age >= 13 AND T1.age <= 19 AND T2.RESPONSE = 'true'
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
What is the category of the product that has the highest number of discontinued products?
discontinued products refers to Discontinued = 1; highest number of discontinued products refers to MAX(Discontinued = 1)
SELECT T2.CategoryName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.Discontinued = 1 GROUP BY T2.CategoryName ORDER BY COUNT(T1.ProductID) DESC LIMIT 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
Please list the first names of the players with the most personal fouls in the 'NBL' league.
"NBL" is the lgID; most  personal foul refers to Max(Count(PF))
SELECT T1.firstName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.lgID = 'NBL' GROUP BY T1.playerID, T1.firstName ORDER BY COUNT(PF) DESC LIMIT 1
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
superstore
What is the name of the product that has the highest original price?
has the highest original price refers to MAX(DIVIDE(Sales, SUTRACT(1, discount))); name of the product refers to "Product Name"
SELECT T2.`Product Name` FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` ORDER BY (T1.Sales / (1 - T1.Discount)) DESC LIMIT 1
CREATE TABLE west_superstore ( Profit REAL, -- Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0 "Product ID" TEXT, -- foreign key ("Product ID", Region) references product("Product ID",Region), "Order Date" DATE, -- foreign key ("Customer ID", Reg...
synthea
How many patients are allergic to eggs?
allergic to eggs refer to DESCRIPTION = 'Allergy to eggs' from allergies;
SELECT COUNT(PATIENT) FROM allergies WHERE DESCRIPTION = 'Allergy to eggs'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
Among the customers who come from the place with 25746 inhabitants, how many of them are male?
place with 44114 inhabitants refers to GEOID where INHABITANTS_K = 44.114; SEX = 'Male';
SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INHABITANTS_K = 25.746 AND T1.SEX = 'Male'
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
What is the total sales amount of all discontinued products?
discontinued products refers to Discontinued = 1; total sales amount refers to SUM(MULTIPLY(UnitPrice, Quantity))
SELECT SUM(T2.UnitPrice * T2.Quantity) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Discontinued = 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
software_company
What is the number of inhabitants of the place the most customers are from?
the most customers are from refers to GEOID where MAX(COUNT(ID)); number of inhabitants refers to INHABITANTS_K;
SELECT DISTINCT T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID ORDER BY T2.INHABITANTS_K DESC
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
How old was the oldest employee at the time he or she was hired?
oldest employee at the time he or she was hired refers to MAX(SUBTRACT(HireDate, Birthdate))
SELECT MAX(TIMESTAMPDIFF(YEAR, BirthDate, HireDate)) FROM Employees
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
How many teams have played more than 3800 points and have player with "Most Valuable Player" award?
played more than 3800 points refers to Sum(points) > = 3800
SELECT COUNT(DISTINCT T4.name) FROM ( SELECT T1.name, SUM(T2.points) FROM teams AS T1 INNER JOIN players_teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN awards_players AS T3 ON T2.playerID = T3.playerID WHERE T3.award = 'Most Valuable Player' GROUP BY T1.name HAVING SUM(T2.points) >= 3800 ) AS T4
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
superstore
How many quantities of Advantus plastic paper clips were ordered overall?
Advantus plastic paper clips is the "Product Name";
SELECT SUM(T1.Quantity) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Advantus Plastic Paper Clips'
CREATE TABLE west_superstore ( Profit REAL, -- Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0 "Product ID" TEXT, -- foreign key ("Product ID", Region) references product("Product ID",Region), "Order Date" DATE, -- foreign key ("Customer ID", Reg...
software_company
How many of the first 60,000 customers from the place with the highest average income per month have sent a true response to the incentive mailing sent by the marketing department?
place with the highest average income per month refers to GEOID where MAX(INCOME_K); RESPONSE = 'true';
SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T2.RESPONSE = 'true' ORDER BY T3.INCOME_K DESC LIMIT 1
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
How much is the salary of the first employee that was hired?
first employee that was hired refers to MIN(HireDate)
SELECT Salary FROM Employees WHERE HireDate = ( SELECT MIN(HireDate) FROM Employees )
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
Among the coaches who won the 'ABA Coach of the Year' award, which is the coach with the highest number of won games?
"ABA Coach of the Year" is the award; highest number of won games refers to Max(Count(won))
SELECT T1.coachID FROM coaches AS T1 INNER JOIN awards_coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.award = 'ABA Coach of the Year' GROUP BY T1.coachID, T1.won ORDER BY T1.won DESC LIMIT 1
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
superstore
What are the names of the products that were ordered by Alejandro Grove?
ordered by Alejandro Grove refers to "Customer Name" = 'Alejandro Grove'; names of the products refers to "Product Name"
SELECT DISTINCT T3.`Product Name` FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T2.`Customer Name` = 'Alejandro Grove'
CREATE TABLE west_superstore ( Profit REAL, -- Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0 "Product ID" TEXT, -- foreign key ("Product ID", Region) references product("Product ID",Region), "Order Date" DATE, -- foreign key ("Customer ID", Reg...
synthea
What is the most common allergy among patients?
the most common allergy refers to MAX(COUNT(DESCRIPTION)) from allergies;
SELECT DESCRIPTION FROM allergies GROUP BY DESCRIPTION ORDER BY COUNT(DESCRIPTION) DESC LIMIT 1
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are divorced males?
RESPONSE = 'true'; SEX = 'Male'; MARITAL_STATUS = 'Divorced';
SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.SEX = 'Male' AND T1.MARITAL_STATUS = 'Divorced' AND T2.RESPONSE = 'true'
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
In August of 1996, how many orders were placed by the customer with the highest amount of orders?
August of 1996 refers to OrderDate = '1996-8'; highest amount of orders refers to MAX(COUNT(OrderID))
SELECT COUNT(OrderID) FROM Orders WHERE OrderDate LIKE '1996-08%' GROUP BY CustomerID ORDER BY COUNT(OrderID) DESC LIMIT 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
synthea
How many patients have diabetes that started in 1988?
diabetes that started in 1988 refers to DESCRIPTION = 'Diabetes' from conditions and START like '1988%';
SELECT COUNT(PATIENT) FROM conditions WHERE DESCRIPTION = 'Diabetes' AND strftime('%Y', START) = '1988'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are from a place with more than 30,000 inhabitants?
RESPONSE = 'true'; place with more than 30,000 inhabitants refers to GEOID where INHABITANTS_K > 30;
SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T3.INHABITANTS_K > 30 AND T2.RESPONSE = 'true'
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
What is the full name of the employees who report to the Sales Manager?
full name refers to LastName, FirstName; the Sales Manager refers to Title = 'Sales Manager'; report to refers to ReportsTo is not NULL;
SELECT FirstName, LastName FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE Title = 'Sales Manager' )
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
What is the full name of the team with the fastest growth in winning rate in the 'ABA' league from 1972 to 1973?
"ABA" is the lgID; from 1972 to 1973 refers to year = 1972 and year = 1973; team with the fastest growth in winning rate = Max(Subtract(Divide(won where year = 1973, Sum(won, lost)),Divide(won where year = 1972, Sum(won, lost))))
SELECT T1.name FROM teams AS T1 INNER JOIN ( SELECT * FROM teams WHERE lgID = 'ABA' AND year = 1972 ) AS T2 ON T1.tmID = T2.tmID WHERE T1.lgID = 'ABA' AND T1.year = 1973 ORDER BY (CAST(T1.won AS REAL) / (T1.won + T1.lost) - (CAST(T2.won AS REAL) / (T2.won + T2.lost))) DESC LIMIT 1
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
synthea
What is the most common condition among the female Americans?
the most common condition refers to MAX(COUNT(DESCRIPTION)); among the female Americans refer to PATIENT where gender = 'F' and ethnicity = 'american';
SELECT T2.DESCRIPTION FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.gender = 'F' AND T1.ethnicity = 'american' GROUP BY T2.DESCRIPTION ORDER BY COUNT(T2.DESCRIPTION) DESC LIMIT 1
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
Which customer come from a place with more inhabitants, customer no.0 or customer no.1?
place with more inhabitants refers to GEOID where ID = 0 OR ID = 1 and MAX(NHABITANTS_K);
SELECT T1.ID FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.ID = 0 OR T1.ID = 1 ORDER BY INHABITANTS_K DESC LIMIT 1
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
Which country are the majority of the suppliers located?
majority of the suppliers located refers to MAX(COUNT(SupplierID))
SELECT Country FROM Suppliers GROUP BY Country ORDER BY COUNT(SupplierID) DESC LIMIT 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
What is the average height of an East conference All-star player?
average height refers to avg(height)
SELECT AVG(DISTINCT height) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE conference = 'East'
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
superstore
Which order of Logitech G600 MMO Gaming Mouse has the highest total cost?
Logitech G600 MMO Gaming Mouse refers to "Product Name"; highest total cost refers to MAX(SUTRACT(MULTIPLY(DIVIDE(Sales, SUTRACT(1, discount)), Quantity), Profit))
SELECT T1.`Order ID` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Logitech G600 MMO Gaming Mouse' GROUP BY T1.`Order ID` ORDER BY SUM((T1.Sales / (1 - T1.Discount)) * T1.Quantity - T1.Profit) DESC LIMIT 1
CREATE TABLE west_superstore ( Profit REAL, -- Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0 "Product ID" TEXT, -- foreign key ("Product ID", Region) references product("Product ID",Region), "Order Date" DATE, -- foreign key ("Customer ID", Reg...
software_company
Among the customers from a place with more than 20,000 and less than 30,000 inhabitants, how many of them are Machine-op-inspcts?
place with more than 20,000 and less than 30,000 inhabitants refers to GEOID where INHABITANTS_K BETWEEN 20 AND 30; OCCUPATION = 'Machine-op-inspct';
SELECT COUNT(T1.GEOID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Machine-op-inspct' AND T2.INHABITANTS_K > 20 AND T2.INHABITANTS_K < 30
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
How many employees report to Andrew Fuller?
"Andrew Fuller" refers to FirstName = 'Andrew' AND LastName = 'Fuller'; report to refers to ReportsTo ! = NULL
SELECT COUNT(EmployeeID) FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE LastName = 'Fuller' AND FirstName = 'Andrew' )
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
What is the first and last name of the player with the highest field goal made rate in 1973?
in 1973 refers to year = 1973; player with highest field goal made refers to Max(Divide(fgMade, fgAttempted))
SELECT T1.firstName, T1.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE year = 1973 ORDER BY CAST(T2.fgMade AS REAL) / T2.fgAttempted DESC LIMIT 1
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
synthea
What is the id of the patient whose hypertension started most recently?
id of the patient refers to PATIENT from conditions;  hypertension refers to DESCRIPTION = 'Hypertension'; most recently refers to MAX(START);
SELECT PATIENT FROM conditions WHERE START = ( SELECT MAX(START) FROM conditions WHERE DESCRIPTION = 'Hypertension' )
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
How many customers are from the place with the highest average income per month?
place with the highest average income per month refers to GEOID where MAX(INCOME_K);
SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID ORDER BY T2.INCOME_K DESC LIMIT 1
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
In which year did Around the Horn place the most orders?
Around the Horn is the CompanyName; year with the most order refers to Year (OrderDate) where Max(Count(OrderID))
SELECT STRFTIME('%Y', T2.OrderDate) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'Around the Horn' GROUP BY STRFTIME('%Y', T2.OrderDate) ORDER BY COUNT(T2.OrderID) DESC LIMIT 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
superstore
What are the names of the products with a profit of no less than 1,000 in one single order?
profit of no less than 1,000 refers to Profit > = 1000; names of the products refers to "Product Name"
SELECT DISTINCT T2.`Product Name` FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.Profit > 1000
CREATE TABLE west_superstore ( Profit REAL, -- Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0 "Product ID" TEXT, -- foreign key ("Product ID", Region) references product("Product ID",Region), "Order Date" DATE, -- foreign key ("Customer ID", Reg...
synthea
How many of the patients born in 1920s had pneumonia?
patients born in 1920s refer to patient where birthdate like '192%'; pneumonia refers to DESCRIPTION = 'Pneumonia' from conditions;
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE DESCRIPTION = 'Pneumonia' AND strftime('%Y', T1.birthdate) LIKE '192%'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
Among the male customers, how many of them come from a place with over 30,000 inhabitants?
SEX = 'Male', over 30,000 inhabitants refer to NHABITANTS_K > 30; place refers to GEOID;
SELECT COUNT(T1.GEOID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Male' AND T2.INHABITANTS_K > 30
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
Which company placed the order with the id 10257?
"10257" is the OrderID; company refers to CompanyName
SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10257
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
Which coach has serviced in NBA for more than 10 years.
"NBA" is the lgID; coach who serviced for more than 10 years refers to coachID where Subtract (Max(year), Min(year)) > 10
SELECT coachID FROM coaches WHERE lgID = 'NBA' GROUP BY coachID HAVING MAX(year) - MIN(year) > 10
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
synthea
State the average period of Ms. Angelena Kertzmann's several normal pregnancies.
DIVIDE(SUBTRACT(stop time - start time), COUNT(DESCRIPTION = 'Normal pregnancy')));
SELECT CAST(SUM(strftime('%J', T2.STOP) - strftime('%J', T2.START)) AS REAL) / COUNT(T2.PATIENT) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Ms.' AND T1.first = 'Angelena' AND T1.last = 'Kertzmann' AND T2.description = 'Normal pregnancy'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
Please list the occupations of the customers over 40 and have sent a true response to the incentive mailing sent by the marketing department.
over 40 refers to age > 40; RESPONSE = 'true';
SELECT DISTINCT T1.OCCUPATION FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.age > 40 AND T2.RESPONSE = 'true'
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
How many days was the fastest shipping of Berglunds snabbkp's order?
Berglunds snabbkp is the CompanyName; fastest shipping = Min(Subtract(ShippedDate, OrderDate))
SELECT datediff(T2.ShippedDate, T2.OrderDate) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'Berglunds snabbkp' ORDER BY datediff(T2.ShippedDate, T2.OrderDate) LIMIT 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
Among the Most improved Players awarded from 1985-1990, how many player whose country is USA?
the Most improved Player refers to award = 'Most Improved Player'; from 1985-1990 refers to year between 1985 and 1990; country is USA refers to birthCountry = 'USA'
SELECT COUNT(DISTINCT T2.playerID) FROM awards_players AS T1 INNER JOIN players AS T2 ON T1.playerID = T2.playerID WHERE T1.award = 'Most Improved Player' AND T2.birthCountry = 'USA' AND T1.year BETWEEN 1985 AND 1990
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
synthea
What is/are the ids of the tallest patient/s?
id of the tallest patient/s refers to PATIENT from observations where MAX(DESCRIPTION = 'Body Height');
SELECT PATIENT FROM observations WHERE DESCRIPTION = 'Body Height' AND UNITS = 'cm' ORDER BY VALUE DESC LIMIT 1
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are female?
RESPONSE = 'true'; SEX = 'Female';
SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.SEX = 'Female' AND T2.RESPONSE = 'true'
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
How many orders were from Hanna Moos company in 1999?
"Hanna Moos" is the CompanyName; in 1999 refer to YEAR (OrderDate) = 1999
SELECT COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1999' AND T1.CompanyName = 'Hanna Moos'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
superstore
List the products ordered by Becky Martin around the Central region.
ordered by Becky Martin refers to "Customer Name" = 'Becky Martin'; Region = 'Central'; products refers to "Product Name"
SELECT DISTINCT T3.`Product Name` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T2.`Product ID` WHERE T1.`Customer Name` = 'Becky Martin' AND T3.Region = 'Central'
CREATE TABLE west_superstore ( Profit REAL, -- Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0 "Product ID" TEXT, -- foreign key ("Product ID", Region) references product("Product ID",Region), "Order Date" DATE, -- foreign key ("Customer ID", Reg...
synthea
Among the patients that started taking Ibuprofen 200mg Oral Tablet in 2016, how many Dominican patients stopped taking the medicine after exactly one month?
Ibuprofen 200mg Oral Tablet refers to DESCRIPTION = 'Ibuprofen 200 MG Oral Tablet' from medications; started in 2016 refers to START like '2016%'; Dominican patients refer to ethnicity = 'dominican'; stopped taking the medicine after exactly one month refers to SUBTRACT(strftime('%m', STOP), strftime('%m', START)) = 1;
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Ibuprofen 200 MG Oral Tablet' AND T1.ethnicity = 'dominican' AND strftime('%Y', T2.START) = '2016' AND strftime('%m', T2.STOP) - strftime('%m', T2.START) = 1
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
How many female customers have an education level of over 11?
education level of 11 refers to EDUCATIONNUM = 11; SEX = 'Female';
SELECT COUNT(ID) FROM Customers WHERE EDUCATIONNUM > 11 AND SEX = 'Female'
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
Please calculate the number of orders from customers by country in 1996.
in 1996 refer to YEAR(OrderDate) = 1996; number of order = Count(OrderID)
SELECT COUNT(T2.CustomerID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1996' GROUP BY T1.Country
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
What is the full name of the team that the 'NBA Coach of the Year' 1992 winner coached?
"NBA Coach of the Year" is the award; in 1992 refers to year = 1992;
SELECT name FROM teams AS T1 INNER JOIN coaches AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN awards_coaches AS T3 ON T2.coachID = T3.coachID AND T2.year = T3.year WHERE T3.year = 1992 AND award = 'NBA Coach of the Year'
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
synthea
How many patients have the most prevalent conditions?
the most prevalent conditions refer to MAX(PREVALENCE RATE);
SELECT COUNT(DISTINCT T2.patient) FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) ORDER BY T1."PREVALENCE RATE" DESC LIMIT 1
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
Among the customers over 30, how many of them are Machine-op-inspcts?
over 30 refers to age > 30; OCCUPATION = 'Machine-op-inspct';
SELECT COUNT(ID) FROM Customers WHERE OCCUPATION = 'Machine-op-inspct' AND age > 30
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
Which company had the most orders in 1998?
in 1998 refers to YEAR (OrderDate) = 1998; most orders = Max(Count(CustomerID)); company refers to CompanyName
SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1998' GROUP BY T1.CompanyName ORDER BY COUNT(T2.OrderID) DESC LIMIT 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
superstore
How many customers in Chicago ordered at least 10 Cardinal EasyOpen D-Ring Binders in a single order?
at least 10 goods refers to Quantity > = 14; Cardinal EasyOpen D-Ring Binders refers to "Product Name"; customers in Chicago refers to City = 'Chicago'
SELECT COUNT(DISTINCT T1.`Customer ID`) FROM west_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` INNER JOIN product AS T3 ON T3.`Product ID` = T1.`Product ID` WHERE T3.`Product Name` = 'Cardinal EasyOpen D-Ring Binders' AND T2.City = 'Chicago' AND T1.Quantity > 10
CREATE TABLE west_superstore ( Profit REAL, -- Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0 "Product ID" TEXT, -- foreign key ("Product ID", Region) references product("Product ID",Region), "Order Date" DATE, -- foreign key ("Customer ID", Reg...
synthea
What are the full names of the patients who started taking Yaz 28 Day Pack in 2011?
full name refers to first, last; Yaz 28 Day Pack refers to DESCRIPTION = 'Yaz 28 Day Pack' from medications; started taking in 2011 refers to START like '2011%';
SELECT DISTINCT T1.first, T1.last, T1.suffix FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Yaz 28 Day Pack' AND strftime('%Y', T2.START) = '2011'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
Of the first 60,000 customers' responses to the incentive mailing sent by the marketing department, how many of them are considered a true response?
RESPONSE = 'true';
SELECT COUNT(REFID) custmoer_number FROM Mailings1_2 WHERE RESPONSE = 'true'
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
In 1996, how many orders were from customers in the UK?
in 1996 refers to YEAR (OrderDate) = 1996; 'UK' is the Country;
SELECT COUNT(T1.CustomerID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1996' AND T1.Country = 'UK'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
synthea
How many stroke patients have married?
stroke refers to conditions where DESCRIPTION = 'Stroke'; married refers to the marital status of the patient in which marital = 'M';
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Stroke' AND T1.marital = 'M'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
Please list the occupations of the customers with an education level of 11.
education level of 11 refers to EDUCATIONNUM = 11;
SELECT DISTINCT OCCUPATION FROM Customers WHERE EDUCATIONNUM = 11
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
How many sales representatives whose salaries are higher than 2000?
"Sales Representative" is the Title; higher than 2000 refers to Salary > 2000
SELECT COUNT(Title) FROM Employees WHERE Salary > 2000 AND Title = 'Sales Representative'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
How many players received Most Valuable Player award from 1969 to 1975?
Most Valuable Player award refers to award = 'Most Valuable Player'; from 1969 to 1975 refers to year between 1969 and 1975
SELECT COUNT(DISTINCT playerID) FROM awards_players WHERE year BETWEEN 1969 AND 1975 AND award = 'Most Valuable Player'
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
superstore
Name 10 products that were shipped first class from the East region.
shipped first class refers to "Ship Mode" = 'First Class'; Region = 'East'
SELECT T2.`Product Name` FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Mode` = 'First Class' AND T2.Region = 'East' LIMIT 10
CREATE TABLE west_superstore ( Profit REAL, -- Region TEXT, -- Example Values: `West` | Value Statics: Total count 6406 - Distinct count 1 - Null count 0 "Product ID" TEXT, -- foreign key ("Product ID", Region) references product("Product ID",Region), "Order Date" DATE, -- foreign key ("Customer ID", Reg...
synthea
How many Black patients were immunized with DTaP in 2013?
Black patients refer to patient where race = 'black'; immunized with DTaP refers to DESCRIPTION = 'DTaP' from immunizations; in 2013 refers to DATE like '2013%';
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T1.race = 'black' AND T2.DESCRIPTION = 'DTaP' AND strftime('%Y', T2.DATE) = '2013'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
Among all the customers, how many of them are teenagers?
teenager is a person aged between 13 and 19 years;
SELECT COUNT(ID) FROM Customers WHERE age >= 13 AND age <= 19
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
Who has the highest salary? Please give their first name.
highest salary refers to Max(Salary)
SELECT FirstName, LastName FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
What is the full name of the team that selected Mike Lynn?
full name refers to teams.name
SELECT T1.name FROM teams AS T1 INNER JOIN draft AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.draftYear WHERE T2.firstName = 'Mike' AND T2.lastName = 'Lynn'
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
synthea
List down the first name of patients who have cystitis condition.
cystitis refers to conditions where DESCRIPTION = 'Cystitis';
SELECT DISTINCT T1.first FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Cystitis'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
software_company
How many customers have never married?
MARITAL_STATUS = 'Never-married';
SELECT COUNT(ID) FROM Customers WHERE MARITAL_STATUS = 'Never-married'
CREATE TABLE Customers ( EDUCATIONNUM INTEGER, -- Example Values: `7`, `3`, `4`, `11`, `5` | Value Statics: Total count 100000 - Distinct count 17 - Null count 0 MARITAL_STATUS TEXT, -- Example Values: `Never-married`, `Married-civ-spouse`, `Divorced`, `Widowed`, `Other` | Value Statics: Total count 100000 - Disti...
retail_world
Please list the full names and titles of all employees.
full name refers to LastName, FirstName
SELECT FirstName, LastName, Title FROM Employees
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
From 1950 to 1970, how many coaches who received more than 1 award?
from 1950 to 1970 refers to year between 1950 and 1970; more than 3 awards refers to count(award) > 3
SELECT COUNT(coachID) FROM awards_coaches WHERE year BETWEEN 1950 AND 1970 GROUP BY coachID HAVING COUNT(coachID) > 1
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
synthea
List the ids of all the patients with condition that has a prevalence percentage of 18.8%.
ids of the patients refer to PATIENT from conditions; condition that has a prevalence percentage of 18.8% refers to PREVALENCE PERCENTAGE = 18.8;
SELECT DISTINCT T1.PATIENT FROM conditions AS T1 INNER JOIN all_prevalences AS T2 ON lower(T2.ITEM) = lower(T1.DESCRIPTION) WHERE T2."PREVALENCE PERCENTAGE" = CAST(18.8 AS float)
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
mondial_geo
What is the provincial capital of the province with a population of less than 80,000 that has the highest average population per area?
Average population per area = population / area
SELECT CapProv FROM province WHERE Population < 80000 ORDER BY Population / Area 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: `...
retail_world
What percentage of orders were placed by customers in Madrid city in 1996?
"Madrid" is the City; in 1996 refers to YEAR (OrderDate) = 1996; percentage = Divide (Count (CustomerID where City = 'Madrid'), Count (CustomerID)) * 100
SELECT CAST(COUNT(CASE WHEN T1.City = 'Madrid' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.City) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = 1996
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
How many teams in the NBA which has at least 3 all-star players?
NBA refers to lgID = 'NBA'; have at least 3 all-star players refers to count(player_allstar.playerID) > 3
SELECT COUNT(*) FROM ( SELECT tmID FROM players_teams AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.lgID = 'NBA' GROUP BY T1.tmID HAVING COUNT(DISTINCT T1.playerID) > 3 ) AS T3
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
synthea
List down the last name of patients who are allergic to dairy products.
allergic to dairy products refers to allergies where DESCRIPTION = 'Allergy to dairy product';
SELECT DISTINCT T1.last FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Allergy to dairy product'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
mondial_geo
Indicate the coordinates of all the deserts whose area is in more than one country.
coordinates consists of Latitude, Longitude
SELECT T1.Latitude, T1.Longitude FROM desert AS T1 INNER JOIN geo_desert AS T2 ON T1.Name = T2.Desert GROUP BY T1.Name, T1.Latitude, T1.Longitude HAVING COUNT(T1.Name) > 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: `...
retail_world
Which region does territory id 2116 belong to?
region refers to RegionDescription
SELECT T2.RegionDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T1.TerritoryID = 2116
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
synthea
How many immunizations did the patient with the most prevalent condition that started recently get?
patient with the most prevalent condition refers to patient where MAX(PREVALENCE RATE); started recently refers to MAX(START);
SELECT COUNT(T2.patient) FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) INNER JOIN immunizations AS T3 ON T2.PATIENT = T3.PATIENT GROUP BY T2.PATIENT ORDER BY T2.START DESC, T1."PREVALENCE RATE" DESC LIMIT 1
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
mondial_geo
List all deserts that are not between latitudes 30 and 40.
null
SELECT Name FROM desert WHERE Latitude < 30 OR Latitude > 40
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: `...
retail_world
Which region has the most territories?
region refers to RegionDescription; most territories refers to Max(Count(TerritoryID))
SELECT T2.RegionID FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID GROUP BY T2.RegionID ORDER BY COUNT(T1.TerritoryID) DESC LIMIT 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
Please list out the first name and last name of player who attended California college and have been selected as all stars?
California college refers to college = 'California'
SELECT DISTINCT T1.firstName, T1.lastName FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.college = 'California'
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
mondial_geo
What percentage of countries became independent during the year 1960?
Percentage = count(countries independent 1960) / total num of countries
SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', Independence) = '1960' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Country) FROM politics
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: `...
retail_world
How many territories are there in the Eastern region?
"Eastern" is the RegionDescription
SELECT COUNT(T1.RegionID) FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Eastern'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
Please list the team names which have at least 5 players were born in the same state.
team name refers to teams.name; state that a player is born refers to birthState
SELECT DISTINCT name FROM teams WHERE tmID IN ( SELECT tmID FROM players_teams AS T1 INNER JOIN players AS T2 ON T1.playerID = T2.playerID WHERE T2.birthState IS NOT NULL GROUP BY T1.tmID, T2.birthState HAVING COUNT(*) > 5 )
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
synthea
List down the address of patients who have billable period in 2010.
null
SELECT DISTINCT T1.address FROM patients AS T1 INNER JOIN claims AS T2 ON T1.patient = T2.PATIENT WHERE T2.BILLABLEPERIOD LIKE '2010%'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
mondial_geo
Lists all governments with a parliamentary democracy that achieved their independence between 01/01/1950 and 12/31/1999.
Inhabitants, synonymous with population
SELECT * FROM politics WHERE STRFTIME('%Y', Independence) BETWEEN '1950' AND '1999' AND Government = 'parliamentary democracy'
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: `...
retail_world
What is the average unit price of Tokyo Traders' products?
"Tokyo Traders" is the CompanyName; average unit price = AVG(UnitPrice)
SELECT SUM(T1.UnitPrice) / COUNT(T2.SupplierID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Tokyo Traders'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
synthea
Among the patients with hypertension, what is the average of their diastolic blood pressure?
hypertension refers to conditions where DESCRIPTION = 'Hypertension'; average diastolic blood pressure refers to AVG(VALUE) where DESCRIPTION = 'Diastolic Blood Pressure' from observations;
SELECT AVG(T1.VALUE) FROM observations AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient INNER JOIN conditions AS T3 ON T2.patient = T3.PATIENT WHERE T3.DESCRIPTION = 'Hypertension' AND T1.DESCRIPTION = 'Diastolic Blood Pressure'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
mondial_geo
What is the population density of the nation whose capital city is in the Distrito Federal province, and what portion of its gross domestic product is devoted to its industries?
ation and country are synonyms; Gross domestic product = GDP; Portion of GDP devoted to industries appears in economy.Industry; Population Density = Population / Area
SELECT T1.Population / T1.Area, T2.Industry FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Province = 'Distrito Federal'
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: `...
retail_world
Which company has the lowest unit price? Please give the company name and the product name.
lowest unit price refers to Min(UnitPrice)
SELECT T2.CompanyName, T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitPrice = ( SELECT MIN(UnitPrice) FROM Products )
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
How many players whose teams were ranked 6 in 1937?
ranked 6 refers to rank = 6; in 1937 refers to year = 1937
SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID INNER JOIN teams AS T3 ON T3.tmID = T2.tmID WHERE T3.year = 1937 AND T3.rank = 6
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
synthea
How many of the male patients are allergic to house dust mites?
male patients refer to PATIENT where gender = 'M'; allergic to house dust mites refers to allergies where DESCRIPTION = 'House dust mite allergy';
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'House dust mite allergy' AND T1.gender = 'M'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
mondial_geo
What other country does the most populated nation in the world share a border with and how long is the border between the two nations?
Nation and country are synonyms
SELECT T2.Country2, T2.Length FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 WHERE T1.Name = ( SELECT Name FROM country ORDER BY 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: `...
retail_world
How many products does the company Exotic Liquids supply?
"Exotic Liquids" is the CompanyName of supplier
SELECT COUNT(T1.ProductName) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Exotic Liquids'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
professional_basketball
Which player from "AFS" team has the tallest height?
"AFS" is the tmID; tallest height refers to Max(height)
SELECT T1.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.tmID = 'AFS' ORDER BY T1.height DESC LIMIT 1
CREATE TABLE players_teams ( PostGS INTEGER, -- PostdRebounds INTEGER, -- PostPF INTEGER, -- tmID TEXT, -- threeAttempted INTEGER, -- PostRebounds INTEGER, -- assists INTEGER, -- threeMade INTEGER, -- PostBlocks INTEGER, -- PostTurnovers INTEGER, -- GP INTEGER, -- lgID TEXT, -- Example...
synthea
What is the total number of Asian patients who are allergic to peanuts?
Asian refers to race like 'asian%'; allergic to peanuts refers to allergies where DESCRIPTION = 'Allergy to peanuts';
SELECT COUNT(T2.patient) FROM allergies AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Allergy to peanuts' AND T2.race = 'asian'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
mondial_geo
What year saw the greatest number of organizations created on the European continent?
null
SELECT STRFTIME('%Y', T4.Established) FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T2.Country = T3.Code INNER JOIN organization AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Europe' GROUP BY STRFTIME('%Y', T4.Established) ORDER BY COUNT(T4.Name) 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: `...