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
Identify the total number of orders placed by the customer 'Laughing Bacchus Wine Cellars' and it's average value.
'Laughing Bacchus Wine Cellars' refers to CompanyName; calculation = DIVIDE(SUM(UnitPrice * Quantity * SUBTRACT(1, Discount)), COUNT(OrderID))
SELECT COUNT(T2.OrderID) , SUM(T3.UnitPrice * T3.Quantity * (1 - T3.Discount)) / COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID WHERE T1.CompanyName = 'Laughing Bacchus Wine Cellars'
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 players from the ABA league, how many of them have the center position?
"ABA" is the lgID; center position refers to pos =   'C' or pos = 'F-C'; players refers to playerID
SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T2.lgID = 'ABA' AND (T1.pos = 'C' OR T1.pos = 'F-C')
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
Please list the names of all the customers who had ordered the product "Telescoping Adjustable Floor Lamp".
"Telescoping Adjustable Floor Lamp" is a product name; names of all the customers refers to "Customer Name"
SELECT DISTINCT T1.`Customer 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 T3.`Product Name` = 'Telescoping Adjustable Floor Lamp'
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 allergies does Mrs. Saundra Monahan have?
allergies refer to PATIENT from allergies;
SELECT COUNT(DISTINCT T2.code) FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mrs.' AND T1.first = 'Saundra' AND T1.last = 'Monahan'
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
Describe the average income per month and yearly income of the geographic ID in which customer of ID "209556" and "290135".
the average income per month refers to INCOME_K; yearly income of geographic ID refers to GEOID where MULTIPLY(INHABITANTS_K, INCOME_K, 12);
SELECT T2.INCOME_K, T2.INHABITANTS_K * T2.INCOME_K * 12 FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.ID = 209556 OR T1.ID = 290135
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...
world
How many countries have Socialistic Republic form of government?
Socialistic Republic form of government refers to GovernmentForm = 'Socialistic Republic';
SELECT COUNT(Code) FROM Country WHERE GovernmentForm = 'Socialistic Republic'
CREATE TABLE Country ( `Name` TEXT NOT NULL DEFAULT '', -- `SurfaceArea` REAL NOT NULL DEFAULT 0.00, -- `Continent` TEXT NOT NULL DEFAULT 'Asia', -- Example Values: `North America`, `Asia`, `Africa`, `Europe`, `South America` | Value Statics: Total count 239 - Distinct count 7 - Null count 0 `Population` INT...
retail_world
Name products and their quantity ordered by the company 'GROSELLA-Restaurante' in the sales order that was processed by Nancy Davolio.
name products refers to ProductName; 'GROSELLA-Restaurante' refers to CompanyName; 'Nancy Davolio' is the full name of an employee; full name refers to FirstName, LastName;
SELECT T4.ProductName, T3.Quantity FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID INNER JOIN Products AS T4 ON T3.ProductID = T4.ProductID INNER JOIN Customers AS T5 ON T2.CustomerID = T5.CustomerID WHERE T1.FirstName = 'Nancy' A...
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
Find the response status to customer whose geographic ID of 134.
GEOID = 134;
SELECT T2.RESPONSE FROM Customers AS T1 INNER JOIN mailings3 AS T2 ON T1.ID = T2.REFID WHERE T1.GEOID = 134
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...
world
What is the local name of Ukraine that they are also known for?
Ukraine is a name of country;
SELECT LocalName FROM Country WHERE Name = 'Ukraine'
CREATE TABLE Country ( `Name` TEXT NOT NULL DEFAULT '', -- `SurfaceArea` REAL NOT NULL DEFAULT 0.00, -- `Continent` TEXT NOT NULL DEFAULT 'Asia', -- Example Values: `North America`, `Asia`, `Africa`, `Europe`, `South America` | Value Statics: Total count 239 - Distinct count 7 - Null count 0 `Population` INT...
retail_world
Calculate the total number of orders placed by the company 'GROSELLA-Restaurante'.
'GROSELLA-Restaurante' refers to CompanyName;
SELECT COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'GROSELLA-Restaurante'
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 teams have winning rate less than 50%?
team with winning rate less than 50% refers to Divide (won, Sum(won, lost)) < 0.5
SELECT name FROM teams WHERE CAST(won AS REAL) * 100 / (won + lost) < 50
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
Please list the names of all the products ordered by Aimee Bixby in 2016.
ordered by Aimee Bixby refers to "Customer Name" = 'Aimee Bixby'; ordered n 2016 refers to strftime('%Y', "Order Date") = '2016';
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` = 'Aimee Bixby' AND STRFTIME('%Y', T2.`Ship Date`) = '2016'
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 condition among the patients who received influenza seasonal injectable preservative free immunization?
the most common condition refers to MAX(DESCRIPTION) from conditions; patients who received influenza seasonal injectable preservative free immunization refer to PATIENT where DESCRIPTION = 'Influenza seasonal injectable preservative free' from immunizations;
SELECT T2.DESCRIPTION FROM immunizations AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T1.DESCRIPTION = 'Influenza seasonal injectable preservative free' 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
Among the geographic ID which has 33.658K of inhabitants, describe the education, occupation and age of female widow.
geographic ID which has 33.658K of inhabitants refers to GEOID where INHABITANTS_K = 33.658; education refers to EDUCATIONNUM; female widow refers to SEX = 'Female' where MARITAL_STATUS = 'Widowed';
SELECT T1.EDUCATIONNUM, T1.OCCUPATION, T1.age FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INHABITANTS_K = 33.658 AND T1.SEX = 'Female' AND T1.MARITAL_STATUS = 'Widowed'
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
Provide the full name of the employee who processed the sales order with ID 10274.
full name refers to FirstName, LastName; sales order with ID 10274 refers to OrderID = 10274
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10274
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
Among the customers who have ordered the product "Telescoping Adjustable Floor Lamp", how many of them are consumers?
"Telescoping Adjustable Floor Lamp" is a "Product Name"; consumers refers to Segment = 'Consumer';
SELECT COUNT(DISTINCT T1.`Customer 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 T3.`Product Name` = 'Telescoping Adjustable Floor Lamp' AND T1.Segment = 'Consumer'
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
Find out the yearly income of geographic ID when the customer is female and occupation as sales.
yearly income of geographic ID refers to GEOID where MULTIPLY(INHABITANTS_K, INCOME_K, 12); SEX = 'Female';
SELECT T2.INHABITANTS_K * T2.INCOME_K * 12 FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Female' AND T1.OCCUPATION = 'Sales'
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
Find the percentage of discontinued products in Northwind's portfolio of products.
discontinued products refers to Discontinued = 1; calculation = DIVIDE(SUM(Discontinued = 1), COUNT(ProductID)) * 100
SELECT CAST(COUNT(CASE WHEN Discontinued = 1 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(ProductID) 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
Who are the coaches for team with winning rate of 80% and above?
winning rate of 80% and above refers to Divide (won, Sum(won, lost)) > 0.8; coaches refers to coachID
SELECT coachID FROM coaches GROUP BY tmID, coachID, won, lost HAVING CAST(won AS REAL) * 100 / (won + lost) > 80
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 age of the patient with hypertension named Giovanni Russel?
age refers to SUBTRACT(strftime('%Y', deathdate), strftime('%Y', birthdate)); hypertension refers to conditions where DESCRIPTION = 'Hypertension';
SELECT strftime('%Y', T2.deathdate) - strftime('%Y', T2.birthdate) AS age FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T2.first = 'Giovanni' AND T2.last = 'Russel' AND T1.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
Point out the greater one between the number of actual responding and not responding to mailing.
COUNT(REFID where RESPONSE = 'true')>or<COUNT(REFID where RESPONSE = 'false');
SELECT RESPONSE FROM Mailings1_2 GROUP BY RESPONSE ORDER BY COUNT(RESPONSE) 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
What is the average value of the sales order?
calculation = DIVIDE(SUM(UnitPrice * Quantity * SUBTRACT(1, Discount)), COUNT(OrderID))
SELECT SUM(UnitPrice * Quantity * (1 - Discount)) / COUNT(OrderID) FROM `Order Details`
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 players that went to high school in New York and have won the MVP, what is their average height?
high school in New York refers to highSchool like '%New York%'; won the MVP refers to award = 'Most Valuable Player'; average height = Divide (Sum(height), Count(playerID))
SELECT AVG(T1.height) FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Most Valuable Player' AND T1.birthCity = 'New York'
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 orders has Aimee Bixby made?
Aimee Bixby made refers to "Customer Name" = 'Aimee Bixby';
SELECT COUNT(DISTINCT T2.`Order ID`) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Aimee Bixby'
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 Asian female patients take oxaliplatin 5 MG/ML [Eloxatin]?
female refers to gender = 'F'; oxaliplatin 5 MG/ML [Eloxatin] refers to medications where DESCRIPTION = 'oxaliplatin 5 MG/ML [Eloxatin]';
SELECT COUNT(DISTINCT T2.patient) FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'oxaliplatin 5 MG/ML [Eloxatin]' AND T2.race = 'asian' AND T2.gender = 'F'
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
What is the geographic ID and total income per year when the average income is above 3300 dollar.
total income per year refers to MULTIPLY(12, INHABITANTS_K, INCOME_K) where INCOME_K > 3300; geographic ID refers to GEOID;
SELECT GEOID, INHABITANTS_K * INCOME_K * 12 FROM Demog WHERE INCOME_K > 3300
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
Identify the number of employees in Northern sales region.
Northern sales region refers to RegionDescription = 'Northern'
SELECT COUNT(T2.EmployeeID) FROM Territories AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.TerritoryID = T2.TerritoryID INNER JOIN Region AS T3 ON T1.RegionID = T3.RegionID WHERE T3.RegionDescription = 'Northern'
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 total minutes has the Brooklyn-born player, known by the name of Superman, played during all of his NBA All-Star seasons?
"Brooklyn" is the birthCity of player; known by the name of Superman refers to nameNick like '%Superman%'; total minutes refers to Sum(minutes)
SELECT SUM(T2.minutes) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.birthCity = 'Brooklyn' AND T1.nameNick LIKE '%Superman%'
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 total quantity of "Telescoping Adjustable Floor Lamp" ordered from central superstores?
"Telescoping Adjustable Floor Lamp" is a "Product Name"; from central superstores refers to Region = 'Central';
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` = 'Telescoping Adjustable Floor Lamp'
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
What is the ratio of male and female among the age of teenager when the education is above 10?
ratio = DIVIDE(COUNT(SEX = 'Male' where age BETWEEN 13 AND 19 and EDUCATIONNUM > 10),COUNT(SEX = 'Female' where age BETWEEN 13 AND 19 and EDUCATIONNUM > 10));
SELECT CAST(SUM(CASE WHEN SEX = 'Male' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN SEX = 'Female' THEN 1 ELSE 0 END) FROM Customers WHERE age BETWEEN 13 AND 19 AND EDUCATIONNUM > 10
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
Identify the customer, which placed the largest order in terms of value.
value refers to SUM(UnitPrice * Quantity * SUBTRACT(1, Discount)); the largest order in value refers to MAX(value)
SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID GROUP BY T2.CustomerID ORDER BY SUM(T3.UnitPrice * T3.Quantity * (1 - T3.Discount)) 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
Calculate the average period of Mr. Wesley Lemke's care plans.
DIVIDE(SUBTRACT(stop time - start time), COUNT(ID)));
SELECT CAST(SUM(strftime('%J', T2.STOP) - strftime('%J', T2.START)) AS REAL) / COUNT(T1.patient) FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mr.' AND T1.first = 'Wesley' AND T1.last = 'Lemke'
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
List the income and number of inhabitants of customers with a reference ID greater than the 50% of average of number of false response?
reference ID greater than the 50% of average of number of false response refers to REFID > DIVIDE(MULTIPLY(0.5, COUNT(RESPONSE = 'false')), COUNT(RESPONSE)); income refers to INCOME_K; number of inhabitants refer to INHABITANTS_K;
SELECT T2.INCOME_K, T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID INNER JOIN Mailings1_2 AS T3 ON T1.ID = T3.REFID WHERE T3.REFID > ( SELECT 0.5 * COUNT(CASE WHEN RESPONSE = 'false' THEN 1 ELSE NULL END) / COUNT(RESPONSE) FROM Mailings1_2 )
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
Identify the name and product category for the most expensive and the least expensive products.
name of product refers to ProductName; category of product refers to CategoryName; the most expensive products refers to MAX(UnitPrice); the least expensive products refers to MIN(UnitPrice);
SELECT T2.ProductName, T1.CategoryName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.UnitPrice IN (( SELECT MIN(UnitPrice) FROM Products ), ( SELECT MAX(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
Please list the top ten teams with the highest scores in 2000.
in 2000 refers to year = 2000; team with highest score refers to Max(o_fgm)
SELECT tmID FROM players_teams WHERE year = 2000 GROUP BY tmID ORDER BY SUM(PostPoints) DESC LIMIT 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 prevalence rate of condition no. 368581000119106.
condition no. 368581000119106 refers to conditions where CODE = '368581000119106';
SELECT DISTINCT T1."PREVALENCE RATE" FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) WHERE T2.code = '368581000119106'
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
In male customers with an occupation handlers or cleaners, what is the percentage of customers with a true response?
DIVIDE(COUNT(OCCUPATION = 'Handlers-cleaners', SEX = 'Male' and RESPONSE = 'true'), COUNT(OCCUPATION = 'Handlers-cleaners' and SEX = 'Male')) as percentage;
SELECT CAST(SUM(CASE WHEN T2.RESPONSE = 'true' THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(T2.REFID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.OCCUPATION = 'Handlers-cleaners' 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
Calculate the production volume of the dairy product 'Mascarpone Fabioli'.
'Mascarpone Fabioli' is a ProductName; calculation = SUM(UnitsInStock, UnitsOnOrder)
SELECT SUM(UnitsInStock + UnitsOnOrder) FROM Products WHERE ProductName = 'Mascarpone Fabioli'
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
In which league did the player who weighs 40% less than the heaviest player and whose height is 80 inches play?
weigh 40% less than the heaviest player refers to weight = Multiply(Max (weight), 0.6); league refers to lgID
SELECT T2.lgID FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID GROUP BY T2.lgID, T1.weight HAVING T1.weight = MAX(T1.weight) - MAX(T1.weight) * 0.4
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
Please list the IDs of the orders made by Aimee Bixby with more than 3 kinds of products ordered.
made by Aimee Bixby refers to "Customer Name" = 'Aimee Bixby'; with more than 3 kinds of products ordered refers to count("Product ID") > 3;
SELECT DISTINCT T2.`Order ID` FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Aimee Bixby' GROUP BY T2.`Product ID` HAVING COUNT(T2.`Product ID`) > 3
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
Give the procedure description of Ms. Jacquelyn Shanahan on 2009/8/9.
on 2009/8/9 refers to DATE = '2009-08-09';
SELECT DISTINCT T2.description FROM patients AS T1 INNER JOIN procedures AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Ms.' AND T1.first = 'Jacquelyn' AND T1.last = 'Shanahan' AND T2.DATE = '2009-08-09'
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
What is the occupation and response of female customers within the number of inhabitants range of 20 to 25?
female customers within the number of inhabitants range of 20 to 25 refer to SEX = 'Female' where INHABITANTS_K BETWEEN 20 AND 25;
SELECT DISTINCT T1.OCCUPATION, T2.RESPONSE 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 T1.SEX = 'Female' AND T3.INHABITANTS_K >= 20 AND T3.INHABITANTS_K <= 25
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
Identify the name of the most popular dairy product in terms of reorder quantity.
'dairy product' refers to CategoryName; most popular reorder quantity refers to MAX(ReorderLevel)
SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.CategoryName = 'Dairy Products' AND T2.ReorderLevel = ( SELECT MAX(ReorderLevel) 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...
superstore
Among all the orders made by Aimee Bixby, what was the longest shipment time?
made by Aimee Bixby refers to "Customer Name" = 'Aimee Bixby'; longest shipment time refers to MAX(SUM(SUTRACT(julianday("Ship Date"), julianday("Order Date")), 1))
SELECT MAX(strftime('%J', `Ship Date`) - strftime('%J', `Order Date`)) AS longestTimeDays FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Aimee Bixby'
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
Why did Mrs. Annabelle Pouros take leucovorin 100 mg injection on 1970/12/19? State the reason.
reason why take leucovorin 100 mg injection refers to REASONDESCRIPTION where DESCRIPTION = 'Leucovorin 100 MG Injection'; on 1970/12/19 refers to START = '1970-12-19';
SELECT T2.reasondescription FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Mrs.' AND T1.first = 'Annabelle' AND T1.last = 'Pouros' AND T2.start = '1970-12-19' AND T2.description = 'Leucovorin 100 MG Injection'
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 divorced male customers, give the income and response of those who has an level of education of 6 and above.
divorced male customers refer to SEX = 'Male' where MARITAL_STATUS = 'Divorced';
SELECT DISTINCT T3.INCOME_K, T2.RESPONSE 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 T1.EDUCATIONNUM > 6 AND T1.SEX = 'Male' AND T1.MARITAL_STATUS = 'Divorced'
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
Under the in-charge of inside sales coordinator, provide the product lists which were shipped to Mexico in 1996.
shipped to Mexico refers to ShipCountry = 'Mexico'; in 1996 refers to year(ShippedDate) = 1996; charge of inside sales coordinator refers to Title = 'Inside Sales Coordinator'
SELECT T4.ProductName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID INNER JOIN Products AS T4 ON T3.ProductID = T4.ProductID WHERE T1.Title = 'Inside Sales Coordinator' AND T2.ShippedDate LIKE '1996%' AND T2.ShipCountry = 'Mexic...
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 players who have won the award of Rookie of the year, what is the height of the tallest player?
"Rookie of the Year" is the award; tallest player refers to Max(height)
SELECT T1.height FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Rookie of the Year' 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...
superstore
Who is the customer who purchased the largest total cost of products in a single order?
largest total cost refers to MAX(SUTRACT(MULTIPLY(DIVIDE(Sales, SUTRACT(1, discount)), Quantity), Profit))
SELECT T2.`Customer Name` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` GROUP BY T1.`Order ID`, T2.`Customer Name` 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...
synthea
What is the prevalence percentage of condition no. 64859006?
condition no. 64859006 refers to conditions where CODE = '64859006';
SELECT DISTINCT T1."PREVALENCE PERCENTAGE" FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON lower(T1.ITEM) = lower(T2.DESCRIPTION) WHERE T2.code = '64859006'
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
What is the age of female customers within the number of inhabitants below 30?
female customers within the number of inhabitants below 30 refer to SEX = 'Female' where INHABITANTS_K < 30;
SELECT age FROM Customers WHERE GEOID IN ( SELECT GEOID FROM Demog WHERE INHABITANTS_K < 30 ) 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
Describe the ordered products which were the most overdue from required date.
the most overdue from required date refers to MIN(SUBTRACT(ShippedDate, RequiredDate) < 0)
SELECT DISTINCT T3.ProductName FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE DATEDIFF(T1.ShippedDate, T1.RequiredDate) < 0
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
List the procedures received by Emmy Waelchi.
procedures refer to DESCRIPTION from procedures;
SELECT T2.DESCRIPTION FROM patients AS T1 INNER JOIN procedures AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Emmy' AND T1.last = 'Waelchi'
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
List the marital status and response of female customers with an level of education of 8 and above.
female customers with an level of education of 8 and above refer to SEX = 'Female' where EDUCATIONNUM ≥ 8;
SELECT DISTINCT T1.MARITAL_STATUS, T2.RESPONSE FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.EDUCATIONNUM > 8 AND T1.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
Provide Speedy Express's phone number and number of shipped orders on 30th January, 1998.
Speedy Express's refers to CompanyName = 'Speedy Express'; orders on 30th January, 1998 refers to ShippedDate = '1998-01-30 00:00:00'
SELECT T2.Phone, COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Speedy Express' AND T1.ShippedDate LIKE '1998-01-30%' GROUP BY T2.Phone
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 income of female customers ages from 30 to 55 years old and has an occupation of machine-op-inspct?
female customers ages from 30 to 55 years old refer to SEX = 'Female' where age BETWEEN 30 AND 55; income refers to INCOME_K;
SELECT T2.INCOME_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Female' AND T1.age >= 30 AND T1.age <= 55 AND T1.OCCUPATION = 'Machine-op-inspct'
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
Among the products under grains/cereals category, provide the contact person and title of the supplier with one digit ID.
grains/cereals category refers to CategoryName = 'Grains/Cereals'; supplier with one digit ID refers to SupplierID between 1 and 10;
SELECT DISTINCT T1.ContactName, T1.ContactTitle FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN Categories AS T3 ON T2.CategoryID = T3.CategoryID WHERE T3.CategoryName = 'Grains/Cereals' AND T1.SupplierID BETWEEN 1 AND 10 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 birth date of the player who has won the most MVPs.
won the most MVP refers to Max(Count(award = 'Most Valuable Player'))
SELECT T1.birthDate FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Most Valuable Player' GROUP BY T1.playerID, T1.birthDate ORDER BY COUNT(award) 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...
software_company
List the educationnum and response of customers within the age of 20 to 30 that has the highest number of inhabitants among the group.
age of 20 to 30 refers to age BETWEEN 20 AND 30; the highest number of inhabitants refers to MAX(INHABITANTS_K);
SELECT T1.EDUCATIONNUM, T2.RESPONSE 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 T1.age >= 20 AND T1.age <= 30 ORDER BY T3.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
Provide the list of products ordered by ID 10979 and calculate its total payment.
ordered by ID 10979 refers to OrderID = '10979'; total payment refers to SUM(MULTIPLY(UnitPrice, Quantity, SUBTRACT(1, Discount)))
SELECT T1.ProductName , SUM(T2.UnitPrice * T2.Quantity * (1 - T2.Discount)) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10979 GROUP BY T1.ProductName
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 players born in Whitestone, how many of them have won the MVP?
"Whitestone" is the birthCity of the player; won the MVP refers to award = 'Most Valuable Player'
SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T2.award = 'Most Valuable Player' AND T1.birthCity = 'Houston'
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
Please list the names of all the products ordered in order CA-2011-112326 in superstores in the center.
names of all the products refers to "Product Name"; order CA-2011-112326 refers to "Order ID" = 'CA-2011-112326'; in the center refers to Region = 'Central';
SELECT DISTINCT T2.`Product Name` FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Order ID` = 'CA-2011-112326'
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
In male customers ages from 30 to 50, how many of them has an income ranges from 2000 to 2300?
male customers ages from 30 to 50 refer to SEX = 'Male' where age BETWEEN 30 AND 50; income ranges from 2000 to 2300 refers to INCOME_K BETWEEN 2000 AND 3000;
SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Male' AND T1.age >= 30 AND T1.age <= 50 AND T2.INCOME_K >= 2000 AND T2.INCOME_K <= 2300
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
Mention the supplier country of Ipoh Coffee and the order ID which had maximum in total payment.
Ipoh Coffee refers to ProductName = 'Ipoh Coffee'; maximum in total payment refers to MAX(MULTIPLY(UnitPrice, Quantity, SUBTRACT(1, Discount)))
SELECT T3.Country, T1.OrderID FROM `Order Details` AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Suppliers AS T3 ON T2.SupplierID = T3.SupplierID WHERE T2.ProductName = 'Ipoh Coffee' ORDER BY T1.UnitPrice * T1.Quantity * (1 - T1.Discount) 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 name of the coach who has served more than 2 NBA teams.
"NBA" is the lgID; server more than 2 teams refers to Count(tmID) = 2
SELECT coachID FROM coaches GROUP BY coachID HAVING COUNT(DISTINCT tmID) > 2
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 code of the prevalent disease with the highest occurrences?
null
SELECT T2.code FROM all_prevalences AS T1 INNER JOIN conditions AS T2 ON T1.ITEM = T2.DESCRIPTION ORDER BY T1.OCCURRENCES 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
List the level of education and income of customers ages from 30 to 55 with a true response.
ages from 30 to 55 refer to age BETWEEN 30 AND 55; RESPONSE = 'true'; income refers to INCOME_K; education level refers to EDUCATIONNUM;
SELECT T1.EDUCATIONNUM, T3.INCOME_K 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 T1.age >= 30 AND T1.age <= 55 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
Among the supplied products from Australia, describe the discontinued products and the category.
from Australia refers to Country = 'Australia'; discontinued products refers to Discontinued = 1;
SELECT T2.ProductName, T3.CategoryName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN Categories AS T3 ON T2.CategoryID = T3.CategoryID WHERE T1.Country = 'Australia' AND T2.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...
professional_basketball
For the players who belongs to the east conference, please list the name of the college they went to.
belong to the east conference refers to divID = 'EA'
SELECT DISTINCT T1.college FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.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...
synthea
Provide the number of encounters for Major D'Amore.
null
SELECT COUNT(T2.ID) FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Major' AND T1.last = 'D''Amore'
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 female customers with an level of education of 3 and below, list their income.
female customers with level of education of 3 and below refer to SEX = 'Female' where EDUCATIONNUM ≤ 3; income refers to INCOME_K;
SELECT INCOME_K FROM Demog WHERE GEOID IN ( SELECT GEOID FROM Customers WHERE EDUCATIONNUM < 3 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
Calculate the total production for each product which were supplied from Japan
from Japan refers to Country = 'Japan'; total production refers to ADD(UnitsInstock, UnitsOnOrder)
SELECT SUM(T1.UnitsInStock + T1.UnitsOnOrder) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Japan'
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 players from the NBL league, how many of them were born in Spencer?
"NBL" is the lgID; 'Spencer' is the birthCity
SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN players_teams AS T2 ON T1.playerID = T2.playerID WHERE T1.birthCity = 'Spencer' AND T2.lgID = 'NBL'
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...
software_company
What is the response and number of inhabitants of the oldest female customer?
number of inhabitants refers to INHABITANTS_K; oldest female customer refers to SEX = 'Female' where MAX(age);
SELECT T2.RESPONSE, T3.INHABITANTS_K 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 T1.SEX = 'Female' ORDER BY T1.age 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
Find the total payment of the orders by customers from San Francisco.
from San Francisco refers to City = 'San Francisco'; total payment refers to sum(MULTIPLY(UnitPrice, Quantity, SUBTRACT(1, Discount)))
SELECT SUM(T3.UnitPrice * T3.Quantity * (1 - T3.Discount)) AS TOTALPAYMENT FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID WHERE T1.City = 'San Francisco'
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 maximum weight of USA all-star players?
"USA" is the birthCountry of player;  maximum weight refers to Max(weight)
SELECT MAX(T1.weight) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.birthCountry = 'USA'
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
Provide at least 5 social security numbers of patients with a prevalent disease with a prevalence percentage lower than 30% of the average prevalence percentage of conditions.
social security number refers to ssn; prevalence percentage lower than 30% of the average prevalence percentage of conditions refers to PREVALENCE PERCENTAGE < MULTIPLY(0.3, AVG(PREVALENCE PERCENTAGE));
SELECT DISTINCT T2.ssn FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient INNER JOIN all_prevalences AS T3 ON lower(T1.DESCRIPTION) = lower(T3.ITEM) WHERE CAST(T3."PREVALENCE PERCENTAGE" AS REAL) * 100 / ( SELECT AVG('PREVALENCE PERCENTAGE') FROM all_prevalences ) < 30 LIMIT 5
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
List down the number of inhabitants of customers with a widowed marital status and false response .
number of inhabitants refers to INHABITANTS_K; RESPONSE = 'false';
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 T1.MARITAL_STATUS = 'Widowed' 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
Calculate the average payment per product under confections category.
under confections category refers to CategoryName = 'Confections';
SELECT SUM(T2.UnitPrice * T2.Quantity * (1 - T2.Discount)) / COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Categories AS T3 ON T1.CategoryID = T3.CategoryID WHERE T3.CategoryName = 'Confections'
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 minimum weight of all-star players coming from UCLA college?
minimum weight refers to Min(weight)
SELECT MIN(T1.weight) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.college = 'UCLA'
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
Give the social security number of the female Irish patient allergic to grass pollen.
social security number refers to ssn; female refers to gender = 'F'; Irish refers to ethnicity = 'irish'; allergic to grass pollen refers to allergies where DESCRIPTION = 'Allergy to grass pollen';
SELECT T2.ssn FROM allergies AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Allergy to grass pollen' AND T2.ethnicity = 'irish' AND T2.gender = 'F'
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
What is the marital status of the customer ages 62 with an level of education of 7?
customer ages 62 with an level of education of 7 refer age = 62 where EDUCATIONNUM = 7;
SELECT DISTINCT MARITAL_STATUS FROM Customers WHERE EDUCATIONNUM = 7 AND age = 62
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
List down the territory IDs and descriptions existed in Southern region.
in Southern region refers to RegionDescription = 'Southern';
SELECT T1.TerritoryID, T1.TerritoryDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Southern'
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 players who were born after 1950, who had offence rebounds rates more than 30%? Please list their last names and first names.
born after 1950 refers to birthDate > = '1950-01-01'; offence rebound rate more than 30% refers to Divide (oRebounds, rebounds) > 0.3
SELECT DISTINCT T1.lastName, T1.firstName FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.birthDate > 1950 AND CAST(T2.o_rebounds AS REAL) * 100 / T2.rebounds > 30
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...
software_company
In geographic identifier from 10 to 30, how many of them has an income below 2000?
GEOID BETWEEN 10 AND 30; INCOME_K < 2000;
SELECT COUNT(GEOID) FROM Demog WHERE INCOME_K < 2000 AND GEOID >= 10 AND GEOID <= 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
Mention the oldest empoyee's full name, title, salary and number of orders which were shipped to USA by him.
full name refers to FirstName, LastName; shipped to USA refers to ShipCountry = 'USA'
SELECT T1.FirstName, T1.LastName, T1.Title, T1.Salary , COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE ShipCountry = 'USA' GROUP BY T1.FirstName, T1.LastName, T1.Title, T1.Salary, T1.BirthDate ORDER BY T1.BirthDate 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 players who went to high school in Chicago, how many of them belongs to the west conference?
high school in Chicago refers to hsCity = 'Chicago'; belong to the west conference refers to divID = 'WE'
SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.hsCity = 'Chicago' AND T2.conference = 'West'
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...
software_company
List down the geographic identifier with an number of inhabitants less than 30.
geographic identifier with an number of inhabitants less than 30 refers to GEOID where INHABITANTS_K < 30;
SELECT GEOID FROM Demog WHERE 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
Among orders shipping to Brazil, mention the supplier company of the order which was done by employee Anne Dodsworth in December, 1996 .
shipping to Brazil refers to ShipCountry = 'Brazil'; in December, 1996  refers to year(OrderDate) = 1996 and month(OrderDate) = 12;
SELECT T5.CompanyName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID INNER JOIN Products AS T4 ON T3.ProductID = T4.ProductID INNER JOIN Suppliers AS T5 ON T4.SupplierID = T5.SupplierID WHERE T1.FirstName = 'Anne' AND T1.LastName...
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 1960 to 1970, what is the total point of all-star players who are still alive?
from 1960 to 1970 refers to season_id between 1960 and 1970; still alive refers to deathDate = '0000-00-00'
SELECT SUM(T2.points) FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.season_id BETWEEN 1960 AND 1970 AND T1.deathDate = '0000-00-00'
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
Among the orders made by Aimee Bixby, how many of them included at least one kind of product under the category "Furniture"?
made by Aimee Bixby refers to "Customer Name" = 'Aimee Bixby';
SELECT COUNT(DISTINCT T2.`Order ID`) 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 T3.Category = 'Furniture' AND T1.`Customer Name` = 'Aimee Bixby'
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
What is the total number of widowed customers with an age below 50?
widowed customers with an age below 50 refer to MARITAL_STATUS = 'Widowed' where age < 50;
SELECT COUNT(ID) FROM Customers WHERE MARITAL_STATUS = 'Widowed' AND age < 50
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
Provide the products list which were ordered in 1996 by the company in Norway.
ordered in 1996 refers to year(OrderDate) = 1996; in Norway refers to Country = 'Norway'
SELECT T4.ProductName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID INNER JOIN Products AS T4 ON T3.ProductID = T4.ProductID WHERE T1.Country = 'Norway' AND 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
Among the coaches who have served more than 2 NBA teams, during which coach's period of coaching, a team has the least numbers of games lost in the post-season games?
served more than 2 NBA teams refers to count (tmID) > = 2; least number of game lost in post season refers to Min(post_losses)
SELECT coachID FROM coaches WHERE lgID = 'NBA' AND post_wins != 0 AND post_losses != 0 AND coachID IN ( SELECT coachID FROM coaches WHERE lgID = 'NBA' GROUP BY coachID HAVING COUNT(tmID) > 2 ) ORDER BY post_losses ASC 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...
software_company
List down the customer's reference ID with true response.
reference ID refers to REFID;
SELECT REFID 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
How many orders were made by the customers in Ireland.
in Ireland refers to Country = 'Ireland';
SELECT COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Country = 'Ireland'
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 3 all-star players.
team with at least 3 all star player refers to tmID where Count(player_allstar.playerID) > = 3
SELECT T1.tmID FROM players_teams AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID GROUP BY T1.tmID HAVING COUNT(DISTINCT T1.playerID) >= 3
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...
software_company
How many of the customer's reference ID that has a TRUE response?
reference ID refers to REFID;
SELECT COUNT(REFID) 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
Provide the list of product IDs and names under the meat/poultry category.
meat/poultry category refers to CategoryName = 'Meat/Poultry';
SELECT T2.ProductName, T1.CategoryName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.ReorderLevel = ( SELECT MAX(ReorderLevel) 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
Of all the teams coached by the winner of the 1994 NBA Coach of the Year award, which team has lost the most times playing at home?
of 1994 refers to year = 1994; 'NBA Coach of the Year' is the award; lost the most time at home refers to Max(homeLost)
SELECT T3.tmID FROM awards_coaches AS T1 INNER JOIN coaches AS T2 ON T1.coachID = T2.coachID INNER JOIN teams AS T3 ON T3.tmID = T2.tmID WHERE T1.year = 1994 AND T1.award = 'NBA Coach of the Year' GROUP BY T3.tmID ORDER BY SUM(T3.homeLost) 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...