db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
codebase_comments
What is the average processed time of the solution paths inside the "https://github.com/zphingphong/DiscardCustomerApp.git"?
average processed time = avg(Solution.ProcessedTime);
SELECT CAST(SUM(T2.ProcessedTime) AS REAL) / COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Url = 'https://github.com/zphingphong/DiscardCustomerApp.git'
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT,...
address
Show the zip code of the county represented by Buchanan Vernon.
null
SELECT T2.zip_code FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.first_name = 'Buchanan' AND T1.last_name = 'Vernon'
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area...
codebase_comments
Among the repositories whose number of stars received are between 6,000 to 9,000, which repository has the highest number of solution paths and many of those solution paths needs to be compiled if user wants to implement it?
Stars between 6,000 to 9,000; highest number of solution paths refers to max(count(Path)); needs to be compiled if user wants to implement it refers to WasCompiled = 0;
SELECT T2.RepoId, COUNT(T2.RepoId) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Stars BETWEEN 6000 AND 9000 AND T2.WasCompiled = 0 GROUP BY T2.RepoId ORDER BY COUNT(T2.RepoId) DESC LIMIT 1
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT,...
address
For the county where DeSantis Ron is from, what is the average female median age?
average female median age refers to Divide (Sum(female_median_age), Count(county))
SELECT SUM(T4.female_median_age) / COUNT(T1.county) FROM country AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id INNER JOIN zip_data AS T4 ON T1.zip_code = T4.zip_code WHERE T3.first_name = 'DeSantis' AND T3.last_name = 'Ron'
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area...
codebase_comments
What is the linearized sequenced of API calls of the method whose solution path is "mauriciodeamorim_tdd.encontro2\Tdd.Encontro2.sln"?
linearized sequenced of API calls refers to ApiCalls;
SELECT T2.ApiCalls FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'mauriciodeamorim_tdd.encontro2Tdd.Encontro2.sln'
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT,...
address
How many counties are there in Virginia State?
"Virginia" is the state
SELECT COUNT(T2.county) FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Virginia'
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area...
codebase_comments
How many solution paths are there inside the 2nd most popular repository?
more watchers mean that this repository is more popular; most popular repository refers to max(Watchers);
SELECT COUNT(DISTINCT T2.Path) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Watchers = ( SELECT Watchers FROM Repo ORDER BY Watchers DESC LIMIT 1, 1 )
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT,...
address
Calculate the average male median age of all the residential areas in Windham county.
average male median age refers to Divide (Sum(male_median_age), Count(county)); 'WINDHAM' is the county
SELECT SUM(T2.male_median_age) / COUNT(T2.median_age) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.county = 'WINDHAM'
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area...
codebase_comments
How much is the processed time of the method whose tokenized name is "about box1 dispose"? Indicate the language of the method.
language refers to Lang;
SELECT DISTINCT T1.ProcessedTime, T2.Lang FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.NameTokenized = 'about box1 dispose'
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT,...
codebase_comments
What is the full comment on the method whose solution path is "bmatzelle_nini\Source\Nini.sln" with a tokenized name of "alias text add alias"?
null
SELECT T2.FullComment FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'bmatzelle_niniSourceNini.sln' AND T2.NameTokenized = 'alias text add alias'
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT,...
olympics
State the event name of Basketball.
basketball refers to sport_name = 'Basketball';
SELECT T2.event_name FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T1.sport_name = 'Basketball'
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...
codebase_comments
How many solution paths that needs to be compiled if user wants to implement it in "https://github.com/jeffdik/tachy.git"?
needs to be compiled if user wants to implement refers to WasCompiled = 0; https://github.com/jeffdik/tachy.git is url of repository
SELECT COUNT(T2.Path) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.Url = 'https://github.com/jeffdik/tachy.git' AND T2.WasCompiled = 0
CREATE TABLE Method ( ApiCalls TEXT, -- NameTokenized TEXT, -- Name TEXT, -- SolutionId INTEGER, -- CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 SampledAt INTEGER, -- Id INTEGER not null primary key autoincrement, Lang TEXT,...
address
Name the bad alias of Geneva, AL.
"Geneva" is the city; 'AL' is the state
SELECT T1.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Geneva' AND T2.state = 'AL'
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area...
movies_4
List all the keywords with "christmas" in them.
keywords with "christmas" in them refers to keyword_name LIKE '%christmas%'
SELECT keyword_name FROM keyword WHERE keyword_name LIKE '%christmas%'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
How many adventure movies are there that were released in 2000?
adventure movies refers to genre_name = 'Adventure'; released in 2000 refers to release_date LIKE '2000%'
SELECT COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Adventure' AND CAST(STRFTIME('%Y', T1.release_date) AS INT) = 2000
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
address
Tell the name of the county which is represented by Hartzler Vicky.
name of county refers to county
SELECT T1.county FROM country AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T3.first_name = 'Hartzler' AND T3.last_name = 'Vicky' GROUP BY T1.county
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area...
movies_4
What is the role of Mark Hammel?
role refers to job
SELECT T2.job FROM person AS T1 INNER JOIN movie_crew AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Mark Hammel'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
address
Which city and state has the bad alias of Lawrenceville?
"Lawrenceville" is the bad_alias
SELECT T2.city, T2.state FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.bad_alias = 'Lawrenceville' GROUP BY T2.city, T2.state
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area...
movies_4
What is the most common first name?
most common first name refers to max(count(person_name))
SELECT person_name FROM person GROUP BY person_name ORDER BY COUNT(person_name) DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
How many production companies made more than 150 movies?
more than 150 movies refers to COUNT(company_name) > 150
SELECT COUNT(*) FROM ( SELECT T1.company_name AS CNAME FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id HAVING COUNT(T1.company_name) > 150 )
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
address
What is the area code of Bishopville, SC?
"Bishopville" is the city; 'SC' is the state
SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Bishopville' AND T2.state = 'SC'
CREATE TABLE state ( name TEXT, -- abbreviation TEXT primary key, ); CREATE TABLE country ( zip_code INTEGER, -- foreign key (state) references state(abbreviation), county TEXT, -- primary key (zip_code, county), state TEXT, -- foreign key (zip_code) references zip_data(zip_code), ); CREATE TABLE area...
movies_4
Name the horror movies with positive ratings greater than 7.
Name the horror movies refers to title where genre_name = 'horror'; positive ratings greater than 7 refers to vote_average > 7
SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Horror' AND T1.vote_average > 7
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
retail_world
What is the average salary for employees from ID 1 to 9?
ID 1 to 9 refers to EmployeeID BETWEEN 1 AND 9; Average salary = AVG(Salary)
SELECT AVG(Salary) FROM Employees WHERE EmployeeID BETWEEN 1 AND 9
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...
retail_world
Among the USA employess, how many of them has PhD title of courtesy?
"USA" is the Country; PhD title of courtesy refers to TitleOfCourtesy = 'Dr.'
SELECT COUNT(Country) FROM Employees WHERE TitleOfCourtesy = 'Dr.' AND Country = 'USA'
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...
books
Provide the customers' names who ordered the Fantasmas.
"Fantasmas" is the title of the book; customer names refers to first_name, last_name
SELECT T4.first_name, T4.last_name FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.title = 'Fantasmas'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
genes
For the genes that are located in the plasma membrane, please list their number of chromosomes.
null
SELECT T1.Chromosome FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'plasma membrane'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
What proportion of orders are taken by the Sales Representative?
DIVIDE(COUNT(OrderID where Title = 'Sales Representative'), COUNT(OrderID)) as percentage;
SELECT CAST(COUNT(CASE WHEN T1.Title = 'Sales Representative' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID
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...
books
How many customers are from Australia?
"Australia" is the country_name;
SELECT COUNT(*) FROM customer_address AS T1 INNER JOIN address AS T2 ON T2.address_id = T1.address_id INNER JOIN country AS T3 ON T3.country_id = T2.country_id WHERE T3.country_name = 'Australia'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
genes
Among the pairs of genes that are not from the class of motorproteins, how many of them are negatively correlated?
If Expression_Corr < 0, it means the negatively correlated
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 AND T1.Class = 'Motorproteins'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
Provide the name of the contact person who made the orders that shipped to Switzerland.
shipped to Switzerland refers to ShipCountry = 'Switzerland'; contact person refers to Customers;
SELECT T1.ContactName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.ShipCountry = 'Switzerland' GROUP BY T1.ContactName
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...
retail_world
What are the names of Robert King's territories?
Robert King is a full name of an employee where LastName = 'King' AND FirstName = 'Robert'; names of territories refer to TerritoryDescription;
SELECT T3.TerritoryDescription FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T1.LastName = 'King' AND T1.FirstName = 'Robert'
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...
books
How many orders were delivered in December 2019?
delivered refers to status_value = 'Delivered'; in December 2019 refers to status_date LIKE '2019-12%'
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Delivered' AND STRFTIME('%Y', T2.status_date) = '2019'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
genes
Among the pairs of genes that are both located in the nucleus, what is the highest expression correlation score?
null
SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 INNER JOIN Genes AS T3 ON T3.GeneID = T2.GeneID2 WHERE T1.Localization = 'nucleus' AND T3.Localization = 'nucleus' ORDER BY T2.Expression_Corr DESC LIMIT 1
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
What are the products by the company "Bigfoot Breweries"?
Bigfoot Breweries is the name of the company; products refer to ProductName;
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Bigfoot Breweries'
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...
genes
What are the functions of the pair of genes that have the lowest expression correlation score?a
null
SELECT T1.Function FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 ORDER BY T2.Expression_Corr ASC LIMIT 1
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
List all the products that were shipped to Starenweg 5.
products shipped to Starenweg 5 refer to ProductName where ShipAddress = 'Starenweg 5';
SELECT T3.ProductName FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T1.ShipAddress = 'Starenweg 5' GROUP BY T3.ProductName
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
books
List all the authors named "George".
author named 'George' refers to author_name = 'George%'
SELECT author_name FROM author WHERE author_name LIKE 'George%'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
retail_world
How many orders did "Laughing Bacchus Wine Cellars" make?
"Laughing Bacchus Wine Cellars" is the name of the company; orders refer to OrderID;
SELECT COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'Laughing Bacchus Wine Cellars'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
genes
Please list the motif of the genes that are located in the cytoplasm and have 7 chromosomes.
null
SELECT T2.GeneID1, T2.GeneID2 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'cytoplasm' AND T1.Chromosome = 7
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
What are the prices on cheese products?
prices on cheese refer to UnitPrice WHERE Description = 'Cheeses';
SELECT T2.UnitPrice FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.Description = 'Cheeses'
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...
shooting
What is the proportion of white males and females in the police force?
white refers to race = 'W'; male refers to gender = 'M'; female refers to gender = 'F'; proportion of white males = divide(count(officers where race = 'W' and gender = 'M'), count(officers)) * 100%; proportion of white females = divide(count(officers where race = 'W' and gender = 'F'), count(officers)) * 100%
SELECT CAST(SUM(gender = 'M') AS REAL) / SUM(gender = 'F') FROM officers WHERE race = 'W'
CREATE TABLE officers ( full_name TEXT not null, -- foreign key (case_number) references incidents (case_number), case_number TEXT not null, -- last_name TEXT not null, -- first_name TEXT null, -- race TEXT null, -- Example Values: `L`, `W`, `B`, `A` | Value Statics: Total count 366 - Distinct count 4 - N...
retail_world
Make a list of all the territories in the Southern region.
territories in the Southern region refer to TerritoryDescription WHERE RegionDescription = 'Southern';
SELECT DISTINCT T1.TerritoryDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Southern'
CREATE TABLE Products ( CategoryID INTEGER, -- Example Values: `1`, `2`, `7`, `6`, `8` | Value Statics: Total count 77 - Distinct count 8 - Null count 0 Unit TEXT, -- ReorderLevel INT, -- ProductName TEXT, -- Price REAL DEFAULT 0, -- FOREIGN KEY (SupplierID) REFERENCES Suppliers (SupplierID), Supplier...
books
How many orders were returned in the year 2020?
returned refers to status_value = 'Returned'; in the year 2020 refers to status_date LIKE '%2020%'
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Returned' AND STRFTIME('%Y', T2.status_date) = '2020'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
retail_world
How many orders were shipped by "Speedy Express"?
"Speedy Express" is the name of the shipping company; orders refer to OrderID;
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Speedy Express'
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...
genes
If a pair of genes is positively correlated, what is the possibility of it being composed of two genes both with over 10 chromosomes?
Positively correlated means Expression_Corr > 0; Possibility = count(the pairs of genes with both chromosomes over 20) / count(pairs of genes that are positively correlated)
SELECT CAST(SUM(IIF(T1.Chromosome > 10 AND T3.Chromosome > 10, 1, 0)) AS REAL) * 100 / COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 INNER JOIN Genes AS T3 ON T3.GeneID = T2.GeneID2 WHERE T2.Expression_Corr > 0
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
What is the largest quantity of "Manjimup Dried Apples" for an order?
the largest quantity of "Manjimup Dried Apples" refers to MAX(Quantity) where ProductName = 'Manjimup Dried Apples';
SELECT T2.Quantity FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T2.ProductID = T1.ProductID WHERE T1.ProductName = 'Manjimup Dried Apples' 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...
books
How many percent of orders in 2020 used international shipping?
international shipping refers to method_name = 'International'; orders in 2020 refers to order_date = '2020%'; percentage = Divide (Sum(method_name = 'International'), Count(order_id)) * 100
SELECT CAST(SUM(CASE WHEN T2.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id WHERE STRFTIME('%Y', T1.order_date) = '2020'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
genes
For the pairs of genes with one having 8 chromosomes and the other having 6 chromosomes, what is the highest expression correlation score?
null
SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Chromosome = 6 OR T1.Chromosome = 8 ORDER BY T2.Expression_Corr DESC LIMIT 1
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
List the first names of the employees who take the orders that ship to the city of "Reims".
ship to the city of "Reims" refers to ShipCity = Reims';
SELECT DISTINCT T1.FirstName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.ShipCity = 'Reims'
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...
genes
How many pairs of positively correlated genes are both non-essential?
If Expression_Corr > 0, it means the expression correlation is positive
SELECT COUNT(T2.GeneID2) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Essential = 'Non-Essential'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
What is the homepage link for the company that supplies the product "Thringer Rostbratwurst"?
ProductName = 'Thringer Rostbratwurst';
SELECT T2.HomePage FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Thringer Rostbratwurst'
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...
books
What is the average price for the order line?
average price refers to AVG(price)
SELECT AVG(price) FROM order_line
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
genes
Lists all genes by identifier number located in the cytoplasm and whose function is metabolism.
null
SELECT DISTINCT GeneID FROM Genes WHERE Localization = 'cytoplasm' AND Function = 'METABOLISM'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
Which region does Hoffman Estates belong to?
Hoffman Estates refer to TerritoryDescription;
SELECT T2.RegionDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T1.TerritoryDescription = 'Hoffman Estates'
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...
books
What is the most common domain for the email address among all the customers?
most common domain for the email refers to Max(Count(SUBSTR(email, CHARINDEX('@', email) + 1, length(email) - charindex('@', email))))
SELECT SUBSTR(email, INSTR(email, '@') + 1, LENGTH(email) - INSTR(email, '@')) AS ym FROM customer GROUP BY SUBSTR(email, INSTR(email, '@') + 1, LENGTH(email) - INSTR(email, '@')) ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
genes
For the non-essential genes whose functions are transcription, how many of them are not located in the cytoplasm?
null
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization != 'cytoplasm' AND T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'NON-Essential'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
How many of the orders are shipped to France?
shipped to France refers to ShipCountry = 'France';
SELECT COUNT(ShipCountry) FROM Orders WHERE ShipCountry = 'France'
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...
books
Which year has the most customer orders?
year with the most customer orders refers to Max(count(order_id))
SELECT strftime('%Y', order_date) FROM cust_order GROUP BY strftime('%Y', order_date) ORDER BY COUNT(strftime('%Y', order_date)) DESC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
genes
For the pairs of genes both from the class ATPases, what is the average expression correlation score?
null
SELECT AVG(T2.Expression_Corr) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Class = 'ATPases'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
Which product is the most expensive?
most expensive product refers to ProductName where MAX(UnitPrice);
SELECT ProductName FROM Products WHERE 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...
genes
What kind of expression correlation occurs in physical type interacting gene pairs and what percentage of these are negatively correlated?
If the Expression_Corr value is negative then it's negatively correlated. Percentage of Negative Correlation = count(negative Expression_Corr physical type) / count(Expression_Corr physical type) * 100%
SELECT Expression_Corr FROM Interactions WHERE Type = 'Physical' UNION ALL SELECT CAST(SUM(Expression_Corr < 0) AS REAL) * 100 / COUNT(*) FROM Interactions WHERE Type = 'Physical'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
What is the largest total price for an order?
the largest total price for an order can be calculated as MAX(MULTIPLY(UnitPrice, Quantity, SUBTRACT(1-Discount)));
SELECT SUM(UnitPrice) FROM `Order Details` GROUP BY OrderID ORDER BY SUM(UnitPrice) 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...
shooting
Which near-death incident did a policeman by the name of Ruben Fredirick look into? What is the victim in this incident's race and gender?
near-death refers to subject_statuses = 'Deceased Injured'; incident refers to case_number; Ruben Fredirick refers to full_name = 'Ruben Fredirick'
SELECT T1.case_number, T3.race, T3.gender FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number INNER JOIN subjects AS T3 ON T1.case_number = T3.case_number WHERE T2.first_name = 'Fredirick' AND T2.last_name = 'Ruben'
CREATE TABLE officers ( full_name TEXT not null, -- foreign key (case_number) references incidents (case_number), case_number TEXT not null, -- last_name TEXT not null, -- first_name TEXT null, -- race TEXT null, -- Example Values: `L`, `W`, `B`, `A` | Value Statics: Total count 366 - Distinct count 4 - N...
retail_world
How many territories are there?
null
SELECT COUNT(TerritoryID) FROM Territories
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...
books
List all of the books that were published in 1995.
published in 1995 refers to publication_date LIKE '1995%'; ; list of book refers to title
SELECT title FROM book WHERE STRFTIME('%Y', publication_date) = '1995'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
retail_world
From which country is the company "Drachenblut Delikatessen" from?
Drachenblut Delikatessen is the company name;
SELECT Country FROM Customers WHERE CompanyName = 'Drachenblut Delikatessen'
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...
books
Which language is the rarest among all the books?
language written in refers to language_name; rarest refers to Min(Count(book_id))
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id GROUP BY T2.language_name ORDER BY COUNT(T2.language_name) ASC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
genes
What type of interactions occurs in genes whose function is cellular transport and transport medicine and are classified as non-essential?
null
SELECT T2.Type FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'Non-Essential'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
Who is the one representing the company "Heli Swaren GmbH & Co. KG"?
Heli Swaren GmbH & Co. KG is the name of the company; who is representing refers to ContactName;
SELECT ContactName FROM Suppliers WHERE CompanyName = 'Heli Swaren GmbH & Co. KG'
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...
books
Which publisher published Barry Eisler's book?
"Barry Eisler" is the author_name; publisher refers to publisher_name
SELECT T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'Barry Eisler'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
retail_world
Please name any two products that have the highest satisfaction levels among users of Heli Swaren GmbH & Co. KG.
High reorder level generally means high user satisfaction; the highest satisfaction levels refer to MAX(ReorderLevel); two products refer to ProductName LIMIT 2; CompanyName = 'Heli Swaren GmbH & Co. KG';
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Heli Swaren GmbH & Co. KG' ORDER BY T1.ReorderLevel DESC LIMIT 2
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...
books
How many addresses are from the Philippines?
"Philippines" is the country_name
SELECT COUNT(T2.country_id) FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Philippines'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
genes
How many different genes do we have if we add those located in the plasma and in the nucleus?
null
SELECT COUNT(GeneID) FROM Classification WHERE Localization IN ('plasma', 'nucleus')
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
Please name any three products that have been discontinued in the meat or poultry category.
three products that have been discontinued refer to ProductName LIMIT 3 where Discontinued = 1; CategoryName = 'Meat/Poultry';
SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.Discontinued = 1 AND T1.CategoryName = 'Meat/Poultry' LIMIT 3
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...
books
How many publishers have the word "book" in their name?
publisher have the word 'book' refers to publisher_name LIKE '%book%'
SELECT COUNT(*) FROM publisher WHERE publisher_name LIKE '%book%'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
genes
What percentage of genes located in the cytoskeleton are of unknown class? And of these, how many are not conditional phenotypes?
Percentage = count(genes located in the cytoskeleton unknown class) / count(genes located in the cytoskeleton) * 100%
SELECT SUM(Localization = 'cytoskeleton' AND Phenotype = 'Conditional phenotypes') , CAST(SUM(Localization = 'cytoskeleton') AS REAL) * 100 / COUNT(GeneID) FROM Genes;
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
Who is the person to contact to get Camembert Pierrot?
Camembert Pierrot is the name of the product; person to contact refers to ContactName;
SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Camembert Pierrot'
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...
books
List all the order dates for the customer named "Adrian Kunzelmann".
null
SELECT T3.order_date FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Adrian' AND T4.last_name = 'Kunzelmann'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
genes
Taking all the essential genes of the transcription factors class located in the nucleus as a reference, how many of them carry out a genetic-type interaction with another gene? List them.
null
SELECT T2.GeneID1 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'nucleus' AND T1.Class = 'Transcription factors' AND T1.Essential = 'Essential' AND T2.Expression_Corr != 0
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
How much per unit of Konbu does Mayumi's charge?
Mayumi's is the name of the company; how much per unit of Konbu refers to UnitPrice where ProductName = 'Konbu';
SELECT T1.UnitPrice FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName LIKE 'Mayumi%' AND T1.ProductName = 'Konbu'
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...
books
What are the books published by "Harper Collins"?
"Harper Collins" is the publisher_name; books refers to title
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Harper Collins'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
shooting
How many more black female victims than white female victims were discovered?
black refers to race = 'B'; female refers to gender = 'F'; white refers to race = 'W'; result = subtract(count(victims where race = 'B'), count(victims where race = 'W')) where gender = 'F'
SELECT SUM(race = 'B') - SUM(race = 'W') FROM subjects WHERE gender = 'F'
CREATE TABLE officers ( full_name TEXT not null, -- foreign key (case_number) references incidents (case_number), case_number TEXT not null, -- last_name TEXT not null, -- first_name TEXT null, -- race TEXT null, -- Example Values: `L`, `W`, `B`, `A` | Value Statics: Total count 366 - Distinct count 4 - N...
retail_world
What are the products that are supplied by Aux joyeux ecclsiastiques?
Aux joyeux ecclsiastiques is the name of supply company; products refer to ProductName;
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Aux joyeux ecclsiastiques'
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...
books
Sum the total price of the orders for The Prophet book.
"The Prophet" is the title of the book: total price refers to Sum(price)
SELECT SUM(T1.price) FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id WHERE T2.title = 'The Prophet'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
retail_world
Which company supplies Gula Malacca?
Gula Malacca is the name of the product; company refers to CompanyName;
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Gula Malacca'
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...
books
What is the book with the most orders?
books refers to title; the most orders refers to Max(Count(order_id))
SELECT T2.title FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id GROUP BY T2.title ORDER BY COUNT(T1.book_id) DESC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
genes
Of the genes whose phenotype and motif are nucleic acid metabolism defects, PS00107, what percentage perform positive interaction with another gene?
Percentage of no interaction = [count(nucleic acid metabolism, PS00107, no interaction) / count(nucleic acid metabolism, PS00107) * 100%
SELECT CAST(SUM(IIF(T2.Expression_Corr > 0, 1, 0)) AS REAL) * 100 / COUNT(T2.GeneID1) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Phenotype = 'Nucleic acid metabolism defects' AND T1.Motif = 'PS00107'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
What is the description of the category that tofu belongs to?
tofu is the name of the product;
SELECT T1.Description FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.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...
genes
List all genes whose interaction is with genes located in the nucleus in which it is positively correlated.
If the Expression_Corr value is positive then it's positively correlated
SELECT T1.GeneID FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Localization = 'nucleus'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
What are the products that belong to the beverage category?
products belong to beverage category refer to ProductName where CategoryName = 'beverage';
SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.CategoryName = 'Beverages'
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...
books
Who is the author who wrote the most books?
author refers to author_name; who wrote the most book refers to Max(Count(author_id))
SELECT T1.author_name FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_name ORDER BY COUNT(T2.author_id) DESC LIMIT 1
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
app_store
How many apps were last updated in January of 2018? Please write one translated review with positive sentiment for each app, if there's any.
updated in January of 2018 refers to Last Updated BETWEEN 'January 1, 2018' and 'January 31, 2018';
SELECT DISTINCT Translated_Review FROM user_reviews WHERE App IN ( SELECT App FROM playstore WHERE `Last Updated` BETWEEN 'January 1, 2018' AND 'January 31, 2018' ) AND Sentiment = 'Positive'
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- ...
retail_world
Please list any three order numbers that have been shipped using Speedy Express.
Speedy Express is the name of the shipping company; three order numbers refer to OrderID LIMIT 3;
SELECT T1.OrderID FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Speedy Express' LIMIT 3
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...
genes
Of all the nonessential genes that are not of the motorprotein class and whose phenotype is cell cycle defects, how many do not have a physical type of interaction?
null
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Type != 'Physical' AND T1.Phenotype = 'Cell cycle defects' AND T1.Class != 'Motorproteins' AND T1.Essential = 'Non-Essential'
CREATE TABLE Interactions ( foreign key (GeneID1) references Classification (GeneID) on update cascade on delete cascade, primary key (GeneID1, GeneID2), foreign key (GeneID2) references Classification (GeneID) on update cascade on delete cascade, GeneID2 TEXT not null, -- GeneID1 TEXT not null, -- Expression...
retail_world
What is the shipping company for order number 10558?
order number 10558 refers to OrderID = 10558;
SELECT T2.CompanyName FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.OrderID = 10558
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...
books
How many of the customer addresses are inactive?
addresses are inactive refers to address_status = 'Inactive'
SELECT COUNT(*) FROM customer_address AS T1 INNER JOIN address_status AS T2 ON T1.status_id = T2.status_id WHERE T2.address_status = 'Inactive'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
retail_world
What is the shipping cost for order number 10692 from the company Alfreds Futterkiste?
Alfreds Futterkiste is the name of the company; order number 10692 refers to OrderID = 10692;
SELECT T2.Freight FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10692 AND T1.CompanyName = 'Alfreds Futterkiste'
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...
books
How many books were published in Japanese?
published in Japanese refers to language_name = 'Japanese'
SELECT COUNT(T2.book_id) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id WHERE T1.language_name = 'Japanese'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
app_store
How many users holds neutral attitude towards the HTC Weather app? Indicate the app's rating on the Google Play Store.
user holds neutral attitude refers to Sentiment = 'Neutral';
SELECT COUNT(T1.Rating), T1.Rating FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'HTC Weather' AND T2.Sentiment = 'Neutral'
CREATE TABLE playstore ( Rating REAL, -- Size TEXT, -- App TEXT, -- Category TEXT, -- Price TEXT, -- "Content Rating" TEXT, -- Example Values: `Everyone`, `Teen`, `Everyone 10+`, `Mature 17+`, `Adults only 18+` | Value Statics: Total count 10840 - Distinct count 6 - Null count 0 Installs TEXT, -- ...
retail_world
What is the family name of the employee who shipped the order 10521 to CACTU?
order 10521 refers to OrderID = 10521; CustomerID = 'CACTU'; family name refers to LastName;
SELECT T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10521 AND T2.CustomerID = 'CACTU'
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...