Chinastark/bird_dataset huggingface dataset:
Database: superstore
Note: furniture products refers to category = 'Furniture'; shipped by standard class refers to "ship mode" = 'Standard Class';
Question: How many furniture products had been shipped by standard class in the East superstore?
SQL: SELECT count(product.category) FROM east_superstore INNER JOIN product ON east_superstore.`product id` = product.`product id` WHERE east_superstore.`ship mode` = 'Standard Class'
Database: superstore
Note: highest profit refers to max(profit); Houston, Texas refers to city = 'Houston' and state = 'Texas';
Question: What is the highest profit order in the East superstore of customers from Houston, Texas?
SQL: SELECT east_superstore.`order id` FROM east_superstore INNER JOIN people ON east_superstore.`customer id` = people.`customer id` WHERE people.city = 'Houston' AND people.state = 'Texas' ORDER BY east_superstore.profit DESC LIMIT 1
Database: superstore
Note: furniture products refers to category = 'Furniture';
Question: How many furniture products were ordered at central superstore?
SQL: SELECT count(*) FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE product.category = 'Furniture'
Database: superstore
Note: names of the products refers to product name; shipped in March 2013 refers to "ship date" = '2013-03%';
Question: What are the names of the products that had been shipped in March 2013 at central superstore?
SQL: SELECT DISTINCT product.`product name` FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE strftime('%Y-%m', central_superstore.`ship date`) = '2013-03'
Database: superstore
Note: customer live in Texas refers to state = 'Texas';
Question: How many orders were made by customers who live in Texas at the Central superstore?
SQL: SELECT count(DISTINCT central_superstore.`order id`) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` WHERE people.state = 'Texas'
Database: superstore
Note: in 2015 refers to "order date" = '2015%';
Question: How many orders were made by Alan Barnes in 2015 at the Central superstore?
SQL: SELECT count(DISTINCT central_superstore.`order id`) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` WHERE people.`customer name` = 'Alan Barnes' AND strftime('%Y', central_superstore.`order date`) = '2015'
Database: superstore
Note: order CA-2011-115791 refers to "order id" = 'CA-2011-115791';
Question: What is the product name of order CA-2011-115791 in the East superstore?
SQL: SELECT DISTINCT product.`product name` FROM east_superstore INNER JOIN product ON east_superstore.`product id` = product.`product id` WHERE east_superstore.`order id` = 'CA-2011-141817'
Database: superstore
Note: live in Texas refers to state = 'Texas'; percentage = divide(sum(order id) when discount = 0.2, sum(order id)) as percentage;
Question: What is the percentage of orders with 0.2 discount in the Central superstore were purchased by customers who live in Texas?
SQL: SELECT cast(sum(CASE  WHEN central_superstore.discount = 0.2 THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` WHERE people.state = 'Texas'
Database: superstore
Note: furniture refers to category = 'Furniture'; shipped through first class in 2013 refers to ship mode = 'first class' and "ship date" = '2013%'; percentage = divide(sum(order id) when category = 'Furniture' and "ship date" = '2013%', sum(order id)) as percentage;
Question: What is the percentage of furniture orders that were shipped through first class in 2013 at the Central superstore?
SQL: SELECT cast(sum(CASE  WHEN central_superstore.`ship mode` = 'First Class' THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE product.category = 'Furniture' AND strftime('%Y', central_superstore.`ship date`) = '2013'
Database: superstore
Note: Who refers to "customer name"; on August 12, 2013 refers to "order date" = '2013-08-12'; discount of 0.2 refers to discount = 0.2;
Question: Who order from the west region on August 12, 2013, and received a discount of 0.2?
SQL: SELECT DISTINCT people.`customer name` FROM west_superstore INNER JOIN people ON west_superstore.`customer id` = people.`customer id` WHERE west_superstore.`order date` = '2013-08-12' AND west_superstore.discount = 0.2 AND west_superstore.region = 'West'
Database: superstore
Note: Security-Tint Envelopes' refers to "product name"; ordered on June 3, 2013 refers to "order date" = '2013-06-03';
Question: What is the order ID of the security-Tint Envelopes product ordered on June 3, 2013, in the Central region?
SQL: SELECT DISTINCT central_superstore.`order id` FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE product.`product name` = 'Security-Tint Envelopes' AND central_superstore.`order date` = '2013-06-03'
Database: superstore
Question: List the product's name bought by the customer named Bill Shonely from the Central region.
SQL: SELECT DISTINCT product.`product name` FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` INNER JOIN product ON product.`product id` = central_superstore.`product id` WHERE people.`customer name` = 'Bill Shonely' AND central_superstore.region = 'Central'
Database: superstore
Note: name of customers refers to "customer name"; bought exactly 8 items refers to quantity = 8;
Question: Please give the name of customers from the West region that bought exactly 8 items in their purchase.
SQL: SELECT DISTINCT people.`customer name` FROM west_superstore INNER JOIN people ON west_superstore.`customer id` = people.`customer id` WHERE west_superstore.quantity = 8 AND west_superstore.region = 'West'
Database: superstore
Note: customers from Houston, Texas refers to state = 'Texas' and city = 'Houston'; total profit = sum(profit);
Question: Among the customers from Houston, Texas, what is the total profit of their orders in the Central region?
SQL: SELECT sum(central_superstore.profit) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` INNER JOIN product ON product.`product id` = central_superstore.`product id` WHERE people.city = 'Houston' AND people.state = 'Texas' AND central_superstore.region = 'Central'
Database: superstore
Note: Who is the customer refers to customer name; shipped on March 5, 2013 refers to "ship date" = '2013-03-05'; eastern region refers to region = 'East';
Question: Who is the customer with an order shipped on March 5, 2013, in the eastern region?
SQL: SELECT DISTINCT people.`customer name` FROM east_superstore INNER JOIN people ON east_superstore.`customer id` = people.`customer id` WHERE east_superstore.`ship date` = '2013-03-05'
Database: superstore
Note: orders from 2016 refers to "order date" = '2016%'; product refers to "product name"; lowest profit refers to min(profit);
Question: Among the orders from 2016 in the Central region, what is the product with the lowest profit?
SQL: SELECT product.`product name` FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE product.region = 'Central' AND strftime('%Y', central_superstore.`order date`) = '2016' ORDER BY central_superstore.profit ASC LIMIT 1
Database: superstore
Note: Who refers to "customer name";
Question: Who ordered the order ID CA-2011-118976 from the East region?
SQL: SELECT DISTINCT people.`customer name` FROM east_superstore INNER JOIN people ON east_superstore.`customer id` = people.`customer id` WHERE east_superstore.`order id` = 'CA-2011-118976' AND people.region = 'East'
Database: superstore
Note: highest sales refers to max(sales);
Question: Provide the product's name of the product with the highest sales in the South region.
SQL: SELECT product.`product name` FROM south_superstore INNER JOIN product ON south_superstore.`product id` = product.`product id` WHERE product.region = 'South' ORDER BY south_superstore.sales DESC LIMIT 1
Database: superstore
Question: List down the sales, profit, and subcategories of the product ordered in the order ID US-2011-126571 in the East region.
SQL: SELECT east_superstore.sales, east_superstore.profit, product.`sub-category` FROM east_superstore INNER JOIN product ON east_superstore.`product id` = product.`product id` WHERE east_superstore.`order id` = 'US-2011-126571' AND product.region = 'East'
Database: superstore
Note: highest quantity refers to max(quantity);
Question: What is the product's name in the highest quantity in a single purchase?
SQL: SELECT product.`product name` FROM east_superstore INNER JOIN product ON east_superstore.`product id` = product.`product id` WHERE product.region = 'East' ORDER BY east_superstore.quantity DESC LIMIT 1
Database: superstore
Note: sales greater than the 88% of the average sales of all orders refers to sales > avg(sales) * 0.88; South region refers to south_superstore;
Question: List the customer's name from the South region with a standard class ship mode and sales greater than the 88% of the average sales of all orders.
SQL: SELECT DISTINCT people.`customer name` FROM south_superstore INNER JOIN people ON south_superstore.`customer id` = people.`customer id` WHERE people.region = 'South' AND south_superstore.`ship mode` = 'Standard Class' AND 100 * south_superstore.sales / ( SELECT avg(sales) FROM south_superstore ) > 88
Database: superstore
Note: Indiana refers to state = 'Indiana'; no discount refers to discount = 0; percentage = divide(sum(discount) when discount = 0, count(discount)) as percentage;
Question: Among the customers from Indiana, what is the percentage of their purchased orders in the Central region with no discount?
SQL: SELECT cast(sum(CASE  WHEN central_superstore.discount = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` WHERE central_superstore.region = 'Central' AND people.state = 'Indiana'
Database: shooting
Note: male refers to gender = 'M'; white refers to race = 'W'; percentage = divide(count(officers where race = 'W'), count(officers)) where gender = 'M' * 100%;
Question: Among all the male officers, what is the percentage of them are White?
SQL: SELECT cast(sum(iif(race = 'W', 1, 0)) AS REAL) * 100 / count(case_number) FROM officers WHERE gender = 'M'
Database: shooting
Note: more than 3 officers refers to officer_count > 3; from year 2010 to 2015 refers to date between '2010-01-01' and '2015-12-31'; percentage = divide(count(case_number where officer_count > 3), count(case_number)) where date between '2010-01-01' and '2015-12-31' * 100%;
Question: What is the percentage of the cases involved more than 3 officers from year 2010 to 2015?
SQL: SELECT cast(sum(iif(officer_count > 3, 1, 0)) AS REAL) * 100 / count(case_number) FROM incidents WHERE strftime('%Y', date) BETWEEN '2010' AND '2015'
Database: shooting
Note: year refers to year(date); the greatest number of cases refers to max(count(case_number)); OS Spray was used as weapon refers to subject_weapon = 'OS Spray';
Question: In which year has the greatest number of cases where Handgun was used as weapon?
SQL: SELECT strftime('%Y', date) FROM incidents WHERE subject_weapon = 'Handgun' GROUP BY strftime('%Y', date) ORDER BY count(case_number) DESC LIMIT 1
Database: shooting
Note: dismissed by the grand jury disposition refers to grand_jury_disposition = 'No Bill'; the subject is injured refers to subject_statuses = 'injured'; percentage = divide(count(incidents where subject_statuses = 'injured'), count(incidents)) where grand_jury_disposition = 'No Bill' * 100%;
Question: Among the cases dismissed by the grand jury disposition, what percentage of cases is where the subject is injured?
SQL: SELECT cast(sum(subject_statuses = 'Injured') AS REAL) * 100 / count(case_number) FROM incidents WHERE grand_jury_disposition = 'No Bill'
Database: shooting
Note: number of cases refers to count(case_number); with Vehicle as subject weapon refers to subject_weapon = 'Vehicle'; year 2007 refers to date between '2007-01-01' and '2007-12-31'; year 2008 refers to date between '2008-01-01' and '2008-12-31';
Question: Did the number of cases with Vehicle as subject weapon increase or decrease from year 2007 to 2008. State the difference.
SQL: SELECT sum(iif(strftime('%Y', date) = '2007', 1, 0)) - sum(iif(strftime('%Y', date) = '2008', 1, 0)) FROM incidents WHERE subject_weapon = 'Vehicle'
Database: shooting
Note: 'Handgun' weapon refers to subject_weapon = 'Handgun'; 'Shoot and Miss' refers to subject_statuses = 'Shoot and Miss'; percent = divide(count(incidents where subject_statuses = 'Shoot and Miss'), count(incidents)) where subject_weapon = 'Handgun' * 100%;
Question: Among the 'Handgun' weapon used by subject, how many percent were 'Shoot and Miss'?
SQL: SELECT cast(sum(subject_statuses = 'Shoot and Miss') AS REAL) * 100 / count(case_number) FROM incidents WHERE subject_weapon = 'Handgun'
Database: shooting
Note: voted as 'No Bill' refers to grand_jury_disposition = 'No Bill';
Question: Who are the officers involved in cases that are voted as 'No Bill'. List their last name and gender.
SQL: SELECT officers.last_name, officers.gender FROM incidents INNER JOIN officers ON incidents.case_number = officers.case_number WHERE incidents.grand_jury_disposition = 'No Bill'
Database: shooting
Note: female refers to gender = 'F'; weapon refers to subject_weapon;
Question: Which are the cases where the subject are female. List the case number, subject status and weapon.
SQL: SELECT incidents.case_number, incidents.subject_statuses, incidents.subject_weapon FROM incidents INNER JOIN subjects ON incidents.case_number = subjects.case_number WHERE subjects.gender = 'F'
Database: shooting
Note: male refers to gender = 'M';
Question: From the cases where the subject are male, list the case number and the location and subject status.
SQL: SELECT incidents.case_number, incidents.location, incidents.subject_statuses FROM incidents INNER JOIN subjects ON incidents.case_number = subjects.case_number WHERE subjects.gender = 'M'
Database: shooting
Note: officer 'Evenden, George' refers to full_name = 'Evenden, George';
Question: For case(s) where officer 'Evenden, George' is in charged, state the case number and the grand jury disposition?
SQL: SELECT incidents.case_number, incidents.grand_jury_disposition FROM incidents INNER JOIN officers ON incidents.case_number = officers.case_number WHERE officers.first_name = 'George' AND officers.last_name = 'Evenden'
Database: shooting
Question: For case number '134472-2015', list the last name of the officers involved and state the subject statuses.
SQL: SELECT officers.last_name, incidents.subject_statuses FROM incidents INNER JOIN officers ON incidents.case_number = officers.case_number WHERE incidents.case_number = '134472-2015'
Database: shooting
Note: subject were deceased refers to subject_statuses = 'Deceased';
Question: From the cases where the subject were deceased, list the subject's last name, gender, race and case number.
SQL: SELECT subjects.last_name, subjects.gender, subjects.race, subjects.case_number FROM incidents INNER JOIN subjects ON incidents.case_number = subjects.case_number WHERE incidents.subject_statuses = 'Deceased'
Database: shooting
Note: female refers to gender = 'F'; use Vehicle as weapon refers to subject_weapon = 'Vehicle'; percentage = divide(count(case_number where subject_weapon = 'Vehicle'), count(case_number)) where gender = 'F' * 100%;
Question: What is the percentage of subject who are female used the Vehicle as weapon?
SQL: SELECT cast(sum(incidents.subject_weapon = 'Vehicle') AS REAL) * 100 / count(incidents.case_number) FROM incidents incidents INNER JOIN subjects subjects ON incidents.case_number = subjects.case_number WHERE subjects.gender = 'F'
Database: shooting
Note: the 'Shoot and Miss' status refers to subject_statuses = 'Shoot and Miss'; knife refers to subject_weapon = 'knife'; toy handgun refers to subject_weapon = 'toy handgun'; ratio = divide(count(case_number where subject_weapon = 'knife'), count(case_number where subject_weapon = 'toy handgun')) where subject_statuses = 'Shoot and Miss';
Question: From the 'Injured' statuses of the subject, what is the ratio of weapons used are knife against handgun?
SQL: SELECT cast(sum(incidents.subject_weapon = 'Knife') AS REAL) * 100 / sum(incidents.subject_weapon = 'Handgun') FROM incidents INNER JOIN subjects ON incidents.case_number = subjects.case_number WHERE incidents.subject_statuses = 'Injured'
Database: shooting
Note: case refers to case_number; year 2012 refers to date between '2012-01-01' and '2012-12-31'; subject was deceased refers to subject_statuses = 'Deceased';
Question: List all cases from the year 2012 in which the subject was deceased
SQL: SELECT case_number FROM incidents WHERE strftime('%Y', date) > '2011' AND subject_statuses = 'Deceased'
Database: shooting
Note: male refers to gender = 'M'; black refers to race = 'B'; percentage = divide(count(officers where race = 'B'), count(officers)) where gender = 'M' * 100%;
Question: Of all male officers, what percentage are black officers?
SQL: SELECT cast(sum(race = 'B') AS REAL) * 100 / count(case_number) FROM officers WHERE gender = 'M'
Database: shooting
Note: subject's weapon was a vehicle refers to subject_weapon = 'Vehicle'; female refers to gender = 'F';
Question: How many incidents in which the subject's weapon was a vehicle were investigated by a female officer?
SQL: SELECT count(incidents.case_number) FROM incidents INNER JOIN officers ON incidents.case_number = officers.case_number WHERE incidents.subject_weapon = 'Vehicle' AND officers.gender = 'F'
Database: shooting
Note: female refers to gender = 'F'; subject's status listed as Deceased refers to subject_statuses = 'Deceased';
Question: In how many cases where the subject was a female was the subject's status listed as Deceased?
SQL: SELECT count(incidents.case_number) FROM incidents INNER JOIN subjects ON incidents.case_number = subjects.case_number WHERE subjects.gender = 'F' AND incidents.subject_statuses = 'Deceased'
Database: shooting
Note: black refers to race = 'B'; between the years 2010 and 2015 refers to date between '2010-01-01' and '2015-12-31'; case refers to case_number;
Question: Of the black officers, how many of them investigated cases between the years 2010 and 2015?
SQL: SELECT count(officers.case_number) FROM officers INNER JOIN incidents ON incidents.case_number = officers.case_number WHERE officers.race = 'B' AND incidents.date BETWEEN '2010-01-01' AND '2015-12-31'
Database: shooting
Note: in June 2015 refers to date between '2015-06-01' and '2015-06-30'; record number refers to case_number;
Question: How many instances were found in June 2015?
SQL: SELECT count(case_number) FROM incidents WHERE date BETWEEN '2015-06-01' AND '2015-06-30'
Database: shooting
Note: injured refers to subject_statuses = 'injured'; between 2006 and 2014 refers to date between '2006-01-01' and '2013-12-31'; handgun refers to subject_weapon = 'handgun'; where the incidents took place refers to location;
Question: How many people were injured between 2006 and 2014 as a result of a handgun?
SQL: SELECT count(LOCATION) FROM incidents WHERE subject_weapon = 'Handgun' AND subject_statuses = 'Injured' AND date BETWEEN '2006-01-01' AND '2013-12-31'
Database: shooting
Note: the most common type of weapon refers to max(count(subject_weapon)); causes death refers to subject_statuses = 'Deceased';
Question: What is the most common type of weapon that causes death?
SQL: SELECT subject_weapon FROM incidents WHERE subject_statuses = 'Deceased' GROUP BY subject_weapon ORDER BY count(case_number) DESC LIMIT 1
Database: shooting
Note: 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%;
Question: What is the proportion of white males and females in the police force?
SQL: SELECT cast(sum(gender = 'M') AS REAL) / sum(gender = 'F') FROM officers WHERE race = 'W'
Database: shooting
Note: 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';
Question: How many more black female victims than white female victims were discovered?
SQL: SELECT sum(race = 'B') - sum(race = 'W') FROM subjects WHERE gender = 'F'
Database: shooting
Note: rifle refers to subject_weapon = 'rifles'; death refers to subject_statuses = 'Deceased'; percentage = divide(count(incidents where subject_weapon = 'rifles'), count(incidents)) where subject_statuses = 'Deceased' * 100%;
Question: What percentage of deaths were caused by rifles?
SQL: SELECT cast(sum(subject_statuses = 'Deceased') AS REAL) * 100 / count(case_number) FROM incidents WHERE subject_weapon = 'Rifle'
Database: shooting
Note: type of weapon refers to subject_weapon; record number 031347-2015 refers to case_number = '031347-2015';
Question: Which type of weapon was used to attack the victim in the record number 031347-2015? What is the victim's race and gender?
SQL: SELECT incidents.subject_weapon, subjects.race, subjects.gender FROM incidents INNER JOIN subjects ON incidents.case_number = subjects.case_number WHERE incidents.case_number = '031347-2015'
Database: shooting
Note: near-death refers to subject_statuses = 'Deceased Injured'; incident refers to case_number; Ruben Fredirick refers to full_name = 'Ruben Fredirick';
Question: 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?
SQL: SELECT incidents.case_number, subjects.race, subjects.gender FROM incidents INNER JOIN officers ON incidents.case_number = officers.case_number INNER JOIN subjects ON incidents.case_number = subjects.case_number WHERE officers.first_name = 'Fredirick' AND officers.last_name = 'Ruben'
Database: shooting
Note: male refers to gender = 'M'; people were injured refers to subject_statuses = 'Injured'; proportion = divide(count(case_number where gender = 'M'), count(case_number)) where subject_statuses = 'Injured' * 100%;
Question: What proportion of male police officers looked into events where people were injured?
SQL: SELECT cast(sum(officers.gender = 'M') AS REAL) * 100 / count(incidents.case_number) FROM incidents incidents INNER JOIN officers officers ON incidents.case_number = officers.case_number WHERE incidents.subject_statuses = 'Injured'
Database: genes
Question: For the genes that are located in the plasma membrane, please list their number of chromosomes.
SQL: SELECT genes.chromosome FROM genes INNER JOIN classification ON genes.geneid = classification.geneid WHERE classification.localization = 'plasma membrane'
Database: genes
Question: How many non-essential genes are located in the nucleus?
SQL: SELECT count(genes.geneid) FROM genes INNER JOIN classification ON genes.geneid = classification.geneid WHERE classification.localization = 'nucleus' AND genes.essential = 'Non-Essential'
Database: genes
Question: Among the genes with nucleic acid metabolism defects, how many of them can be found in the vacuole?
SQL: SELECT count(genes.geneid) FROM genes INNER JOIN classification ON genes.geneid = classification.geneid WHERE classification.localization = 'vacuole' AND genes.phenotype = 'Nucleic acid metabolism defects'
Database: genes
Question: Please list the location of the genes that have the most chromosomes.
SQL: SELECT classification.localization FROM genes INNER JOIN classification ON genes.geneid = classification.geneid ORDER BY genes.chromosome DESC LIMIT 1