Chinastark/bird_dataset huggingface dataset:
Database: coinmarketcap
Note: average percentage price changed from the previous 24 hours refers to AVG(percent_change_24h); on 15/5/2013 refers to date = '2013-04-15';
Question: Name the coin that have higher than average percentage price changed from the previous 24 hours for transaction on 2013/6/22.
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2020-06-22' GROUP BY coins.name HAVING avg(historical.percent_change_24h) > historical.price
Database: coinmarketcap
Note: ranked the first refers to cmc_rank = 1; on 2013/4/28 refers to date = '2013-04-28';
Question: Which crytocurrency was ranked the first by CoinMarketCap on 2013/4/28?
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-04-28' AND historical.cmc_rank = 1
Database: coinmarketcap
Note: worth refers to price; on 2013/4/28 refers to date = '2013-04-28';
Question: How much dollars was a Bitcoin worth on 2013/4/28 according to the coin market?
SQL: SELECT historical.market_cap FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-04-28' AND coins.name = 'Bitcoin'
Database: coinmarketcap
Note: not opened refers to open IS NULL; on 2013/5/3 refers to date = '2013-05-03';
Question: Which crytocurrency was not opened on 2013/5/3?
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-05-03' AND historical.open IS NULL
Database: coinmarketcap
Note: price when it closed refers to close; on 2013/4/29 refers to date = '2013-04-29';
Question: What was the price of Bitcoin when it closed at the end of the day on 2013/4/29?
SQL: SELECT historical.close FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-04-29' AND coins.name = 'Bitcoin'
Database: coinmarketcap
Note: time that a coin reaches its highest price refers to time_high; on 2013/4/29 refers to date = '2013-04-29';
Question: When did Bitcoin reach its highest price on 2013/4/29?
SQL: SELECT historical.time_high FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-04-29' AND coins.name = 'Bitcoin'
Database: coinmarketcap
Note: the max profit = subtract(high, low); on 2013/4/28 refers to date = '2013-04-28';
Question: What was the max profit a user can make on Bitcoin on 2013/4/28?
SQL: SELECT historical.high - historical.low FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-04-28' AND coins.name = 'Bitcoin'
Database: coinmarketcap
Note: the number of Bitcoins verifiably burned = max_supply - total_supply; 2013/4/28 refers to date = '2013-04-28';
Question: What was the number of Bitcoins verifiably burned until 2013/4/28?
SQL: SELECT historical.max_supply - historical.total_supply FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-04-28' AND coins.name = 'Bitcoin'
Database: coinmarketcap
Note: traded in the highest value refers to max(volume_24h); on 2016/1/8 refers to date = '2016-01-08';
Question: Which crytocurrency was traded in the highest value on 2016/1/8?
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2016-01-08' AND historical.volume_24h = ( SELECT max(volume_24h) FROM historical WHERE date = '2016-01-08' )
Database: coinmarketcap
Note: a total amount of existence of over 10000000 refers to total_supply>10000000; on 2013/4/28 refers to date = '2013-04-28';
Question: Please list the names of the crytocurrencies that have a total amount of existence of over 10000000 on 2013/4/28.
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-04-28' AND historical.total_supply > 10000000
Database: coinmarketcap
Note: price increased refers to percent_change_7d>0; decreased refers percent_change_7d<0; on 2013/5/5 refers to date = '2013-05-05';
Question: Had Bitcoin's price increased or decreased on 2013/5/5 compared with the price 7 days before?
SQL: SELECT (CASE WHEN historical.percent_change_7d > 0 THEN 'INCREASED' ELSE 'DECREASED' END) FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-05-05' AND coins.name = 'Bitcoin'
Database: coinmarketcap
Note: a bigger number of coins circulating in the market refers to max(circulating_supply); on 2013/4/28 refers to date = '2013-04-28';
Question: Which crytocurrency had a bigger number of coins circulating in the market and in the general public's hands on 2013/4/28, Bitcoin or Litecoin?
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-04-28' AND coins.name IN ('Bitcoin', 'Litecoin') ORDER BY historical.circulating_supply DESC LIMIT 1
Database: coinmarketcap
Note: how much refers to price; on 2013/4/28 refers to date = '2013-04-28';
Question: How much was a Bitcoin on 2013/4/28?
SQL: SELECT historical.price FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-04-28' AND coins.name = 'Bitcoin'
Database: coinmarketcap
Note: average price refers SUM(price)/COUNT(named = 'Bitcoin'); in the year 2013 refers to year(date) = 2013;
Question: What was the average price of a Bitcoin in the year 2013?
SQL: SELECT avg(historical.price) FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE strftime('%Y', historical.date) = '2013' AND coins.name = 'Bitcoin'
Database: coinmarketcap
Note: the percentage of the Bitcoins verifiably burned = divide(subtract(SUM(max_supply), SUM(total_supply)),SUM(total_supply))*100%; until 2013/4/28 refers to date<'2013-04-08';
Question: What was the percentage of the Bitcoins verifiably burned until 2018/4/28?
SQL: SELECT cast((sum(historical.max_supply) - sum(historical.total_supply)) AS REAL) / sum(historical.total_supply) FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date < '2018-04-28' AND coins.name = 'Bitcoin'
Database: coinmarketcap
Note: has disappeared refers to status = 'extinct';
Question: Please list the names of coins that has been disappeared.
SQL: SELECT name FROM coins WHERE status = 'extinct'
Database: coinmarketcap
Question: What's the descripition of BitBar?
SQL: SELECT description FROM coins WHERE name = 'BitBar'
Database: coinmarketcap
Note: in May 2013 refers to year(date_added) = 2013 and month(date_added) = 5;
Question: How many coins were added in May 2013? Please list the names of coins.
SQL: SELECT count(id) num FROM coins WHERE strftime('%Y-%m', date_added) = '2013-05' UNION ALL SELECT name FROM coins WHERE strftime('%Y-%m', date_added) = '2013-05'
Database: coinmarketcap
Note: added on June 14, 2013 refers to date_added like '2013-06-14%';
Question: List the names and symbols of the coins that were added on June 14, 2013.
SQL: SELECT name, symbol FROM coins WHERE date_added LIKE '2013-06-14%'
Database: coinmarketcap
Note: cannot be tracked refers to status = 'untracked'; in 2014 refers to year(date_added) = '2014';
Question: List the names of coins that cannot be traded in 2014.
SQL: SELECT name FROM coins WHERE date_added LIKE '2014%' AND status = 'untracked'
Database: coinmarketcap
Note: have three tags refers to length(tag_names)-length(replace(tag_names,',','')) = 2;
Question: Name the coins that have three tags.
SQL: SELECT name FROM coins WHERE length(tag_names) - length(replace(tag_names, ',', '')) = 2
Database: coinmarketcap
Note: the highest price refers to max(price);
Question: What is the name of the coin with the highest price?
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.price = ( SELECT max(price) FROM historical )
Database: coinmarketcap
Note: ranked first refers to cmc_rank = 1; on April 29, 2013 refers to date = '2013-04-29';
Question: Please name the coin that ranked first among the coins traded on April 29, 2013.
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-04-29' AND historical.cmc_rank = 1
Database: coinmarketcap
Note: lowest price refers to low; best time refers to date with the low;
Question: When is the best time to purchase Bitcoin?
SQL: SELECT historical.date FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'Bitcoin' ORDER BY historical.low LIMIT 1
Database: coinmarketcap
Note: creates the most total value in the past 24 hours refers to max(volume_24h);
Question: What is the name of the coin that creates the most total value in the past 24 hours?
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.volume_24h = ( SELECT max(volume_24h) FROM historical )
Database: coinmarketcap
Note: not opened refers to open IS NULL; on May 2013 refers to year(date) = 2019 AND month(date) = 5;
Question: Name the coins that were not opened on May 2013.
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE strftime('%Y-%m', historical.date) = '2013-05' AND historical.open IS NULL
Database: coinmarketcap
Note: the highest closed price refers to max(close);
Question: When is the highest closed price of CHNCoin?
SQL: SELECT historical.date FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'CHNCoin' ORDER BY historical.close DESC LIMIT 1
Database: coinmarketcap
Note: when refers to date; rank fifth refers to cmc_rank = 5;
Question: When did Peercoin rank fifth?
SQL: SELECT historical.date FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'Peercoin' AND historical.cmc_rank = 5
Database: coinmarketcap
Note: when refers to date; most valuable refers to max(market_cap);
Question: When is Devcoin most valuable in the market?
SQL: SELECT historical.date FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'Devcoin' ORDER BY historical.market_cap DESC LIMIT 1
Database: coinmarketcap
Note: the top five coins refers to cmc_rank<= 5; on January 1, 2014 refers to date = '2014-01-01';
Question: List the names of the top five coins traded on January 1, 2014.
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2014-01-01' AND historical.cmc_rank <= 5
Database: coinmarketcap
Note: when refers to date; not opened refers to open IS NULL;
Question: When was Lebowskis not opened?
SQL: SELECT DISTINCT historical.date FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'Lebowskis' AND (historical.open IS NULL OR historical.open = 0)
Database: coinmarketcap
Note: when refers to date; the highest price refers to max(price);
Question: When is the highest price of Terracoin?
SQL: SELECT historical.date FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'Terracoin' ORDER BY historical.price DESC LIMIT 1
Database: coinmarketcap
Note: in June 2013 refers to year(date) = 2013 AND month(date) = 6;
Question: How many times was Bytecoin traded in June 2013?
SQL: SELECT count(historical.coin_id) FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'Bytecoin' AND strftime('%Y-%m', historical.date) = '2013-06'
Database: coinmarketcap
Note: average price = divide(sum(price), count(name)); on April 28, 2013 refers to date = '2013-04-28';
Question: List the names of the coins above the average price on April 28, 2013.
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2018-04-28' AND historical.price > ( SELECT avg(price) FROM historical WHERE date = '2018-04-28' )
Database: coinmarketcap
Note: percentage that is higher than the price 1 hour ago refers to percent_change_1h>0; in May 29,2013 refers to date = '2013-05-29';
Question: What's the percentage of coins that is higher than the price 1 hour ago in May 29,2013? List the names of these coins.
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date = '2013-05-29' AND historical.percent_change_1h > 0
Database: retail_world
Note: doctorate refers to TitleOfCourtesy = 'Dr.;
Question: How many employees have obtained a doctorate?
SQL: SELECT count(employeeid) FROM employees WHERE titleofcourtesy = 'Dr.'
Database: retail_world
Note: to whom refers to ReportsTo; full name = firstname, lastname;
Question: To whom does Nancy Davolio report? Please give that employee's full name.
SQL: SELECT firstname, lastname FROM employees WHERE employeeid = ( SELECT reportsto FROM employees WHERE lastname = 'Davolio' AND firstname = 'Nancy' )
Database: retail_world
Note: phone number of Nancy Davolio's home refers to Homephone WHERE firstname = 'Nancy' AND lastname = 'Davolio';
Question: Which phone number should I call if I want to reach Nancy Davolio's home?
SQL: SELECT homephone FROM employees WHERE lastname = 'Davolio' AND firstname = 'Nancy'
Database: retail_world
Note: direct supervisor refers to ReportsTo where the person being reported to is usually the direct supervisor of the reporter;
Question: How many employees have Andrew Fuller as their direct supervisor?
SQL: SELECT count(employeeid) FROM employees WHERE reportsto = ( SELECT employeeid FROM employees WHERE lastname = 'Fuller' AND firstname = 'Andrew' )
Database: retail_world
Note: highest salary refers to MAX(Salary); full name = firstname, lastname;
Question: Which employee has the highest salary? Please give his or her full name.
SQL: SELECT firstname, lastname FROM employees WHERE salary = ( SELECT max(salary) FROM employees )
Database: retail_world
Note: how much higher = SUBTRACT(SUM(Salary WHERE lastname = 'Fuller' and firstname = 'Andrew'), SUM(Salary WHERE lastname = 'Davolio' and firstname = 'Nancy'));
Question: How much higher is the salary of Andrew Fuller than that of Nancy Davolio?
SQL: SELECT ( SELECT salary FROM employees WHERE lastname = 'Fuller' AND firstname = 'Andrew' ) - ( SELECT salary FROM employees WHERE lastname = 'Davolio' AND firstname = 'Nancy' ) AS RESULT
Database: retail_world
Note: Sales Representatives refers to Title = 'Sales Representative'; UK refers to country = 'UK';
Question: Among the employees working as Sales Representatives, how many of them are located in the UK?
SQL: SELECT count(country) FROM employees WHERE title = 'Sales Representative' AND country = 'UK'
Database: retail_world
Note: Hollis refers to Territorydescription = 'Hollis'; full name = firstname, lastname;
Question: Which employee is in charge of the sales in Hollis? Please give the employee's full name.
SQL: SELECT employees.firstname, employees.lastname FROM employees INNER JOIN employeeterritories ON employees.employeeid = employeeterritories.employeeid INNER JOIN territories ON employeeterritories.territoryid = territories.territoryid WHERE territories.territorydescription = 'Hollis'
Database: retail_world
Question: The sales of how many territories is Nancy Davolio in charge of?
SQL: SELECT count(employeeterritories.territoryid) FROM employees INNER JOIN employeeterritories ON employees.employeeid = employeeterritories.employeeid WHERE employees.firstname = 'Nancy' AND employees.lastname = 'Davolio'
Database: retail_world
Note: names of all territories refers to Territorydescription;
Question: Please list the names of all the territories whose sales are taken in charge by Nancy Davolio.
SQL: SELECT territories.territorydescription FROM employees INNER JOIN employeeterritories ON employees.employeeid = employeeterritories.employeeid INNER JOIN territories ON employeeterritories.territoryid = territories.territoryid WHERE employees.firstname = 'Nancy' AND employees.lastname = 'Davolio'
Database: retail_world
Note: London refers to city = 'London';
Question: The sales of how many territories in total do the employees in London take charge of?
SQL: SELECT count(employeeterritories.territoryid) FROM employees INNER JOIN employeeterritories ON employees.employeeid = employeeterritories.employeeid WHERE employees.city = 'London'
Database: retail_world
Note: territories refers to Territorydescription;
Question: Please list the territories whose sales are taken in charge by the employees who report to Andrew Fuller.
SQL: SELECT territories.territorydescription FROM employees INNER JOIN employeeterritories ON employees.employeeid = employeeterritories.employeeid INNER JOIN territories ON employeeterritories.territoryid = territories.territoryid WHERE employees.reportsto = ( SELECT employeeid FROM employees WHERE firstname = 'Andrew' AND lastname = 'Fuller' )
Database: retail_world
Note: UK refers to country = 'UK'; employees with over 4 territories refers to employeeid WHERE TerritoryID > 4;
Question: How many employees in the UK takes charge of the sales in over 4 territories?
SQL: SELECT count(counteid) FROM ( SELECT employees.employeeid AS counteid FROM employees INNER JOIN employeeterritories ON employees.employeeid = employeeterritories.employeeid WHERE employees.country = 'UK' GROUP BY employees.employeeid HAVING count(employeeterritories.territoryid) > 4 ) employees
Database: retail_world
Note: Eastern Region refers to Regiondescription = 'Eastern';
Question: How many territories are there in the Eastern Region?
SQL: SELECT count(territories.territoryid) FROM territories INNER JOIN region ON territories.regionid = region.regionid WHERE region.regiondescription = 'Eastern'
Database: retail_world
Note: territories refers to Territorydescription; Eastern Region refers to Regiondescription = 'Eastern';
Question: Please list all the territories in the Eastern Region.
SQL: SELECT DISTINCT territories.territorydescription FROM territories INNER JOIN region ON territories.regionid = region.regionid WHERE region.regiondescription = 'Eastern'
Database: retail_world
Note: Eastern Region refers to Regiondescription = 'Eastern';
Question: How many employees in total are in charge of the sales in the Eastern Region?
SQL: SELECT count(t.employeeid) FROM ( SELECT employeeterritories.employeeid FROM region INNER JOIN territories ON region.regionid = territories.regionid INNER JOIN employeeterritories ON territories.territoryid = employeeterritories.territoryid WHERE region.regiondescription = 'Eastern' GROUP BY employeeterritories.employeeid ) t
Database: retail_world
Note: home phone numbers refers to Homephone; Eastern Region refers to Regiondescription = 'Eastern';
Question: Please list the home phone numbers of the employees who are in charge of the sales in the territories in the Eastern Region.
SQL: SELECT employees.homephone FROM employees INNER JOIN employeeterritories ON employees.employeeid = employeeterritories.employeeid INNER JOIN territories ON employeeterritories.territoryid = territories.territoryid INNER JOIN region ON territories.regionid = region.regionid WHERE region.regiondescription = 'Eastern ' GROUP BY employees.homephone
Database: retail_world
Note: how many more = SUBTRACT(SUM(Regiondescription = 'Eastern'), SUM(Regiondescription = 'Southern')); Eastern Region refers to Regiondescription = 'Eastern'; Southern Region refers to Regiondescription = 'Southern';
Question: How many more territories are there in than Eastern Region than in the Southern Region?
SQL: SELECT ( SELECT count(territories.territoryid) FROM territories INNER JOIN region ON territories.regionid = region.regionid WHERE region.regiondescription = 'Eastern' ) - ( SELECT count(territories.territoryid) FROM territories INNER JOIN region ON territories.regionid = region.regionid WHERE region.regiondescription = 'Southern' ) AS calu
Database: retail_world
Note: names of the products refers to productname; order no. refers to orderid;
Question: Please list the names of all the products ordered in order no. 10248.
SQL: SELECT products.productname FROM products INNER JOIN `order details` ON products.productid = order details.productid WHERE order details.orderid = 10248
Database: retail_world
Note: Ikura refers to productname = 'Ikura'; order no. refers to orderid;
Question: What is the quantity of Ikura ordered in order no. 10273?
SQL: SELECT order details.quantity FROM products INNER JOIN `order details` ON products.productid = order details.productid WHERE order details.orderid = 10273 AND products.productname = 'Ikura'
Database: retail_world
Note: total price = MULTIPLY(unitprice, quantity); Ikura refers to productname = 'Ikura'; order no. refers to orderid;
Question: What is the total price of Ikura ordered in order no. 10273?
SQL: SELECT order details.unitprice * order details.quantity FROM products INNER JOIN `order details` ON products.productid = order details.productid WHERE order details.orderid = 10273 AND products.productname = 'Ikura'
Database: retail_world
Note: total production of the product = SUM(units in stock, units on order); order no. refers to orderid;
Question: What is the total production of the product that is ordered in the highest quantity in order no. 10248?
SQL: SELECT products.unitsinstock + products.unitsonorder FROM products INNER JOIN `order details` ON products.productid = order details.productid WHERE order details.orderid = 10248 ORDER BY order details.quantity DESC LIMIT 1
Database: retail_world
Note: order no. refers to orderid; highest user satisfaction refers to MAX(ReorderLevel);
Question: Of all the products ordered in order no. 10248, which product has the highest user satisfaction?
SQL: SELECT products.productname FROM products INNER JOIN `order details` ON products.productid = order details.productid WHERE order details.orderid = 10248 ORDER BY products.reorderlevel DESC LIMIT 1
Database: retail_world
Note: product refers to productname;
Question: How many orders have asked for the product Tofu?
SQL: SELECT count(order details.orderid) FROM products INNER JOIN `order details` ON products.productid = order details.productid WHERE products.productname = 'Tofu'
Database: retail_world
Note: IDs of the orders refers to orderid; production is not continuous refers to Discontinued = 1;
Question: Please list the IDs of the orders with a product whose production is not continuous.
SQL: SELECT order details.orderid FROM products INNER JOIN `order details` ON products.productid = order details.productid WHERE products.discontinued = 1
Database: retail_world
Note: Ikura refers to productname = 'Ikura'; ordered unit price that's lower than its standard unit price refers to "Order Details".unitprice < "Product".unitprice;
Question: Of all the orders that have ordered Ikura, how many of them enjoys a unit price that's lower than its standard unit price?
SQL: SELECT count(order details.orderid) FROM products INNER JOIN `order details` ON products.productid = order details.productid WHERE products.productname = 'Ikura' AND order details.unitprice < products.unitprice
Database: retail_world
Note: name of the supplier refers to CompanyName; Aniseed Syrup refers to productname = 'Aniseed Syrup';
Question: What is the name of the supplier company for Aniseed Syrup?
SQL: SELECT suppliers.companyname FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE products.productname = 'Aniseed Syrup'
Database: retail_world
Note: names of the products refers to productname; Japan refers to country = 'Japan';
Question: Please list the names of all the products whose supplier is in Japan.
SQL: SELECT products.productname FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE suppliers.country = 'Japan'
Database: retail_world
Note: unitsInStock < unitsOnOrder;
Question: Please list the phone numbers of the suppliers of the products that have a higher units on order than units in stock.
SQL: SELECT DISTINCT suppliers.phone FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE products.unitsinstock < products.unitsonorder