problem
stringlengths
121
422
db_id
stringclasses
69 values
solution
stringlengths
23
804
Write SQL query to solve given problem: Provide the inspection ID of the inspection with the comment "MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA" and sanitary operating requirement code of 7-38-030, 015, 010 (A), 005 (A).. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT T2.inspection_id FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspector_comment = 'MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA' AND T1.code = '7-38-030, 015, 010 (A), 005 (A)'
Write SQL query to solve given problem: List down the names of the establishments with the highest risk level and failed the inspection.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.risk_level = 3 AND T2.results = 'Fail'
Write SQL query to solve given problem: What is the inspection ID where the employee named "David Hodges" is currently employed in the "Kamayan Express" establishment?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT T2.inspection_id FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T3.first_name = 'David' AND T3.last_name = 'Hodges' AND T1.dba_name = 'KAMAYAN EXPRESS'
Write SQL query to solve given problem: Provide the salary range of the employee involved in the inspection ID 58424.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT T1.salary, T3.salary FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN employee AS T3 WHERE T2.inspection_id = 58424 ORDER BY T1.salary, T3.salary DESC LIMIT 1
Write SQL query to solve given problem: List down the inspection ID with the inspector's comment "A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served. NO CERTIFIED FOOD MANAGER ON DUTY AT THIS TIME FOODS ARE COOKED AND SERVED SERIOUS CITATION ISSUED" and inspection category of Personnel.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT T2.inspection_id FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.category = 'Personnel' AND T2.inspector_comment = 'A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served.FOUND NO CITY OF CHICAGO SANITATION CERTIFICATE POSTED OR VALID DOCUMENTATION DURING THIS INSPECTION.'
Write SQL query to solve given problem: How many grocery stores paid $250 fine upon their inspection?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.facility_type = 'Grocery Store' AND T3.fine = 250
Write SQL query to solve given problem: What is the category of the inspection of the establishment named "J & J FOOD"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT DISTINCT T4.category FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id INNER JOIN inspection_point AS T4 ON T3.point_id = T4.point_id WHERE T1.dba_name = 'J & J FOOD'
Write SQL query to solve given problem: Name the taverns that failed the inspection in January 2010.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE strftime('%Y-%m', T2.inspection_date) = '2010-01' AND T2.results = 'Fail' AND T1.facility_type = 'TAVERN'
Write SQL query to solve given problem: How many of the inspections with serious point levels have no fines?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(DISTINCT T2.inspection_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.point_level = 'Serious ' AND T2.fine = 0
Write SQL query to solve given problem: What is the establishment's name with an inspection category of No Smoking Regulations?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id INNER JOIN inspection_point AS T4 ON T3.point_id = T4.point_id WHERE T4.category = 'No Smoking Regulations'
Write SQL query to solve given problem: What is the difference in the number of restaurants that passed and failed the canvass inspection type?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(CASE WHEN T2.results = 'Pass' THEN T1.license_no END) - COUNT(CASE WHEN T2.results = 'Fail' THEN T1.license_no END) AS diff FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.inspection_type = 'Canvass' AND T1.facility_type = 'Restaurant'
Write SQL query to solve given problem: Among the establishments that failed the inspection in February 2010, list the names of the employees with a salary greater than 70% of the average salary of all employees.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT DISTINCT T1.employee_id FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.results = 'Fail' AND strftime('%Y-%m', T2.inspection_date) = '2010-02' AND T1.salary > 0.7 * ( SELECT AVG(salary) FROM employee )
Write SQL query to solve given problem: Among the establishments that paid a 500 fine, what is the percentage of restaurants?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT CAST(COUNT(CASE WHEN T1.facility_type = 'Restaurant' THEN T1.license_no END) AS REAL) * 100 / COUNT(T1.facility_type) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T3.fine = 500
Write SQL query to solve given problem: Name the coin that has the highest market capitalization for all transactions in 2018.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date LIKE '2018%' AND T2.market_cap = ( SELECT MAX(market_cap) FROM historical WHERE STRFTIME('%Y', date) = '2018' )
Write SQL query to solve given problem: What is the total value of Argentum coined traded in the past 24 hours on 2016/10/11.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T2.volume_24h FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Argentum' AND T2.date = '2016-10-11'
Write SQL query to solve given problem: List the price for Zetacoin on 13/11/1 and the next 7 consecutive days. What is the average price for these 7 days?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Zetacoin' AND T2.date BETWEEN '2013-11-01' AND '2013-11-07' UNION ALL SELECT AVG(T2.PRICE) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Zetacoin' AND T2.date BETWEEN '2013-11-01' AND '2013-11-07'
Write SQL query to solve given problem: For all transactions for WRAP in August 2016, list the time to achieve highest price and the time to achieve the lowest price.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T2.time_high, T2.time_low, T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'WARP' AND STRFTIME('%Y-%m', T2.date) = '2016-08'
Write SQL query to solve given problem: State the transaction date whereby DigixDAO was transacted at the hightest price.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'DigixDAO' ORDER BY T2.price DESC LIMIT 1
Write SQL query to solve given problem: Name the coin with the highest percentage price changed in 24 hours. State the transaction date and price.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T1.name, T2.DATE, T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.percent_change_24h = ( SELECT MAX(percent_change_24h) FROM historical )
Write SQL query to solve given problem: What is the average monthly circulating supply for Frozen in 2014.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT CAST(SUM(T2.circulating_supply) AS REAL) / 12 FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Frozen' AND STRFTIME('%Y', T2.date) = '2014'
Write SQL query to solve given problem: List all the inactive coins and state the last date of its transaction?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T1.NAME, MAX(T2.DATE) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.ID = T2.coin_id WHERE T1.status = 'inactive' ORDER BY T2.DATE DESC LIMIT 1
Write SQL query to solve given problem: What was the price of 1 Bitcoin in 2016?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT AVG(T2.price) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Bitcoin' AND STRFTIME('%Y', T2.date) = '2016'
Write SQL query to solve given problem: State the transaction date and the price when Bitcoin was bottomed?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T2.date, T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Bitcoin' ORDER BY T2.price LIMIT 1
Write SQL query to solve given problem: For all coins with average price more than $1000. State the current status of the coin.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T1.status FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id GROUP BY T1.name HAVING AVG(T2.price) > 1000
Write SQL query to solve given problem: Name the coin and date of transactions with the greatest decline in percent change in 1 hour.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T1.name, T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.percent_change_1h = ( SELECT MIN(percent_change_1h) FROM historical )
Write SQL query to solve given problem: Name the coin under the token category that gives the highest max profit.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.category = 'token' ORDER BY T2.high - T2.low DESC LIMIT 1
Write SQL query to solve given problem: Name the coin that have higher than average percentage price changed from the previous 24 hours for transaction on 2013/6/22.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2020-06-22' GROUP BY T1.name HAVING AVG(T2.percent_change_24h) > T2.PRICE
Write SQL query to solve given problem: Which crytocurrency was ranked the first by CoinMarketCap on 2013/4/28?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T2.cmc_rank = 1
Write SQL query to solve given problem: How much dollars was a Bitcoin worth on 2013/4/28 according to the coin market?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T2.market_cap FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name = 'Bitcoin'
Write SQL query to solve given problem: Which crytocurrency was not opened on 2013/5/3?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-05-03' AND T2.open IS NULL
Write SQL query to solve given problem: What was the price of Bitcoin when it closed at the end of the day on 2013/4/29?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T2.close FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-29' AND T1.name = 'Bitcoin'
Write SQL query to solve given problem: When did Bitcoin reach its highest price on 2013/4/29?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T2.time_high FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-29' AND T1.name = 'Bitcoin'
Write SQL query to solve given problem: What was the max profit a user can make on Bitcoin on 2013/4/28?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T2.high - T2.low FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name = 'Bitcoin'
Write SQL query to solve given problem: What was the number of Bitcoins verifiably burned until 2013/4/28?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T2.max_supply - T2.total_supply FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name = 'Bitcoin'
Write SQL query to solve given problem: Which crytocurrency was traded in the highest value on 2016/1/8?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2016-01-08' AND T2.volume_24h = ( SELECT MAX(volume_24h) FROM historical WHERE date = '2016-01-08' )
Write SQL query to solve given problem: Please list the names of the crytocurrencies that have a total amount of existence of over 10000000 on 2013/4/28.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T2.total_supply > 10000000
Write SQL query to solve given problem: Had Bitcoin's price increased or decreased on 2013/5/5 compared with the price 7 days before?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT (CASE WHEN T2.percent_change_7d > 0 THEN 'INCREASED' ELSE 'DECREASED' END) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-05-05' AND T1.name = 'Bitcoin'
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name IN ('Bitcoin', 'Litecoin') ORDER BY T2.circulating_supply DESC LIMIT 1
Write SQL query to solve given problem: How much was a Bitcoin on 2013/4/28?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name = 'Bitcoin'
Write SQL query to solve given problem: What was the average price of a Bitcoin in the year 2013?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT AVG(T2.price) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE STRFTIME('%Y', T2.date) = '2013' AND T1.name = 'Bitcoin'
Write SQL query to solve given problem: What was the percentage of the Bitcoins verifiably burned until 2018/4/28?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT CAST((SUM(T2.max_supply) - SUM(T2.total_supply)) AS REAL) / SUM(T2.total_supply) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date < '2018-04-28' AND T1.name = 'Bitcoin'
Write SQL query to solve given problem: Please list the names of coins that has been disappeared.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT name FROM coins WHERE status = 'extinct'
Write SQL query to solve given problem: What's the descripition of BitBar?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT description FROM coins WHERE name = 'BitBar'
Write SQL query to solve given problem: How many coins were added in May 2013? Please list the names of coins.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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'
Write SQL query to solve given problem: List the names and symbols of the coins that were added on June 14, 2013.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT name, symbol FROM coins WHERE date_added LIKE '2013-06-14%'
Write SQL query to solve given problem: List the names of coins that cannot be traded in 2014.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT name FROM coins WHERE date_added LIKE '2014%' AND status = 'untracked'
Write SQL query to solve given problem: Name the coins that have three tags.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
SELECT name FROM coins WHERE LENGTH(tag_names) - LENGTH(replace(tag_names, ',', '')) = 2
Write SQL query to solve given problem: What is the name of the coin with the highest price?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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 )
Write SQL query to solve given problem: Please name the coin that ranked first among the coins traded on April 29, 2013.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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
Write SQL query to solve given problem: When is the best time to purchase Bitcoin?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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
Write SQL query to solve given problem: What is the name of the coin that creates the most total value in the past 24 hours?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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 )
Write SQL query to solve given problem: Name the coins that were not opened on May 2013.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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
Write SQL query to solve given problem: When is the highest closed price of CHNCoin?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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
Write SQL query to solve given problem: When did Peercoin rank fifth?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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
Write SQL query to solve given problem: When is Devcoin most valuable in the market?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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
Write SQL query to solve given problem: List the names of the top five coins traded on January 1, 2014.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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
Write SQL query to solve given problem: When was Lebowskis not opened?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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)
Write SQL query to solve given problem: When is the highest price of Terracoin?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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
Write SQL query to solve given problem: How many times was Bytecoin traded in June 2013?. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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'
Write SQL query to solve given problem: List the names of the coins above the average price on April 28, 2013.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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' )
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ```
coinmarketcap
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
Write SQL query to solve given problem: How many employees in the UK takes charge of the sales in over 4 territories?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT COUNT(COUNTEID) FROM ( SELECT T1.EmployeeID AS COUNTEID FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.Country = 'UK' GROUP BY T1.EmployeeID HAVING COUNT(T2.TerritoryID) > 4 ) T1
Write SQL query to solve given problem: Please list the names of all the products ordered in order no. 10248.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T1.ProductName FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10248
Write SQL query to solve given problem: What is the quantity of Ikura ordered in order no. 10273?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T2.Quantity FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10273 AND T1.ProductName = 'Ikura'
Write SQL query to solve given problem: What is the total price of Ikura ordered in order no. 10273?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T2.UnitPrice * T2.Quantity FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10273 AND T1.ProductName = 'Ikura'
Write SQL query to solve given problem: What is the total production of the product that is ordered in the highest quantity in order no. 10248?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T1.UnitsInStock + T1.UnitsOnOrder FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10248 ORDER BY T2.Quantity DESC LIMIT 1
Write SQL query to solve given problem: Of all the products ordered in order no. 10248, which product has the highest user satisfaction?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T1.ProductName FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10248 ORDER BY T1.ReorderLevel DESC LIMIT 1
Write SQL query to solve given problem: Please list the IDs of the orders with a product whose production is not continuous.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T2.OrderID FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Discontinued = 1
Write SQL query to solve given problem: Among the products that are no longer in continuous production, how many of them have their supplier in the USA?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT COUNT(T1.Discontinued) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'USA' AND T1.Discontinued = 1
Write SQL query to solve given problem: What is the average salary of the employees who takes charge of the sales of over 4 territories?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT AVG(T1.Salary) FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.EmployeeID HAVING COUNT(T2.TerritoryID) > 4
Write SQL query to solve given problem: How much lower in percentage is the unit price of Ikura in order no. 10273 than its standard unit price?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT CAST((T1.UnitPrice - T2.UnitPrice) AS REAL) * 100 / T1.UnitPrice FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10273 AND T1.ProductName = 'Ikura'
Write SQL query to solve given problem: Among the products ordered in order no. 10248, which product has the biggest ratio of units on order to units in stock?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T1.ProductName FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10248 ORDER BY T1.UnitsOnOrder / T1.UnitsInStock DESC LIMIT 1
Write SQL query to solve given problem: For the order from "HILAA" on 1997/12/25, what was the total quantity of the products in that order?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT SUM(T2.Quantity) FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID WHERE T1.CustomerID = 'HILAA' AND T1.OrderDate LIKE '1997-12-25%'
Write SQL query to solve given problem: Tell the name of the shipper company for the order No.10585.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T2.CompanyName FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.OrderID = 10585
Write SQL query to solve given problem: For the orders of Customer "WHITC", what is the percentage of the orders were fulfilled with shipper company "United Package"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT CAST(COUNT(CASE WHEN T2.CompanyName = 'United Package' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.CustomerID = 'WHITC'
Write SQL query to solve given problem: How many percent more orders were fulfilled with shipper company "United Package" than with "Speedy Express"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT CAST((COUNT(CASE WHEN T2.CompanyName = 'United Package' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T2.CompanyName = 'Speedy Express' THEN 1 ELSE NULL END)) AS REAL) * 100 / COUNT(CASE WHEN T2.CompanyName = 'Speedy Express' THEN 1 ELSE NULL END) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID
Write SQL query to solve given problem: How many customers are there in the country with the highest number of customers?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT COUNT(CustomerID) FROM Customers GROUP BY Country ORDER BY COUNT(CustomerID) DESC LIMIT 1
Write SQL query to solve given problem: What are the order ids of the orders with freight of over 800?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT OrderID FROM Orders WHERE Freight > 800
Write SQL query to solve given problem: What are the names of the products that were discountinued?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT ProductName FROM Products WHERE Discontinued = 1
Write SQL query to solve given problem: What is the most widely used shipping company in the United States of America?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T2.CompanyName FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.ShipCountry = 'USA' GROUP BY T2.CompanyName ORDER BY COUNT(T2.CompanyName) DESC LIMIT 1
Write SQL query to solve given problem: How many suppliers in Australia whose products were discontinued?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT COUNT(T1.Discontinued) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.Discontinued = 1 AND T2.Country = 'Australia'
Write SQL query to solve given problem: How much is the total purchase price, including freight, of the top 2 most expensive products?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T2.UnitPrice * T2.Quantity + T1.Freight FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID ORDER BY T2.UnitPrice * T2.Quantity + T1.Freight DESC LIMIT 2
Write SQL query to solve given problem: What is the name of the supplier that supplies the most products to the company?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T1.SupplierID FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID GROUP BY T1.SupplierID ORDER BY COUNT(*) DESC LIMIT 1
Write SQL query to solve given problem: What are the names of the products that were ordered that have a unit price of no more than 5?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT DISTINCT T1.ProductName FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.UnitPrice < 5
Write SQL query to solve given problem: What is the title of the employee with the highest number of territories in charge?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T1.Title FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.Title ORDER BY COUNT(T2.TerritoryID) DESC LIMIT 1
Write SQL query to solve given problem: What is the most ordered products by customers?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T1.ProductID FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID ORDER BY COUNT(*) DESC LIMIT 1
Write SQL query to solve given problem: Among the beverages, which product has the highest customer satisfaction?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.CategoryName = 'Beverages' ORDER BY T1.ReorderLevel DESC LIMIT 1
Write SQL query to solve given problem: What is the full name of the employee who handled the highest amount of orders?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.FirstName, T1.LastName ORDER BY COUNT(*) DESC LIMIT 1
Write SQL query to solve given problem: How many products were ordered in the order with the highest freight?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT COUNT(T2.ProductID) FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID GROUP BY T2.ProductID ORDER BY COUNT(T1.Freight) DESC LIMIT 1
Write SQL query to solve given problem: Among the seafood products, which product have the highest total production of the production?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.CategoryName = 'Seafood' ORDER BY T1.UnitsInStock + T1.UnitsOnOrder DESC LIMIT 1
Write SQL query to solve given problem: What is the difference in salary of the top 2 employees with the highest number of territories in charge?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT MAX(Salary) - MIN(Salary) FROM ( SELECT T1.Salary FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.EmployeeID, T1.Salary ORDER BY COUNT(T2.TerritoryID) DESC LIMIT 2 ) T1
Write SQL query to solve given problem: What is the average price of products with more than fifty units in stock?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT SUM(UnitPrice) / COUNT(UnitPrice) FROM Products WHERE UnitsInStock > 50
Write SQL query to solve given problem: List the company names of customers from the city with the most customers.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT CompanyName FROM `Customer and Suppliers by City` WHERE CITY = ( SELECT City FROM `Customer and Suppliers by City` GROUP BY City ORDER BY COUNT(Relationship) DESC LIMIT 1 )
Write SQL query to solve given problem: Calculate the average price of products shipped to the UK.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT AVG(UnitPrice) AS avg FROM Invoices WHERE Country = 'UK'
Write SQL query to solve given problem: Among all the orders, which products sold for the most amount?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT ProductID FROM `Order Details` GROUP BY ProductID ORDER BY SUM(Quantity) DESC LIMIT 1
Write SQL query to solve given problem: List the name, address, and phone number of companies that supply products for more than thirty dollars per unit.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T2.CompanyName, T2.Address, T2.Phone FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitPrice > 30
Write SQL query to solve given problem: List the names of non-US suppliers that have discontinued.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT DISTINCT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.Discontinued = 1 AND T2.Country != 'USA'
Write SQL query to solve given problem: List the top five most costly products in 1998.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
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.OrderDate LIKE '1998%' ORDER BY T3.UnitPrice + T1.Freight DESC LIMIT 5
Write SQL query to solve given problem: List the name of the top ten most ordered product's names in descending order of the number of orders.. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
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 GROUP BY T3.ProductName ORDER BY COUNT(*) DESC LIMIT 10
Write SQL query to solve given problem: Which supplier supplies the most amount of products?. Keep the solution inside sql tag ```sql [SQL-Query] ```
retail_world
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID GROUP BY T2.SupplierID, T2.CompanyName ORDER BY COUNT(T1.ProductName) DESC LIMIT 1