db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
synthea
How many patients immunized against 'monovalent rotavirus' ceased their care plan on 11/23/2013?
immunized against monovalent rotavirus refers to immunizations.DESCRIPTION = 'rotavirus monovalent'; ceased their care plan on 11/23/2013 refers to careplans.STOP = '2013-11-23';
SELECT COUNT(DISTINCT T1.patient) FROM careplans AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'rotavirus monovalent' AND T1.STOP = '2013-11-23'
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...
cs_semester
List the student's email with grade of B in a course with difficulty greater than the 80% of average difficulty of all courses.
difficulty refers to diff; course with difficulty greater than the 80% of average difficulty refers to diff > MULTIPLY(AVG(diff), 80%);
SELECT T2.email FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T1.grade = 'B' GROUP BY T3.diff HAVING T3.diff > AVG(T3.diff) * 0.8
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@...
human_resources
Describe the employees' full name, positions, located city and office phone number within Colorado state.
full name = firstname, lastname; Colorado state refers to state = 'CO'; positions refers to positiontitle; located city refers to locationcity; office phone number refers to officephone;
SELECT T1.firstname, T1.lastname, T3.positiontitle, T2.locationcity, T2.officephone 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 T2.state = 'CO'
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
Who is the youngest player who is still living. State the given name and date of birth.
still living refers to deathYear IS NULL; youngest refers to MAX(birthYear,birthMon,birthDay)
SELECT nameGiven , nameGiven , birthYear, birthMon, birthDay FROM Master WHERE deathYear IS NULL ORDER BY birthYear DESC, birthMon DESC, birthday 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...
synthea
What is the average body weight of Asian patients?
average = AVG(observations.VALUE WHERE observations.DESCRIPTION = 'Body Weight' AND observations.UNITS = 'kg'); body weight refers to observations.DESCRIPTION = 'Body Weight'; Asian refers to race = 'asian';
SELECT SUM(T2.VALUE) / COUNT(T1.patient) FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.race = 'asian' AND T2.DESCRIPTION = 'Body Weight' AND T2.UNITS = 'kg'
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...
cs_semester
List the course's name where students acquired a grade of D.
null
SELECT T1.name FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'D'
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@...
human_resources
Write down the full name, performance status and located city of the employee who's social security number is "767-74-7373".
full name = firstname, lastname; ssn = '767-74-7373'
SELECT T1.firstname, T1.lastname, T2.state, T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.ssn = '767-74-7373'
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
Who are the players who were not in the Hall of Fame list.
not in the Hall of Fame refers to hofID IS NULL
SELECT firstName, lastName FROM Master WHERE hofID 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...
human_resources
What is the education required to be account representative? Mention account representative full name and salary who got poor in performance status.
account representative is a position title; full name = firstname, lastname; poor performance refers to performance = 'Poor'
SELECT T2.educationrequired, T1.firstname, T1.lastname, T1.salary FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Poor' AND 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...
hockey
List all players' given name who are good at both left and right hand and playing the forward position.
good at both left and right hand refers to shootCatch IS NULL;  playing the forward position refers to pos = 'F'
SELECT nameGiven FROM Master WHERE shootCatch IS NULL AND pos = 'F'
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...
cs_semester
What is the average teaching ability of the most popular professors?
average = AVG(teachingability); most popular professor refers to MAX(popularity);
SELECT CAST(SUM(teachingability) AS REAL) / COUNT(prof_id) FROM prof WHERE popularity = ( SELECT MAX(popularity) FROM prof )
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@...
human_resources
Among the employees with poor performance, provide the managers' full names, location city, address and its zip code.
poor performance refers to performance = 'Poor'; full name = firstname, lastname; managers is a position title
SELECT T1.firstname, T1.lastname, T2.locationcity, T2.address, T2.zipcode 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 = 'Manager' AND T1.performance = 'Poor'
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
List the first Name and last name of all players not from USA and who are born in 1990 .
Not from USA refers to birthCountry! = 'USA'; born in 1990 refers to birthYear = 1990
SELECT firstName, lastName FROM Master WHERE birthYear = 1990 AND 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...
synthea
Who is the patient with a body weight of 61.97 kg?
body weight of 61.97 kg refers to observations.DESCRIPTION = 'Body Weight' AND observations.VALUE = 61.97; observations.UNITS = 'kg'
SELECT T2.first, T2.last FROM observations AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Body Weight' AND T1.UNITS = 'kg' AND T1.VALUE = 61.97
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...
cs_semester
Among students with low salary, how many of them have a gpa of 3.5?
low salary refers to salary = 'low';
SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.gpa = 3.5 AND T1.salary = 'low'
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@...
human_resources
Mention the full name, hired date and performance status of the employee whose location is in Utah state.
full name = firstname, lastname; Utah refers to state = 'UT'
SELECT T1.firstname, T1.lastname, T1.hiredate, T1.performance FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'UT'
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...
image_and_language
What is the average width and height of the objects in image ID 47? List their object classes as well.
The bounding box's W and H abbreviations stand for the object's width and height in which average width and height refer to AVG(W) and AVG(H) respectively; image ID 47 refers to IMG_ID = 47; object classes refer to OBJ_CLASS;
SELECT T2.OBJ_CLASS, AVG(T1.W), AVG(T1.H) FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 47 GROUP BY T2.OBJ_CLASS
CREATE TABLE OBJ_CLASSES ( OBJ_CLASS TEXT not null, -- OBJ_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE ATT_CLASSES ( ATT_CLASS TEXT not null, -- ATT_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE IMG_OBJ_ATT ( IMG_ID INTEGER default 0 not null, -- foreign key (IMG_ID...
synthea
List 5 patients' name that need medication due to streptococcal sore throat disorder.
patients name = first, last; streptococcal sore throat disorder refers to medications.REASONDESCRIPTION = 'Streptococcal sore throat (disorder)';
SELECT DISTINCT T2.first, T2.last FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.REASONDESCRIPTION = 'Streptococcal sore throat (disorder)' 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...
cs_semester
Find the most important and most difficult courses.
most important refers to MAX(credit); most difficult refers to MAX(diff);
SELECT name FROM course WHERE credit = ( SELECT MAX(credit) FROM course ) AND diff = ( SELECT MAX(diff) FROM course )
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@...
human_resources
List the full names, gender and positions who's location is in New York city.
full name = firstname, lastname; New York city refers to locationcity = 'New York City'
SELECT T1.firstname, T1.lastname, T1.gender, T3.positiontitle 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 T2.locationcity = 'New York City'
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...
image_and_language
How many 'blue' attribute classes are there on image ID 2355735?
blue' attribute classes on image ID 2355735 refer to ATT_CLASS = 'blue' where IMG_ID = 2355735;
SELECT COUNT(T1.ATT_CLASS) FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T2.IMG_ID = 2355735 AND T1.ATT_CLASS = 'blue'
CREATE TABLE OBJ_CLASSES ( OBJ_CLASS TEXT not null, -- OBJ_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE ATT_CLASSES ( ATT_CLASS TEXT not null, -- ATT_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE IMG_OBJ_ATT ( IMG_ID INTEGER default 0 not null, -- foreign key (IMG_ID...
olympics
What is the percentage of female competitors whose heights are over 170 that participated in the game in 1988?
DIVIDE(COUNT(person_id where gender = 'F' and height > 170), COUNT(person_id)) as percentage where games_year = 1988;
SELECT CAST(COUNT(CASE WHEN T3.gender = 'F' AND T3.height > 170 THEN 1 END) AS REAL) * 100 / COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_year = 1988
CREATE TABLE event ( event_name TEXT default NULL, -- sport_id INTEGER default NULL, -- foreign key (sport_id) references sport(id), id INTEGER not null primary key, ); CREATE TABLE sport ( id INTEGER not null primary key, sport_name TEXT default NULL, -- ); CREATE TABLE city ( city_name TEXT default NUL...
cs_semester
Among the students with less than four intelligence, list the full name and phone number of students with a greater than 3 GPA.
intelligence < 4; full name = f_name, l_name; gpa > 3;
SELECT f_name, l_name, phone_number FROM student WHERE gpa > 3 AND intelligence < 4
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@...
human_resources
What are the maximum and minimum salary range and position title of Bill Marlin?
Bill Marlin is the full name of an employee; full name = firstname, lastname; maximum salary refers to maxsalary; minimum salary refers to minsalary
SELECT T2.maxsalary, T2.minsalary, T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Bill' AND T1.lastname = 'Marlin'
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...
image_and_language
Give the X and Y coordinates of the sample object of image ID 23 that has the 'cast' attribute class.
X and Y refer to coordinates of the bounding box; image ID 23 refers to IMG_ID = 23; 'cast' attribute class refers to ATT_CLASS = 'cast';
SELECT T3.OBJ_SAMPLE_ID, T3.X, T3.Y FROM ATT_CLASSES AS T1 INNER JOIN IMG_OBJ_ATT AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.IMG_ID = T3.IMG_ID WHERE T3.IMG_ID = 23 AND T1.ATT_CLASS = 'cast'
CREATE TABLE OBJ_CLASSES ( OBJ_CLASS TEXT not null, -- OBJ_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE ATT_CLASSES ( ATT_CLASS TEXT not null, -- ATT_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE IMG_OBJ_ATT ( IMG_ID INTEGER default 0 not null, -- foreign key (IMG_ID...
synthea
Among the male patients, list down 5 birth dates of patients taking the medication "Penicillin V Potassium 250 MG".
male patients refers to gender = 'M'; Penicillin V Potassium 250 MG refers to medications.DESCRIPTION = 'Penicillin V Potassium 250 MG';
SELECT DISTINCT T2.birthdate FROM medications AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Penicillin V Potassium 250 MG' AND T2.gender = 'M' 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...
cs_semester
Among the professors with a teachability of 3 and below, what is the percentage of their student advisees with a low salary?
teachability < = 3; percentage = MULTIPLY(DIVIDE(COUNT(salary = 'low'), COUNT(salary)), 1.0);
SELECT CAST(SUM(CASE WHEN T1.salary = 'low' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.salary) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability < 3
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@...
human_resources
When was Emily Wood hired? Mention her position and salary.
Emily Wood is the full name of an employee; full name = firstname, lastname; when was she hired refers to hiredate
SELECT T1.hiredate, T2.positiontitle, T1.salary FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Emily' AND T1.lastname = 'Wood'
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...
image_and_language
Count the number of 'dress' object classes and include their X and Y coordinates in image ID 1764.
dress' object classes refer to OBJ_CLASS = 'dress'; image ID 1764 refers to IMG_ID = 1764; X and Y refer to coordinates of the bounding box;
SELECT T1.X, T1.Y FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.IMG_ID = 1764 AND T2.OBJ_CLASS = 'dress'
CREATE TABLE OBJ_CLASSES ( OBJ_CLASS TEXT not null, -- OBJ_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE ATT_CLASSES ( ATT_CLASS TEXT not null, -- ATT_CLASS_ID INTEGER default 0 not null primary key, ); CREATE TABLE IMG_OBJ_ATT ( IMG_ID INTEGER default 0 not null, -- foreign key (IMG_ID...
cs_semester
Calculate the average satisfaction of the good students with their courses.
average satisfaction = DIVIDE(SUM(sat), COUNT(course_id)); satisfaction refers to sat; good student refers to grade = 'B';
SELECT CAST(SUM(sat) AS REAL) / COUNT(course_id) FROM registration WHERE grade = 'B'
CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `npigford0@...
mondial_geo
Where country does Baghdad belongs to?
Baghdad is one of provinces
SELECT Name FROM country WHERE Province = 'Baghdad'
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
What is the average quantity of Ikura ordered in one order?
average = AVG(Quantity); Ikura refers to ProductName = 'Ikura';
SELECT CAST(SUM(T2.Quantity) AS REAL) / COUNT(T2.OrderID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductName = 'Ikura'
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...
video_games
How many games are not of the genres 'Role-Playing', 'Shooter' and 'Simulation'?
not of the genres 'Role-Playing', 'Shooter' and 'Simulation' refers to genre_name NOT IN ('Role-Playing', 'Shooter', 'Simulation');
SELECT COUNT(T2.id) FROM genre AS T1 INNER JOIN game AS T2 ON T1.id = T2.genre_id WHERE T1.genre_name NOT IN ('Role-Playing', 'Shooter', 'Simulation')
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
soccer_2016
Provide the names and birthdates of players who have left-arm fast skills.
player's name refers to Player_Name; birthdate refers to DOB; have left-arm fast skills refers to Bowling_skill = 'Left-arm fast'
SELECT T1.Player_Name, T1.DOB FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T2.Bowling_Id = T1.Bowling_skill WHERE T2.Bowling_skill = 'Left-arm fast'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
Please list the names of the countries with an inflation rate that's 30% above the average.
Average inflation rate = [sum(inflation) / count(countries)]; 30% above average implies inflation > 1.3 average inflation rate
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country GROUP BY T1.Name, T2.Inflation HAVING T2.Inflation > AVG(T2.Inflation) * 1.3
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
How much lower in percentage is the unit price of Ikura in order no. 10273 than its standard unit price?
how much lower in percentage = MULTIPLY(DIVIDE(SUBTRACT(Products.UnitPrice, Order Details.UnitPrice), Products.UnitPrice), 100); Ikura refers to ProductName = 'Ikura'; order no. refers to OrderID;
SELECT CAST((T1.UnitPrice - T2.UnitPrice) AS REAL) * 100 / T1.UnitPrice FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10273 AND T1.ProductName = 'Ikura'
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...
shakespeare
In "Twelfth Night, Or What You Will", what is the description of the chapter in 2nd scene, Act 2?
"Twelfth Night, Or What You Will"  refers to LongTitle = 'Twelfth Night, Or What You Will'; 2nd scene refers to Scene = 2
SELECT T2.Description FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.LongTitle = 'Twelfth Night, Or What You Will' AND T2.Scene = 2 AND T2.Act = 2
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Among the matches held in Mumbai, how many percent of them were held in Wankhede Stadium?
Mumbai refers to City_Name = 'Mumbai'; Wankhede Stadium refers to Venue_Name = 'Wankhede Stadium'; percent = divide(count(Match_Id where Venue_Name = 'Wankhede Stadium'), count(Match_Id)) * 100% where City_Name = 'Mumbai'
SELECT CAST(SUM(CASE WHEN T2.Venue_Name = 'Wankhede Stadium' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.Match_Id) FROM City AS T1 INNER JOIN Venue AS T2 ON T2.City_Id = T1.City_Id INNER JOIN Match AS T3 ON T3.Venue_Id = T2.Venue_Id WHERE T1.City_Name = 'Mumbai'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
What is the average population growth rate of countries where more than 3 languages are used?
null
SELECT SUM(T3.Population_Growth) / COUNT(T3.Country) FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country INNER JOIN population AS T3 ON T3.Country = T2.Country WHERE T2.Country IN ( SELECT Country FROM language GROUP BY Country HAVING COUNT(Country) > 3 ) GROUP BY T3.Country
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
What is the average salary of the employees who takes charge of the sales of over 4 territories?
average salary = DIVIDE(SUM(Salary), COUNT(EmployeeID)); employees who takes charge of over 4 territories refers to EmployeeID WHERE COUNT(TerritoryID) > 4;
SELECT AVG(T1.Salary) FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.EmployeeID HAVING COUNT(T2.TerritoryID) > 4
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...
video_games
How many different publishers have published a game that starts with "Marvel"?
game that starts with "Marvel" refers to game_name LIKE 'Marvel%';
SELECT COUNT(DISTINCT T1.publisher_id) FROM game_publisher AS T1 INNER JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.game_name LIKE 'Marvel%'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
soccer_2016
Where did BR Doctrove come from?
the country the umpire comes from refers to Country_Name; BR Doctrove refers to Umpire_Name = 'BR Doctrove'
SELECT T1.Country_Name FROM Country AS T1 INNER JOIN Umpire AS T2 ON T2.Umpire_Country = T1.Country_Id WHERE T2.Umpire_Name = 'BR Doctrove'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
What is the highest lake area coverage of a country?
Lake area coverage = [sum(area of the lakes in the country) / (area of the country)] * 100%
SELECT T2.Area * 100 / T3.Area FROM located AS T1 INNER JOIN lake AS T2 ON T1.Lake = T2.Name INNER JOIN country AS T3 ON T3.Code = T1.Country ORDER BY T2.Longitude DESC LIMIT 1
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
Who is the supplier of the product with the highest unit price?
supplier of the product refers to CompanyName; highest unit price refers to MAX(UnitPrice);
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitPrice = ( 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...
soccer_2016
Which team did CK Kapugedera belong to? How many matches did he play?
team refers to Team_Name; CK Kapugedera refers to Player_Name = 'CK Kapugedera'
SELECT T3.Team_Name, COUNT(T2.Match_Id) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T2.Player_Id = T1.Player_Id INNER JOIN Team AS T3 ON T3.Team_Id = T2.Team_Id WHERE T1.Player_Name = 'CK Kapugedera'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
Which country has the highest GDP per capita?
GDP per capita = GDP / population
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.GDP / T1.Population DESC LIMIT 1
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
Among the products that are no longer in continuous production, how many of them have their supplier in the USA?
no longer continuous refers to Discontinued = 1; USA refers to Country = 'USA';
SELECT COUNT(T1.Discontinued) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'USA' AND T1.Discontinued = 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
video_games
List the name of all games published in Japan.
name of games refers to game_name; Japan refers to region_name = 'Japan';
SELECT T1.game_name FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN game_platform AS T3 ON T2.id = T3.game_publisher_id INNER JOIN region_sales AS T4 ON T3.id = T4.game_platform_id INNER JOIN region AS T5 ON T4.region_id = T5.id WHERE T5.region_name = 'Japan'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
Which of Shakespeare's work has chapter description of "A field near Windsor"?
null
SELECT T2.Title FROM chapters AS T1 INNER JOIN works AS T2 ON T1.work_id = T2.id WHERE T1.Description = 'A field near Windsor.'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
mondial_geo
Among the countries whose GDP is over 1000000, how many of them have a population groth rate of over 3%?
population growth rate of over 3% means population_growth > 3
SELECT COUNT(T1.Country) FROM economy AS T1 INNER JOIN population AS T2 ON T1.Country = T2.Country WHERE T1.GDP > 1000000 AND T2.Population_Growth > 3
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
Please list the phone numbers of the suppliers of the products that have a higher units on order than units in stock.
UnitsInStock < UnitsOnOrder;
SELECT DISTINCT T2.Phone FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitsInStock < T1.UnitsOnOrder
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...
soccer_2016
List the names and countries of the players from Gujarat Lions who played in the match held on 11th April 2016.
player's name refers to Player_Name; country refers to Country_Name; Gujarat Lions refers to Team_Name = 'Gujarat Lions'; on 11th April 2016 refers to Match_Date = '2016-04-11'
SELECT T4.Player_Name, T5.Country_Name FROM Player_Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_Id INNER JOIN Match AS T3 ON T3.Match_Id = T1.Match_Id INNER JOIN Player AS T4 ON T4.Player_Id = T1.Player_Id INNER JOIN Country AS T5 ON T5.Country_Id = T4.Country_Name WHERE T2.Team_Name = 'Gujarat Lions' AND ...
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
What is the highest infant mortality rate per thousand of the countries whose inflation is under 3?
null
SELECT MAX(T2.Infant_Mortality) FROM economy AS T1 INNER JOIN population AS T2 ON T1.Country = T2.Country WHERE T1.Inflation < 3
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
Please list the names of all the products whose supplier is in Japan.
names of the products refers to ProductName; Japan refers to Country = 'Japan';
SELECT T1.ProductName 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...
video_games
What genres are the games published by 'Agatsuma Entertainment'?
genres refers to genre_name; 'Agatsuma Entertainment' refers to publisher_name = 'Agatsuma Entertainment';
SELECT T4.genre_name FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id INNER JOIN game AS T3 ON T2.game_id = T3.id INNER JOIN genre AS T4 ON T3.genre_id = T4.id WHERE T1.publisher_name = 'Agatsuma Entertainment'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
How many paragraphs are there in the chapter with the highest amount of scenes in act 1?
How many paragraphs refers to ParagraphNum; highest amount of scenes refers to max(count(Scene))
SELECT T1.ParagraphNum FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id WHERE T2.Act = 1 ORDER BY T2.Scene DESC LIMIT 1
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
mondial_geo
How many organizations are established in countries where people speak Bosnian?
Bosnian is one of language
SELECT COUNT(T2.Name) FROM language AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.Name = 'Bosnian'
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
What is the name of the supplier company for Aniseed Syrup?
name of the supplier refers to CompanyName; Aniseed Syrup refers to ProductName = 'Aniseed Syrup';
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Aniseed Syrup'
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...
video_games
List the name of all games published by 'Pioneer LDC'.
name of games refers to game_name; 'Pioneer LDC' refers to publisher_name = 'Pioneer LDC';
SELECT T3.game_name FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id INNER JOIN game AS T3 ON T2.game_id = T3.id WHERE T1.publisher_name = 'Pioneer LDC'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
Please list all of the paragraphs that have the character name Aedile.
paragraphs  refers to ParagraphNum; character name Aedile refers to CharName = 'Aedile'
SELECT T2.ParagraphNum FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.CharName = 'Aedile'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
How many percent of the toss-winners decided to bowl first on the pitch from 2010 to 2016?
decide to bowl first refers to Toss_Name = 'field'; from 2010 to 2016 refers to Match_Date BETWEEN '2010-01-01' AND '2016-12-31'; percent = divide(count(Toss_Id where Toss_Name = 'field'), count(Toss_Id)) * 100% where Match_Date BETWEEN '2010-01-01' AND '2016-12-31'
SELECT CAST(SUM(CASE WHEN T2.Toss_Name = 'field' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Toss_Id) FROM Match AS T1 INNER JOIN Toss_Decision AS T2 ON T2.Toss_Id = T1.Toss_Decide WHERE T1.Match_Date BETWEEN '2010-01-01' AND '2016-12-31'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
Please list the organization names established in the countries where Dutch is spoken.
Dutch is one of language
SELECT T2.Name FROM language AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.Name = 'Dutch'
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
Of all the orders that have ordered Ikura, how many of them enjoys a unit price that's lower than its standard unit price?
Ikura refers to ProductName = 'Ikura'; ordered unit price that's lower than its standard unit price refers to "Order Details".UnitPrice < "Product".UnitPrice;
SELECT COUNT(T2.OrderID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductName = 'Ikura' AND T2.UnitPrice < T1.UnitPrice
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...
video_games
Indicate the name of all the games published for the 'SCD' platform.
name of games refers to game_name;  'SCD' platform refers to platform_name = 'SCD';
SELECT T1.game_name FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN game_platform AS T3 ON T2.id = T3.game_publisher_id INNER JOIN platform AS T4 ON T3.platform_id = T4.id WHERE T4.platform_name = 'SCD'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
What are the descriptions of the short chapters?
short chapters refers to ParagraphNum < 150
SELECT DISTINCT T2.Description FROM paragraphs AS T1 INNER JOIN chapters AS T2 ON T1.chapter_id = T2.id WHERE T1.ParagraphNum < 150
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
mondial_geo
How many organizations are established in the country with the most ethnic groups?
null
SELECT COUNT(T2.Province) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country INNER JOIN ethnicGroup AS T3 ON T3.Country = T2.Country GROUP BY T1.Name ORDER BY COUNT(T3.Name) DESC LIMIT 1
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
Please list the IDs of the orders with a product whose production is not continuous.
IDs of the orders refers to OrderID; production is not continuous refers to Discontinued = 1;
SELECT T2.OrderID FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Discontinued = 1
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
shakespeare
How many acts can be found in the comedy "Two Gentlemen of Verona"?
comedy refers to GenreType = 'comedy'; "Two Gentlemen of Verona" refers to Title = 'Two Gentlemen of Verona'
SELECT COUNT(T1.ACT) FROM chapters AS T1 LEFT JOIN works AS T2 ON T1.work_id = T2.id WHERE T2.GenreType = 'Comedy' AND T2.Title = 'Two Gentlemen of Verona'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Who was the captain of the winning team in the match held on 1st June 2008?
player's name refers to Player_Name; captain refers to Role_Desc = 'Captain'; the winning team refers to Match_Winner = Team_Id; on 1st June 2008 refers to Match_Date = '2008-06-01'
SELECT T3.Player_Name FROM Player_Match AS T1 INNER JOIN Match AS T2 ON T2.Match_Id = T1.Match_Id INNER JOIN Player AS T3 ON T3.Player_Id = T1.Player_Id INNER JOIN Rolee AS T4 ON T4.Role_Id = T1.Role_Id WHERE T2.Match_Date = '2008-06-01' AND T4.Role_Desc = 'Captain' AND T2.Match_Winner = T1.Team_Id
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
Among the countries with over 3 organizations, how many of them have an inflation rate of over 5%?
null
SELECT COUNT(T2.Country) FROM economy AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T2.Country IN ( SELECT Country FROM organization GROUP BY Country HAVING COUNT(Country) > 3 ) AND T1.Inflation > 5
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
How many orders have asked for the product Tofu?
product refers to ProductName;
SELECT COUNT(T2.OrderID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductName = 'Tofu'
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...
video_games
What publishers have the word 'Entertainment' in their name?
publishers that have the word 'Entertainment' in their name refers to publisher_name LIKE '%Entertainment%';
SELECT T.publisher_name FROM publisher AS T WHERE T.publisher_name LIKE '%Entertainment%'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
What are the character names in paragraph 3?
character names refers to CharName; paragraph 3 refers to ParagraphNum = 3
SELECT DISTINCT T1.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.ParagraphNum = 3
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
mondial_geo
How many organizations are established after 1999/1/1 in a country whose GDP is under 500000?
null
SELECT T1.Country, COUNT(T1.Country) FROM economy AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.GDP < 500000 AND STRFTIME('%Y', T2.Established) < '1999' GROUP BY T1.Country
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
Of all the products ordered in order no. 10248, which product has the highest user satisfaction?
order no. refers to OrderID; highest user satisfaction refers to MAX(ReorderLevel);
SELECT T1.ProductName FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10248 ORDER BY T1.ReorderLevel 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...
video_games
Which game has sold the fewest units?
which game refers to game_name; sold the fewest units refers to MIN(num_sales);
SELECT T.game_name FROM ( SELECT T1.game_name FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN game_platform AS T3 ON T2.id = T3.game_publisher_id INNER JOIN region_sales AS T4 ON T3.id = T4.game_platform_id ORDER BY T4.num_sales LIMIT 1 ) t
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
What is the percentage of act number 5 in Titus Andronicus?
act number 5 refers to Act = 5; Titus Andronicus refers to Title = 'Titus Andronicus'; percentage = divide(sum(Act = 5), count(Act)) as percentage
SELECT CAST(SUM(IIF(T2.act = 5, 1, 0)) AS REAL) * 100 / COUNT(T2.act) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.Title = 'Titus Andronicus'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
List down the DOB of players who received the "man of the match" award.
null
SELECT T2.DOB FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
How many organizations are founded in countries with a population of under 1000000?
null
SELECT COUNT(T2.Name) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE T1.Population < 1000000
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
What is the total production of the product that is ordered in the highest quantity in order no. 10248?
total production of the product = SUM(units in stock, units on order); order no. refers to OrderID;
SELECT T1.UnitsInStock + T1.UnitsOnOrder FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10248 ORDER BY T2.Quantity 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...
video_games
Which publisher has published the most number of Action games?
which publisher refers to publisher_name; publisher that has published the most number of Action games refers to MAX(COUNT(publisher_name)) WHERE genre_name = 'Action'; Action games refers to game_name WHERE genre_name = 'Action';
SELECT T.publisher_name FROM ( SELECT T4.publisher_name, COUNT(DISTINCT T2.id) FROM genre AS T1 INNER JOIN game AS T2 ON T1.id = T2.genre_id INNER JOIN game_publisher AS T3 ON T2.id = T3.game_id INNER JOIN publisher AS T4 ON T3.publisher_id = T4.id WHERE T1.genre_name = 'Action' GROUP BY T4.publisher_name ORDER BY COUN...
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
Please list any two character names in chapter 18708.
character names refers to CharName; chapter 18708 refers to chapter_id = 18708
SELECT T1.CharName FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T2.chapter_id = 18708 LIMIT 2
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Among the players out in match ID 392187, calculate the percentage of players out by bowl.
out by bowl refers to Out_Name = 'bowled'; percentage = divide(count(Player_Out where Out_Name = 'bowled'), count(Player_Out)) * 100% where Match_Id = 392187
SELECT CAST(SUM(CASE WHEN T2.Out_Name = 'bowled' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Player_Out) FROM Wicket_Taken AS T1 INNER JOIN Out_Type AS T2 ON T2.Out_Id = T1.Kind_Out WHERE T1.Match_Id = 392187
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
Among the countries with a population of under 1000000, how many of them have over 2 languages?
null
SELECT T2.Country FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T1.Population < 1000000 GROUP BY T2.Country HAVING COUNT(T1.Name) > 2
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
What is the total price of Ikura ordered in order no. 10273?
total price = MULTIPLY(UnitPrice, Quantity); Ikura refers to ProductName = 'Ikura'; order no. refers to OrderID;
SELECT T2.UnitPrice * T2.Quantity FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10273 AND T1.ProductName = 'Ikura'
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...
video_games
Which publisher has published the most games in the 'Puzzle' genre?
which publisher refers to publisher_name; publisher that has published the most games refers to MAX(COUNT(publisher_name)); puzzle genre refers to genre_name = 'Puzzle';
SELECT T.publisher_name FROM ( SELECT T1.publisher_name, COUNT(T3.id) FROM publisher AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.publisher_id INNER JOIN game AS T3 ON T2.game_id = T3.id INNER JOIN genre AS T4 ON T3.genre_id = T4.id WHERE T4.genre_name = 'Puzzle' GROUP BY T1.publisher_name ORDER BY COUNT(T3.id) ...
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
mondial_geo
What is the capital city of the country that has the percentage of Armenian speakers over 90%?
Percentage of country > 90% refers to percentage > 90; America is one of country names
SELECT T1.Capital FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Armenian' AND T2.Percentage > 90
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
What is the quantity of Ikura ordered in order no. 10273?
Ikura refers to ProductName = 'Ikura'; order no. refers to OrderID;
SELECT T2.Quantity FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10273 AND T1.ProductName = 'Ikura'
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...
shakespeare
Among the works of Shakespeare, how many of them have the word "Henry" on its title?
works refers to Title; have the word "Henry" on its title refers to Title = '%Henry%'
SELECT COUNT(id) FROM works WHERE Title LIKE '%Henry%'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
List down the match ID of matches that the "man of the match" award was given to BB McCullum.
null
SELECT T1.Match_Id FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match WHERE T2.Player_Name = 'BB McCullum'
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
Which country has the most languages spoken?
null
SELECT T1.Name FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY COUNT(T2.Name) DESC LIMIT 1
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
Please list the names of all the products ordered in order no. 10248.
names of the products refers to ProductName; order no. refers to OrderID;
SELECT T1.ProductName FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10248
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...
video_games
Indicate, by region, which platform has sold the most games.
region refers to region_name; platform refers to game_platform; sold the most games refers to MAX(SUM(num_sales));
SELECT T.region_name FROM ( SELECT T1.platform_name, T4.region_name, SUM(T3.num_sales) FROM platform AS T1 INNER JOIN game_platform AS T2 ON T1.id = T2.platform_id INNER JOIN region_sales AS T3 ON T1.id = T3.game_platform_id INNER JOIN region AS T4 ON T3.region_id = T4.id GROUP BY T1.platform_name, T4.region_name ORDER...
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
What is the percentage of historical works that have not fewer than five scenes in the 1500s?
historical works refers to GenreType = 'history'; have not fewer than five scenes in the 1500s refers to count(Scene) > = 5 and DATE > = 1500 AND DATE < = 1599; percentage = divide(count(works.id) where GenreType = 'history' and count(Scene) > = 5, count(works.id) ) as percentage
SELECT CAST(( SELECT COUNT(T1.id) FROM works AS T1 INNER JOIN chapters AS T2 ON T1.id = T2.work_id WHERE T1.GenreType = 'History' AND T1.DATE BETWEEN 1500 AND 1599 GROUP BY T1.id HAVING COUNT(T2.Scene) >= 5 ) AS REAL) * 100 / COUNT(id) FROM works WHERE GenreType = 'History' AND DATE BETWEEN 1500 AND 1599
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
How many players got out in the first inning of match ID "548335"?
got out refers to Player_Out; the first inning refers to Innings_No = 1; match ID "548335" refers to Match_Id = 548335
SELECT SUM(CASE WHEN Match_Id = 548335 THEN 1 ELSE 0 END) FROM Wicket_Taken WHERE Innings_No = 1
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...
mondial_geo
How many lakes in the Canary Islands cover an area of over 1000000?
null
SELECT COUNT(T2.Name) FROM located AS T1 INNER JOIN lake AS T2 ON T1.Lake = T2.Name WHERE T1.Province = 'Canary Islands' AND T2.Area > 1000000
CREATE TABLE politics ( Government TEXT, -- Country TEXT default '' not null primary key constraint politics_ibfk_1 references country on update cascade on delete cascade, Independence DATE, -- Dependent TEXT constraint politics_ibfk_2 references country on update cascade on delete cascade, -- Example Values: `...
retail_world
How many more territories are there in than Eastern Region than in the Southern Region?
how many more = SUBTRACT(SUM(RegionDescription = 'Eastern'), SUM(RegionDescription = 'Southern')); Eastern Region refers to RegionDescription = 'Eastern'; Southern Region refers to RegionDescription = 'Southern';
SELECT ( SELECT COUNT(T1.TerritoryID) FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Eastern' ) - ( SELECT COUNT(T1.TerritoryID) FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Southern' ) AS Calu
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...
video_games
What is the genre of the game '2 Games in 1: Sonic Advance & ChuChu Rocket!'?
genre refers to genre_name; '2 Games in 1: Sonic Advance & ChuChu Rocket!' is a game name;
SELECT T2.genre_name FROM game AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.id WHERE T1.game_name = '2 Games in 1: Sonic Advance & ChuChu Rocket!'
CREATE TABLE region_sales ( foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (game_platform_id) references game_platform(id), foreign key (region_id) references region(id), region_id INTEGER default NULL, -- Example Values: `1`, `...
shakespeare
List the paragraph number and paragraphs said by the character named "Sir Andrew Aguecheek".
paragraph number refers to ParagraphNum; character named "Sir Andrew Aguecheek" refers to CharName = 'Sir Andrew Aguecheek'
SELECT T2.ParagraphNum, T2.id FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.CharName = 'Sir Andrew Aguecheek'
CREATE TABLE characters ( CharName TEXT not null, -- Abbrev TEXT not null, -- Description TEXT not null, -- id INTEGER primary key autoincrement, ); CREATE TABLE paragraphs ( chapter_id INTEGER default 0 not null references chapters, -- character_id INTEGER not null references characters, -- Paragraph...
soccer_2016
Describe any five matches IDs that reached over ID 20.
reached over ID 20 refers to Over_Id = 20
SELECT Match_Id FROM Ball_by_Ball WHERE Over_Id = 20 GROUP BY Match_Id LIMIT 5
CREATE TABLE Win_By ( Win_Id INTEGER primary key, Win_Type TEXT, -- Example Values: `runs`, `wickets`, `NO Result`, `Tie` | Value Statics: Total count 4 - Distinct count 4 - Null count 0 ); CREATE TABLE Wicket_Taken ( Kind_Out INTEGER, -- Example Values: `2`, `1`, `3`, `4`, `5` | Value Statics: Total count 6727 ...