1sf/bird-sql-train-with-schema huggingface dataset:
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: Please list the names of coins that has been disappeared.
Evidence: has disappeared refers to status = 'extinct'
SQL: SELECT name FROM coins WHERE status = 'extinct'
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: What's the descripition of BitBar?
SQL: SELECT description FROM coins WHERE name = 'BitBar'
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: How many coins were added in May 2013? Please list the names of coins.
Evidence: in May 2013 refers to year(date_added) = 2013 and month(date_added) = 5
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
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: List the names and symbols of the coins that were added on June 14, 2013.
Evidence: added on June 14, 2013 refers to date_added like '2013-06-14%'
SQL: SELECT name, symbol FROM coins WHERE date_added LIKE '2013-06-14%'
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: List the names of coins that cannot be traded in 2014.
Evidence: cannot be tracked refers to status = 'untracked'; in 2014 refers to year(date_added) = '2014'
SQL: SELECT name FROM coins WHERE date_added LIKE '2014%' AND status = 'untracked'
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: Name the coins that have three tags.
Evidence: have three tags refers to length(tag_names)-length(replace(tag_names,',','')) = 2
SQL: SELECT name FROM coins WHERE LENGTH(tag_names) - LENGTH(replace(tag_names, ',', '')) = 2
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: What is the name of the coin with the highest price?
Evidence: the highest price refers to max(price)
SQL: SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.price = ( SELECT MAX(price) FROM historical )
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: Please name the coin that ranked first among the coins traded on April 29, 2013.
Evidence: ranked first refers to cmc_rank = 1; on April 29, 2013 refers to date = '2013-04-29'
SQL: SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-29' AND T2.cmc_rank = 1
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: When is the best time to purchase Bitcoin?
Evidence: lowest price refers to low; best time refers to date with the low;
SQL: SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Bitcoin' ORDER BY T2.low LIMIT 1
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: What is the name of the coin that creates the most total value in the past 24 hours?
Evidence: creates the most total value in the past 24 hours refers to max(volume_24h)
SQL: SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.volume_24h = ( SELECT MAX(volume_24h) FROM historical )
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: Name the coins that were not opened on May 2013.
Evidence: not opened refers to open IS NULL; on May 2013 refers to year(date) = 2019 AND month(date) = 5
SQL: SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE STRFTIME('%Y-%m', T2.date) = '2013-05' AND T2.open IS NULL
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: When is the highest closed price of CHNCoin?
Evidence: the highest closed price refers to max(close)
SQL: SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'CHNCoin' ORDER BY T2.close DESC LIMIT 1
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: When did Peercoin rank fifth?
Evidence: when refers to date; rank fifth refers to cmc_rank = 5
SQL: SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Peercoin' AND T2.cmc_rank = 5
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: When is Devcoin most valuable in the market?
Evidence: when refers to date; most valuable refers to max(market_cap)
SQL: SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Devcoin' ORDER BY T2.market_cap DESC LIMIT 1
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: List the names of the top five coins traded on January 1, 2014.
Evidence: the top five coins refers to cmc_rank< = 5; on January 1, 2014 refers to date = '2014-01-01'
SQL: SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2014-01-01' AND T2.cmc_rank <= 5
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: When was Lebowskis not opened?
Evidence: when refers to date; not opened refers to open IS NULL
SQL: SELECT DISTINCT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Lebowskis' AND (T2.open IS NULL OR T2.open = 0)
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: When is the highest price of Terracoin?
Evidence: when refers to date; the highest price refers to max(price)
SQL: SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Terracoin' ORDER BY T2.price DESC LIMIT 1
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: How many times was Bytecoin traded in June 2013?
Evidence: in June 2013 refers to year(date) = 2013 AND month(date) = 6
SQL: SELECT COUNT(T2.coin_id) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Bytecoin' AND STRFTIME('%Y-%m', T2.date) = '2013-06'
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
Question: List the names of the coins above the average price on April 28, 2013.
Evidence: average price = divide(sum(price), count(name)); on April 28, 2013 refers to date = '2013-04-28'
SQL: SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2018-04-28' AND T2.price > ( SELECT AVG(price) FROM historical WHERE date = '2018-04-28' )
Database: coinmarketcap
Tables: coins, historical
Columns (table index, column name): -1, *, 0, id, 0, name, 0, slug, 0, symbol, 0, status, 0, category, 0, description, 0, subreddit, 0, notice, 0, tags, 0, tag_names, 0, website, 0, platform_id, 0, date_added, 0, date_launched, 1, date, 1, coin_id, 1, cmc_rank, 1, market_cap, 1, price, 1, open, 1, high, 1, low, 1, close, 1, time_high, 1, time_low, 1, volume_24h, 1, percent_change_1h, 1, percent_change_24h, 1, percent_change_7d, 1, circulating_supply, 1, total_supply, 1, max_supply, 1, num_market_pairs
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.
Evidence: 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'
SQL: SELECT T1.NAME FROM coins AS T1 INNER JOIN historical AS T2 ON T1.ID = T2.coin_id WHERE T2.DATE = '2013-05-29' AND T2.percent_change_1h > 0
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: How many employees have obtained a doctorate?
Evidence: doctorate refers to TitleOfCourtesy = 'Dr.;
SQL: SELECT COUNT(EmployeeID) FROM Employees WHERE TitleOfCourtesy = 'Dr.'
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: To whom does Nancy Davolio report? Please give that employee's full name.
Evidence: to whom refers to ReportsTo; full name = FirstName, LastName;
SQL: SELECT FirstName, LastName FROM Employees WHERE EmployeeID = ( SELECT ReportsTo FROM Employees WHERE LastName = 'Davolio' AND FirstName = 'Nancy' )
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: Which phone number should I call if I want to reach Nancy Davolio's home?
Evidence: phone number of Nancy Davolio's home refers to HomePhone WHERE FirstName = 'Nancy' AND LastName = 'Davolio';
SQL: SELECT HomePhone FROM Employees WHERE LastName = 'Davolio' AND FirstName = 'Nancy'
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: How many employees have Andrew Fuller as their direct supervisor?
Evidence: direct supervisor refers to ReportsTo where the person being reported to is usually the direct supervisor of the reporter;
SQL: SELECT COUNT(EmployeeID) FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE LastName = 'Fuller' AND FirstName = 'Andrew' )
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: Which employee has the highest salary? Please give his or her full name.
Evidence: highest salary refers to MAX(Salary); full name = FirstName, LastName;
SQL: SELECT FirstName, LastName FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: How much higher is the salary of Andrew Fuller than that of Nancy Davolio?
Evidence: how much higher = SUBTRACT(SUM(Salary WHERE LastName = 'Fuller' and FirstName = 'Andrew'), SUM(Salary WHERE LastName = 'Davolio' and FirstName = 'Nancy'));
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
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: Among the employees working as Sales Representatives, how many of them are located in the UK?
Evidence: Sales Representatives refers to Title = 'Sales Representative'; UK refers to Country = 'UK';
SQL: SELECT COUNT(Country) FROM Employees WHERE Title = 'Sales Representative' AND Country = 'UK'