db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
human_resources
By what percentage is the average salary of Trainees higher than the minimum salary of this postion?
AVG(salary); Trainee is a position title; minimum salary refers to minsalary; calculation = DIVIDE(SUBTRACT(AVG(salary), minsalary), minsalary) * 100
SELECT 100 * (AVG(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) - CAST(REPLACE(SUBSTR(T2.minsalary, 4), ',', '') AS REAL)) / CAST(REPLACE(SUBSTR(T2.minsalary, 4), ',', '') AS REAL) AS per FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
world
List any five countries which use English as an official language.
English as an official language refers to `Language` = 'English' AND IsOfficial = 'T';
SELECT T1.Name FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND T2.IsOfficial = 'T' LIMIT 5
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...
superstore
What is the profit from selling the "O'Sullivan Living Dimensions 2-Shelf Bookcases"?
"O'Sullivan Living Dimensions 2-Shelf Bookcases" refers to "Product Name"
SELECT DISTINCT T1.Profit FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'O''Sullivan Living Dimensions 2-Shelf Bookcases'
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...
human_resources
What is the average salary of the employees who work as a Trainee?
average = DIVIDE( SUM(salary), COUNT(positiontitle) where positiontitle = 'Trainee'; Trainee is a position title
SELECT AVG(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) AS avg FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
world
List the countries and their official languages in Antarctica.
official language refers to IsOfficial = 'T'; Antarctica refers to Continent = 'Antarctica';
SELECT T1.Name, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Continent = 'Antarctica' AND T2.IsOfficial = 'T'
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...
human_resources
Among the employees who work as a Trainee, how many of them have a salary of over &20,000 a year?
Trainee is a position title; salary of over 20,000 refers to salary > '20000'
SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) > 20000 AND T2.positiontitle = 'Trainee'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
world
Provide the name, capital city and its official language of the country with the highest life expectancy.
capital city refers to Capital; official language refers to IsOfficial = 'T'; highest life expectancy refers to MAX(LifeExpectancy);
SELECT T1.Name, T1.Capital, T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode INNER JOIN City AS T3 ON T1.Code = T3.CountryCode WHERE T2.IsOfficial = 'T' ORDER BY T1.LifeExpectancy DESC LIMIT 1
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...
student_loan
How many unemployed students filed for bankruptcy?
unemployed students who filed for bankruptcy refers to unemployed.name who are IN filed_for_bankrupcy.name;
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T2.name = T1.name
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
superstore
Calculate the percentage of ordered office supplies products in the central and the south superstore.
office supplies products refers to Category = 'Office Supplies'; central refers to Region = 'Central'; south superstore refers to Region = 'South'; percentage = divide(SUM(Product ID where Category = 'Office Supplies'), count(Product ID)) * 100 where Region = 'Central' OR Region = 'South'
SELECT CAST(SUM(CASE WHEN T3.Category = 'Office Supplies' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.Category) 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`
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...
human_resources
Please list the social security numbers of all the employees who work in California.
social security numbers refers to ssn; California refers to state = 'CA'
SELECT T1.ssn FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'CA'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
world
List the languages used in Turkmenistan.
Turkmenistan is a name of country;
SELECT T2.Language FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Turkmenistan'
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...
human_resources
Please list the zip codes of the offices where all the male employees with a good job performance work at.
male employees refers to gender = 'M'; good job performance refers to performance = 'Good'
SELECT T2.zipcode FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.gender = 'M' AND T1.performance = 'Good'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
world
What is the capital city and population of San Marino?
capital city refers to Capital; San Marino is a name of country;
SELECT T1.Capital, T2.Population FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'San Marino'
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...
superstore
How many orders with a quantity greater than 5 have been shipped by the fastest delivery method?
orders with a quantity greater than 5 refers to Quantity > 5; shipped by the fastest delivery method refers to Ship Mode = 'First Class'
SELECT COUNT(DISTINCT `Order ID`) FROM central_superstore WHERE Quantity > 5 AND `Ship Mode` = 'First Class'
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...
human_resources
Which employee's job position requires a higher education level, Jose Rodriguez or Sandy Adams?
Jose Rodriguez AND Sandy Adams are the fullname of employee; full name = firstname, lastname; higher education level refers to MAX(educationrequired)
SELECT T1.firstname, T1.lastname FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE (T1.lastname = 'Adams' AND T1.firstname = 'Sandy') OR (T1.lastname = 'Rodriguez' AND T1.firstname = 'Jose') ORDER BY T2.educationrequired DESC LIMIT 1
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
world
How many cities are there in the country with the largest surface area?
largest surface area refers to MAX(SurfaceArea);
SELECT T2.ID FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode WHERE T1.SurfaceArea = ( SELECT MAX(SurfaceArea) FROM Country )
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...
student_loan
Provide the enlisted organizations of student160 and status of his/her payment due.
enlisted organizations refers to organ; student160 is a name of student; status of his or her payment due is mentioned in no_payment_due; bool = 'pos' means the student has payment due; bool = 'neg' means the student has no payment due;
SELECT T1.organ, T2.bool FROM enlist AS T1 INNER JOIN no_payment_due AS T2 ON T2.name = T1.name WHERE T1.name = 'student160'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
superstore
How many orders purchased by Aaron Bergman have been delivered with the slowest shipping speed?
slowest shipping speed refers to "Ship Mode" = 'Standard Class'
SELECT COUNT(*) FROM people AS T1 INNER JOIN central_superstore AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T1.`Customer Name` = 'Aaron Bergman' AND T2.`Ship Mode` = 'Standard Class'
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...
human_resources
Please list the full names of the employees who are working as a Trainee.
full name = firstname, lastname; trainees is a position title
SELECT T1.firstname, T1.lastname FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
world
How many cities are there in England?
England refers to District = 'England';
SELECT COUNT(ID) FROM City WHERE District = 'England'
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...
human_resources
Among the employees who are Trainees, how many of them work in New York?
Trainees is a position title; California refers to state = 'NY'
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Trainee' AND T2.state = 'NY'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
world
How many countries use Portuguese?
Portuguese refers to `Language` = 'Portuguese';
SELECT SUM(CASE WHEN Language = 'Portuguese' THEN 1 ELSE 0 END) FROM CountryLanguage
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...
student_loan
How many students are filed for bankruptcy?
null
SELECT COUNT(name) FROM filed_for_bankrupcy
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
superstore
Who was the customer in the South Region superstore who bought the most “Hon Multipurpose Stacking Arm Chairs"?
customer refers to "Customer Name"; “Hon Multipurpose Stacking Arm Chairs" is the "Product Name";
SELECT T2.`Customer Name` FROM south_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` = 'Hon Multipurpose Stacking Arm Chairs' GROUP BY T2.`Customer Name` ORDER BY COUNT(T2.`Customer Name`) 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...
human_resources
How much higher is James Johnson's salary from the minimum salary of his title?
James Johnson is the fullname of an employee; full name = firstname, lastname; minimum salary refers to minsalary; calculation = SUBTRACT(salary, minsalary)
SELECT CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) - CAST(REPLACE(SUBSTR(T2.minsalary, 4), ',', '') AS REAL) AS diff FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.lastname = 'Johnson' AND T1.firstname = 'James'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
world
List the languages used in the USA.
USA refers to CountryCode = 'USA';
SELECT Language FROM CountryLanguage WHERE CountryCode = 'USA'
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...
human_resources
How many employees work as an Account Representative?
work as an Account Representative refers to positiontitle = 'Account Representative'
SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Account Representative'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
world
Calculate the average population per city in Karnataka district.
average population = AVG(Population);
SELECT AVG(Population) FROM City WHERE District = 'Karnataka' GROUP BY ID
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...
student_loan
How many unemployed students have payment due?
have payment due refers to bool = 'pos';
SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN unemployed AS T2 ON T2.name = T1.name WHERE T1.bool = 'pos'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
superstore
How many of the "Hon Pagoda Stacking Chairs" have been sold in total in the west superstore?
Hon Pagoda Stacking Chairs' is the "Product Name"; west superstore refers to Region = 'West'
SELECT SUM(T1.Quantity) FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Hon Pagoda Stacking Chairs'
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...
human_resources
How many male employees work at the address 450 Peachtree Rd?
male employees refers to gender = 'M'
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.address = '450 Peachtree Rd' AND T1.gender = 'M'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
world
List any five countries which use English as an official language.
English as an official language refers to `Language` = 'English' AND IsOfficial = 'T';
SELECT T1.Name FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = 'English' AND T2.IsOfficial = 'T' LIMIT 5
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...
student_loan
What is the organization enlisted by student168?
organization refers to organ; student168 is a name of student;
SELECT organ FROM enlist WHERE name = 'student168'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
human_resources
What is the office phone number of the location at which Sandy Adams works?
Sandy Adams is the fullname of an employee; full name = firstname, lastname;
SELECT T2.officephone FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.lastname = 'Adams' AND T1.firstname = 'Sandy'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
world
Which country has the shortest life expectancy?
shortest life expectancy refers to MIN(LifeExpectancy);
SELECT Name FROM Country ORDER BY LifeExpectancy LIMIT 1
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...
student_loan
Calculate the percentage of female students.
percentage = CONCAT(DIVIDE(MULTIPLY(COUNT(person.name which is not in male.name)), 100), COUNT(person.name that is IN male.name),'%'); female students refers to person.name who are NOT in male.name;
SELECT CAST(SUM(IIF(T2.name IS NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.name) FROM person AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
superstore
List the name of all products that Cindy Stewart ordered in the east superstore.
name of all products refers to Product Name; Cindy Stewart is the Customer Name;
SELECT T3.`Product Name` FROM south_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` = 'Cindy Stewart'
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...
human_resources
Among the employees working at the office in New York, how many of them have a good job performance?
Sandy Adams is the fullname of an employee; full name = firstname, lastname; New York refers to state = 'NY'; good job performance refers to performance = 'Good';
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'NY' AND T1.performance = 'Good'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
hockey
In 1998, How many wins were made by team 'CAR' per game played? Who contributed the most goals? State the player ID.
year = 1998; wins per game played = DIVIDE(W, G); CAR refers to tmID; contributed the most goals refers to MAX(G);
SELECT CAST(T1.W AS REAL) / T1.G, T2.playerID FROM Teams AS T1 INNER JOIN Scoring AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.tmID = 'CAR' AND T1.year = 1998 GROUP BY T1.W / T1.G, T2.playerID ORDER BY SUM(T2.G) DESC LIMIT 1
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
superstore
What is the name of the product that Aimee Bixby bought?
name of the product refers to "Product Name"
SELECT DISTINCT T3.`Product Name` FROM east_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` = '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...
human_resources
In which city's office does Sandy Adams work at?
Sandy Adams is the fullname of an employee; full name = firstname, lastname; city refers to locationcity
SELECT T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.lastname = 'Adams' AND T1.firstname = 'Sandy'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
hockey
Which team has the highest winning rate in year 2000? State the team ID and list down the birth country of it's players.
MAX(DIVIDE(COUNT(W), SUM(COUNT(W), (COUNT (L)) where year = 2000;
SELECT DISTINCT T3.tmID, T1.birthCountry FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID INNER JOIN ( SELECT year, tmID FROM Teams WHERE year = 2000 ORDER BY W / (W + L) DESC LIMIT 1 ) AS T3 ON T2.tmID = T3.tmID AND T2.year = T3.year
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
student_loan
How many students enlist in the air force organization?
organization refers to organ; organ = 'air_force';
SELECT COUNT(name) FROM enlist WHERE organ = 'air_force'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
human_resources
Which position has a lower minimum salary, Account Representative or Trainee?
position of Account Representative refers to positiontitle = 'Account Representative'; position of Trainee refers to positiontitle = 'Trainee'; lower minimum salary refers to MIN(minsalary)
SELECT positiontitle FROM position WHERE positiontitle = 'Account Representative' OR positiontitle = 'Trainee' ORDER BY minsalary ASC LIMIT 1
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
movie_platform
Name movie titles released in year 1945. Sort the listing by the descending order of movie popularity.
released in the year 1945 refers to movie_release_year = 1945;
SELECT movie_title FROM movies WHERE movie_release_year = 1945 ORDER BY movie_popularity DESC LIMIT 1
CREATE TABLE ratings_users ( user_cover_image_url TEXT, -- user_avatar_image_url TEXT, -- rating_date_utc TEXT, -- user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S...
hockey
Who is the shortest player and state the team ID of that player from 1925 to 1936.
Shortest refers to MIN(height); from 1925 to 1936 refers to year between 1925 and 1936;
SELECT T2.playerID, T2.tmID FROM ( SELECT playerID FROM Master WHERE height IS NOT NULL ORDER BY height ASC LIMIT 1 ) AS T1 INNER JOIN ( SELECT DISTINCT playerID, tmID FROM Scoring WHERE year BETWEEN 1925 AND 1936 ) AS T2 ON T1.playerID = T2.playerID
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
superstore
List the name of all products in the west superstore that customers chose for same-day shipment in the year 2013.
name of all products refers to Product Name; same-day shipment refers to "Ship Mode" = 'Same Day'; year 2013 refers to "Ship Date" BETWEEN '2013-01-01' AND '2013-12-31'
SELECT T2.`Product Name` FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Mode` = 'Same Day' AND T1.`Ship Date` LIKE '2013%'
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...
student_loan
Please provide a disability breakdown for each school.
disability breakdown refers to the number of disabled students;
SELECT COUNT(T1.name) FROM enrolled AS T1 INNER JOIN disabled AS T2 ON T2.name = T1.name GROUP BY T1.school
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
human_resources
What is the required education for the position of regional manager?
required education refers to educationrequired; position of regional manager refers to  positiontitle = 'Regional Manager'
SELECT educationrequired FROM position WHERE positiontitle = 'Regional Manager'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
hockey
What are the total weights of players for team 'ANA' as per year 1997?
ANA refers to tmID;
SELECT SUM(T1.weight) FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1997 AND T2.tmID = 'ANA'
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
student_loan
How many students are enrolled in smc during month 1?
smc refers to school = 'smc';
SELECT COUNT(name) FROM enrolled WHERE school = 'smc' AND month = 1
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
superstore
What is the original price of the "Black Avery Flip-Chart Easel Binder"?
"Black Avery Flip-Chart Easel Binder" is the "Product Name"; original price = divide(Sales, subtract(1, Discount))
SELECT T1.Sales / (1 - T1.Discount) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Blackstonian Pencils'
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...
human_resources
Please list the social security numbers of the male employees with a salary of over $70,000 a year.
social security numbers refers to ssn; male employees refers to gender = 'M'; salary of over $70,000 a year refers to salary > '70000'
SELECT ssn FROM employee WHERE gender = 'M' AND CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) > 70000
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
hockey
In 2010, how many loses made by team 'BOS' and how many assists were made by the players?
year = 2010; BOS refers to tmID; loses refer to L; assists refer to A;
SELECT SUM(T1.L), SUM(T2.A) FROM Teams AS T1 INNER JOIN Scoring AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.tmID = 'BOS' AND T1.year = 2010
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
human_resources
How many emplyees have a good job performance?
good job performance refers to performance = 'Good'
SELECT COUNT(*) FROM employee WHERE performance = 'Good'
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
hockey
In 1976, how many goals achieved by team 'BIR' in Division 'EW'?
year = 1976; BIR refers to tmID; Division 'EW' refers to divID = 'EW'; goals = G;
SELECT SUM(T2.G) FROM Teams AS T1 INNER JOIN Scoring AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.divID = 'EW' AND T1.tmID = 'BIR' AND T1.year = 1976
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
student_loan
How many disabled male students joined an organization?
organization refers to organ; disabled male students refers to disabled.name who are IN male.name;
SELECT COUNT(T1.name) FROM disabled AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name INNER JOIN enlist AS T3 ON T3.name = T2.name
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
superstore
What is the total quantity that Cindy Stewart order "Lexmark X 9575 Professional All-in-One Color Printer" in the south superstore?
Lexmark X 9575 Professional All-in-One Color Printer' is the "Product Name"
SELECT SUM(T1.Quantity) FROM south_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` = 'Cindy Stewart' AND T3.`Product Name` = 'Lexmark X 9575 Professional All-in-One Color Printer'
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...
human_resources
Which employee has the highest salary? Please give his or her full name.
the highest salary refers to MAX(salary); full name = firstname, lastname
SELECT firstname, lastname FROM employee ORDER BY salary DESC LIMIT 1
CREATE TABLE position ( minsalary TEXT, -- Example Values: `US$25,000.00`, `US$50,000.00`, `US$18,000.00`, `US$100,000.00` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 maxsalary TEXT, -- Example Values: `US$75,000.00`, `US$150,000.00`, `US$25,000.00`, `US$250,000.00` | Value Statics: Total coun...
hockey
Calculate the total points scored by team ID ANA and list down the coashes of the team.
points scored refers to Pts; team ID refers to tmID;
SELECT SUM(T2.Pts), T1.coachID FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T2.tmID = T1.tmID WHERE T2.tmID = 'ANA' GROUP BY T1.coachID
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
student_loan
List out student names that enrolled in two schools and two organizations?
enrolled in two schools refers to COUNT(school) = 2; two organizations refers to COUNT(organ) = 2;
SELECT T.name FROM ( SELECT T1.name, COUNT(T1.organ) AS num FROM enlist AS T1 INNER JOIN enrolled AS T2 ON T1.name = T2.name GROUP BY T1.name ) T WHERE T.num = 2
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
cookbook
Among all recipes containing cheese, what is the percentage of recipes with calories greater than 200?
cheese is a category; calories greater than 200 refers to calories > 200; calculation = MULTIPLY(DIVIDE(COUNT(calories > 200 THEN recipe_id), COUNT(recipe_id)), 100)
SELECT CAST(SUM(CASE WHEN T4.calories > 200 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id INNER JOIN Nutrition AS T4 ON T4.recipe_id = T1.recipe_id WHERE T3.category = 'cheese'
CREATE TABLE Quantity ( ingredient_id INTEGER, -- quantity_id INTEGER primary key, min_qty REAL, -- foreign key (ingredient_id) references Ingredient(ingredient_id), foreign key (recipe_id) references Nutrition(recipe_id), foreign key (recipe_id) references Nutrition(recipe_id), unit TEXT, -- foreign key ...
hockey
What is the total number of game played for players from USA?
game played refers to GP; from USA refers to birthCountry = 'USA';
SELECT COUNT(T2.GP) FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T1.birthCountry = 'USA'
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
superstore
How many furniture products had been shipped by standard class in the East superstore?
furniture products refers to Category = 'Furniture'; shipped by standard class refers to "Ship Mode" = 'Standard Class'
SELECT COUNT(T2.Category) FROM east_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T1.`Ship Mode` = 'Standard Class'
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...
cookbook
Calculate the percentage of recipes with no cholesterol included and have a cooking time less than 20 minutes among all recipes.
no cholesterol refers to cholestrl = 0; cooking time less than 20 minutes refers to cook_min < 20; calculation = MULTIPLY(DIVIDE(COUNT(cholestrl = 0 THEN recipe_id), COUNT(recipe_id)), 100)
SELECT CAST(SUM(CASE WHEN T1.cook_min < 20 AND T2.cholestrl = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id
CREATE TABLE Quantity ( ingredient_id INTEGER, -- quantity_id INTEGER primary key, min_qty REAL, -- foreign key (ingredient_id) references Ingredient(ingredient_id), foreign key (recipe_id) references Nutrition(recipe_id), foreign key (recipe_id) references Nutrition(recipe_id), unit TEXT, -- foreign key ...
hockey
Which player ID are left winger and weight more than 200?
left winger refers to pos = 'L'; weight>200
SELECT DISTINCT playerID FROM Master WHERE pos LIKE '%L%' AND weight > 200 AND playerID IS NOT NULL AND pos = 'L'
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
student_loan
How many female students have no payment due?
have no payment due refers to bool = 'neg'; female students refers to name NOT in male table
SELECT COUNT(name) FROM no_payment_due WHERE name NOT IN ( SELECT name FROM male )
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
cookbook
What ingredients does the longest cooking time recipe have?
the longest cooking time refers to MAX(cook_min)
SELECT T3.name FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id ORDER BY T1.cook_min DESC LIMIT 1
CREATE TABLE Quantity ( ingredient_id INTEGER, -- quantity_id INTEGER primary key, min_qty REAL, -- foreign key (ingredient_id) references Ingredient(ingredient_id), foreign key (recipe_id) references Nutrition(recipe_id), foreign key (recipe_id) references Nutrition(recipe_id), unit TEXT, -- foreign key ...
hockey
Is there any coach who has not been a player before but has won award? State the ID.
coach who has not been a player means playerID is NULL and coachID is not NULL;
SELECT DISTINCT T2.coachID FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T1.playerID IS NULL
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
superstore
Compare the numbers of orders between the Eastern and Western stores in 2015.
in 2015 refers to strftime('%Y', "Order Date") = '2015'; Eastern store refers to east_superstore; Western store refers west_superstore;
SELECT east, west FROM ( SELECT COUNT(`Order ID`) AS east , ( SELECT COUNT(`Order ID`) FROM west_superstore WHERE `Order Date` LIKE '2015%' ) AS west FROM east_superstore WHERE `Order Date` LIKE '2015%' )
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...
cookbook
Identify recipes with different maximum and minimum quantities.
maximum quantities refers to max_qty; minimum quantities refers to max_qty <> min_qty
SELECT T1.title FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.max_qty <> T2.min_qty
CREATE TABLE Quantity ( ingredient_id INTEGER, -- quantity_id INTEGER primary key, min_qty REAL, -- foreign key (ingredient_id) references Ingredient(ingredient_id), foreign key (recipe_id) references Nutrition(recipe_id), foreign key (recipe_id) references Nutrition(recipe_id), unit TEXT, -- foreign key ...
hockey
How much is the total goals for player with player ID aaltoan01 and how old is this person?
total goals refer to SUM(G); how old = SUBTRACT(YEAR(CURDATE, birthYear);
SELECT SUM(T2.G), STRFTIME('%Y', CURRENT_TIMESTAMP) - T1.birthyear FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T1.playerID = 'aaltoan01' GROUP BY T1.birthyear
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
student_loan
Which school have the highest student enrollment? How many of those students are filed for bankruptcy?
highest student enrollment refers to MAX(COUNT(school));
SELECT T.school, num FROM ( SELECT T1.school, COUNT(T2.name) AS num FROM enrolled AS T1 LEFT JOIN filed_for_bankrupcy AS T2 ON T2.name = T1.name GROUP BY T1.school ) T ORDER BY T.num DESC LIMIT 1
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
superstore
Indicate the profit of product Sauder Camden County Barrister Bookcase, Planked Cherry Finish.
Sauder Camden County Barrister Bookcase, Planked Cherry Finish' refers to "Product Name"
SELECT DISTINCT T1.Profit FROM south_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.`Product Name` = 'Sauder Camden County Barrister Bookcase, Planked Cherry Finish'
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...
cookbook
List all the ingredients of Apricot Yogurt Parfaits.
Apricot Yogurt Parfaits refers to title
SELECT T3.name, T3.category FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Apricot Yogurt Parfaits'
CREATE TABLE Quantity ( ingredient_id INTEGER, -- quantity_id INTEGER primary key, min_qty REAL, -- foreign key (ingredient_id) references Ingredient(ingredient_id), foreign key (recipe_id) references Nutrition(recipe_id), foreign key (recipe_id) references Nutrition(recipe_id), unit TEXT, -- foreign key ...
hockey
What is the height and weight for coaches who have won awards in 1930?
year = 1930;
SELECT T1.height, T1.weight FROM Master AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year = '1930'
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
student_loan
Please provide a gender breakdown for each organization.
gender breakdown refers to the number of male and female; male are mentioned in male.name; female refers to enlist.name who are NOT in male.name; organization refers to organ;
SELECT IIF(T2.name IS NULL, 'female', 'male') AS gender FROM enlist AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name GROUP BY T1.organ
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
cookbook
How many recipes are non-dairy?
non-dairy refers to category NOT LIKE '%dairy"
SELECT COUNT(T2.recipe_id) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T2.ingredient_id = T1.ingredient_id INNER JOIN Nutrition AS T3 ON T3.recipe_id = T2.recipe_id WHERE T1.category NOT LIKE '%dairy%'
CREATE TABLE Quantity ( ingredient_id INTEGER, -- quantity_id INTEGER primary key, min_qty REAL, -- foreign key (ingredient_id) references Ingredient(ingredient_id), foreign key (recipe_id) references Nutrition(recipe_id), foreign key (recipe_id) references Nutrition(recipe_id), unit TEXT, -- foreign key ...
hockey
List down the first name of coaches who still coach after year 2000.
after year 2000 refers to year>2000;
SELECT DISTINCT T1.firstName FROM Master AS T1 INNER JOIN Coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year > 2000
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
cookbook
Which recipe has the highest calories?
the highest calories refers to MAX(calories)
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.calories DESC LIMIT 1
CREATE TABLE Quantity ( ingredient_id INTEGER, -- quantity_id INTEGER primary key, min_qty REAL, -- foreign key (ingredient_id) references Ingredient(ingredient_id), foreign key (recipe_id) references Nutrition(recipe_id), foreign key (recipe_id) references Nutrition(recipe_id), unit TEXT, -- foreign key ...
hockey
List down player ID of players who have passed away.
passed away means deathYear is not NULL;
SELECT DISTINCT playerID FROM Master WHERE deathYear IS NOT NULL AND playerID IS NOT NULL
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
student_loan
List out students that enrolled in occ school and enlisted in a fire department.
occ school refers to school = 'occ'; department refers to organ; organ = 'fire_department';
SELECT T1.name FROM enlist AS T1 INNER JOIN enrolled AS T2 ON T2.name = T1.name WHERE T2.school = 'occ' AND T1.organ = 'fire_department'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
superstore
What product category that Sam Craven ordered from the central and east superstore?
null
SELECT DISTINCT T3.Category FROM east_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` LEFT JOIN central_superstore AS T4 ON T3.`Product ID` = T4.`Product ID` WHERE T2.`Customer Name` = 'Sam Craven'
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...
cookbook
List the names of recipes that can lead to constipation.
lead to constipation refers to iron > 20
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.iron > 20
CREATE TABLE Quantity ( ingredient_id INTEGER, -- quantity_id INTEGER primary key, min_qty REAL, -- foreign key (ingredient_id) references Ingredient(ingredient_id), foreign key (recipe_id) references Nutrition(recipe_id), foreign key (recipe_id) references Nutrition(recipe_id), unit TEXT, -- foreign key ...
hockey
What is the full name of players origin from Finland?
origin from Finland refers to birthCountry = 'Finland';
SELECT DISTINCT firstName, lastName FROM Master WHERE birthCountry = 'Finland'
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
student_loan
What is the percentage difference between month 0 absence and month 9 absence?
percentage difference = CONCAT(DIVIDE(MULTIPLY(SUBTRACT(COUNT(name WHERE month = 0), COUNT(name WHERE month = 9)), 100), COUNT(name WHERE month = 0)),'%');
SELECT CAST(((SUM(IIF(month = 0, 1, 0)) - SUM(IIF(month = 9, 1, 0)))) AS REAL) * 100 / SUM(IIF(month = 0, 1, 0)) FROM longest_absense_from_school
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
superstore
How many furniture products were ordered at central superstore?
furniture products refers to Category = 'Furniture'
SELECT COUNT(*) FROM central_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` WHERE T2.Category = 'Furniture'
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...
cookbook
How many dairy recipes can serve more than 10 people?
dairy recipes refers to category = 'dairy'; serve more than 10 people refers to servings > 10
SELECT COUNT(*) FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T3.category = 'dairy' AND T1.servings > 10
CREATE TABLE Quantity ( ingredient_id INTEGER, -- quantity_id INTEGER primary key, min_qty REAL, -- foreign key (ingredient_id) references Ingredient(ingredient_id), foreign key (recipe_id) references Nutrition(recipe_id), foreign key (recipe_id) references Nutrition(recipe_id), unit TEXT, -- foreign key ...
hockey
Who is the heaviest player? State player ID of 5 heaviest players.
5 heaviest players refer to MAX(weight) limit to 5 playerID;
SELECT playerID FROM Master ORDER BY weight DESC LIMIT 5
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
student_loan
How many students is disabled and unemployed at the same time?
students who are disabled and unemployed at the same time refers to disabled.name = unemployed.name;
SELECT COUNT(T1.name) FROM disabled AS T1 INNER JOIN unemployed AS T2 ON T2.name = T1.name
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
superstore
What product category got the least sales in the west superstore?
least sales refers to Sales = MIN(Sales)
SELECT T2.Category FROM west_superstore AS T1 INNER JOIN product AS T2 ON T1.`Product ID` = T2.`Product ID` ORDER BY T1.Sales 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...
cookbook
What is the average vitamin C amount of all cakes?
average vitamin C refers to AVG(vitamin_c); all cakes refers to title LIKE '%cake%'
SELECT AVG(T1.vitamin_c) FROM Nutrition AS T1 INNER JOIN Recipe AS T2 ON T2.recipe_id = T1.recipe_id WHERE T2.title LIKE '%cake%'
CREATE TABLE Quantity ( ingredient_id INTEGER, -- quantity_id INTEGER primary key, min_qty REAL, -- foreign key (ingredient_id) references Ingredient(ingredient_id), foreign key (recipe_id) references Nutrition(recipe_id), foreign key (recipe_id) references Nutrition(recipe_id), unit TEXT, -- foreign key ...
hockey
State the player ID of player with average height of 75.
average height of 75 refers to AVG(height) = 75;
SELECT DISTINCT playerID FROM Master GROUP BY playerID HAVING AVG(height) = 75
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
student_loan
List out female students that enrolled in occ school and ulca?
female students refers to enrolled.name who are NOT in male.name; occ school and ulca refers to school IN('occ', 'ulca');
SELECT name FROM enrolled WHERE school IN ('occ', 'ulca') AND name NOT IN ( SELECT name FROM male )
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
superstore
What is the highest profit order in the East superstore of customers from Houston, Texas?
highest profit refers to max(Profit); Houston, Texas refers to City = 'Houston' and State = 'Texas'
SELECT T1.`Order ID` FROM east_superstore AS T1 INNER JOIN people AS T2 ON T1.`Customer ID` = T2.`Customer ID` WHERE T2.City = 'Houston' AND T2.State = 'Texas' ORDER BY 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...
cookbook
List the names of alcohol free recipes.
alcohol free refers to alcohol = 0
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.alcohol = 0
CREATE TABLE Quantity ( ingredient_id INTEGER, -- quantity_id INTEGER primary key, min_qty REAL, -- foreign key (ingredient_id) references Ingredient(ingredient_id), foreign key (recipe_id) references Nutrition(recipe_id), foreign key (recipe_id) references Nutrition(recipe_id), unit TEXT, -- foreign key ...
hockey
State the player ID and coach ID of person who have become coach after retirement.
after retirement means playerID Iis not NULL and coachID is not NULL;
SELECT playerID, coachID FROM Master WHERE playerID IS NOT NULL AND coachID IS NOT NULL
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
student_loan
How many unemployed students are enlisted in the Army organization?
organization refers to organ; organ = 'army';
SELECT COUNT(T1.name) FROM enlist AS T1 INNER JOIN unemployed AS T2 ON T2.name = T1.name WHERE T1.organ = 'army'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
cookbook
How many ingredients are required to make the Raspberry Chiffon Pie?
Raspberry Chiffon Pie refer to title
SELECT COUNT(*) FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Raspberry Chiffon Pie'
CREATE TABLE Quantity ( ingredient_id INTEGER, -- quantity_id INTEGER primary key, min_qty REAL, -- foreign key (ingredient_id) references Ingredient(ingredient_id), foreign key (recipe_id) references Nutrition(recipe_id), foreign key (recipe_id) references Nutrition(recipe_id), unit TEXT, -- foreign key ...
hockey
What's the decrease rate of the game plays did David Aebischer after he got traded in 2005?
DIVIDE(SUBTRACT(SUM(GP(year = 2005), SUM(GP(year = 2006)), SUM(GP(year = 2005)) as percentage;
SELECT CAST((SUM(CASE WHEN T1.year = 2005 THEN T1.GP ELSE 0 END) - SUM(CASE WHEN T1.year = 2006 THEN T1.GP ELSE 0 END)) AS REAL) * 100 / SUM(CASE WHEN T1.year = 2005 THEN T1.GP ELSE 0 END) FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T2.firstName = 'David' AND T2.lastName = 'Aebischer'
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...