Database: movie_3
Question: How many customers are still active?
Evidence: active refers to active = 1
SQL: SELECT COUNT(customer_id) FROM customer WHERE active = 1

Database: retail_world
Question: State the company name of all suppliers in USA.
Evidence: in USA refers to Country = 'USA'
SQL: SELECT CompanyName FROM Suppliers WHERE Country = 'USA'

Database: retails
Question: Please list any three customers with debt.
Evidence: customer refers to c_name; with debt refers to c_acctbal < 0
SQL: SELECT c_name FROM customer WHERE c_acctbal < 0 LIMIT 3

Database: soccer_2016
Question: Where did SB Joshi come from?
Evidence: SB Joshi refers to Player_Name = 'SB Joshi'; where the player come from refers to Country_Name
SQL: SELECT T2.Country_Name FROM Player AS T1 INNER JOIN Country AS T2 ON T1.Country_Name = T2.Country_ID WHERE T1.Player_Name = 'SB Joshi'

Database: world
Question: How many languages are used in Cyprus?
Evidence: Cyprus is a name of Country;
SQL: SELECT SUM(CASE WHEN T1.Name = 'Cyprus' THEN 1 ELSE 0 END) FROM Country AS T1 INNER JOIN CountryLanguage AS T2 ON T1.Code = T2.CountryCode

Database: public_review_platform
Question: Provide the businesses name in Tempe city whose opening hours are earlier than 8AM.
Evidence: opening hours refers to opening_time; earlier than 8AM refers to opening_time < '8AM';
SQL: SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T3.city LIKE 'Tempe' AND T4.opening_time < '8AM'

Database: chicago_crime
Question: What is the average number of reckless homicides that happened in a district?
Evidence: "RECKLESS HOMICIDE" is the secondary_description; average = Divide (Count(report_no), Count(district_name))
SQL: SELECT CAST(COUNT(T2.report_no) AS REAL) / COUNT(DISTINCT T1.district_name) FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no INNER JOIN IUCR AS T3 ON T3.iucr_no = T2.iucr_no WHERE T3.secondary_description = 'RECKLESS HOMICIDE'

Database: retail_world
Question: What is the re-order level of products that have an order quantity of 1?
Evidence: order quantity of 1 refers to Quantity = 1
SQL: SELECT T1.ReorderLevel FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity = 1

Database: computer_student
Question: Describe the year in program and in phase status for the student with most number in advisor.
Evidence: student refers to advisedBy.p_id; most number in advisor refers to max(count(p_id_dummy))
SQL: SELECT T2.yearsInProgram, T2.inPhase FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(*) DESC LIMIT 1

Database: book_publishing_company
Question: Name the store with ID 7066 and calculate the percentage of the the quantity ordered that were on 'Net 30' payment terms.
Evidence: store with ID 7066 refers to stor_ID = '7066'; 'Net 60' payment terms refers to payterm = 'Net 60'; qty is abbreviation for quantity; percentage = DIVIDE(payterms = 'Net 60', sum(qty))*100
SQL: SELECT T2.stor_name , CAST(SUM(CASE WHEN payterms = 'Net 30' THEN qty ELSE 0 END) AS REAL) * 100 / SUM(qty) FROM sales AS T1 INNER JOIN stores AS T2 ON T1.stor_id = T2.stor_id WHERE T1.stor_id = '7066' GROUP BY T2.stor_name

Database: book_publishing_company
Question: Name the publisher which has the most titles published in 1991.
Evidence: most title published refers to MAX(count(title_id); published in 1991 refers to YEAR(pubdate) = 1991
SQL: SELECT T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE STRFTIME('%Y', T1.pubdate) = '1991' GROUP BY T1.pub_id, T2.pub_name ORDER BY COUNT(T1.title_id) DESC LIMIT 1

Database: human_resources
Question: Among the employees who are Trainees, how many of them work in New York?
Evidence: Trainees is a position title; California refers to state = 'NY'
SQL: SELECT COUNT(*) FROM employee AS T1  INNER JOIN location AS T2  ON T1.locationID = T2.locationID INNER JOIN position AS T3  ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Trainee' AND T2.state = 'NY'

Database: video_games
Question: Please list the names of the publishers of all the puzzle games.
Evidence: name of publisher refers to publisher_name; puzzle refers to genre_name = 'Puzzle'
SQL: SELECT DISTINCT T3.publisher_name FROM game AS T1 INNER JOIN game_publisher AS T2 ON T1.id = T2.game_id INNER JOIN publisher AS T3 ON T2.publisher_id = T3.id INNER JOIN genre AS T4 ON T1.genre_id = T4.id WHERE T4.genre_name = 'Puzzle'

Database: movie_3
Question: What is the average amount of rent that Christy Vargas paid?
Evidence: 'Christy Vargas' is a full name of a customer; full name refers to first_name, last_name; average amount of rent refers to AVG(amount)
SQL: SELECT AVG(T2.amount) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'CHRISTY' AND T1.Last_name = 'VARGAS'

Database: image_and_language
Question: What are the width and height of the bounding box of the object with "keyboard" as their object class and (5, 647) as their coordinate?
Evidence: The bounding box's W and H abbreviations stand for the object's width and height respectively; "keyboard" as object class refers to OBJ_CLASS = 'keyboard'; (5, 647) as coordinate refers to X and Y coordinates of the bounding box where X = 5 and Y = 647;
SQL: SELECT T1.W, T1.H FROM IMG_OBJ AS T1 INNER JOIN OBJ_CLASSES AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.OBJ_CLASS = 'keyboard' AND T1.X = 5 AND T1.Y = 647

Database: soccer_2016
Question: How many matches were held at the venue named "Newlands"?
Evidence: the venue named "Newlands" refers to Venue_Name = 'Newlands'
SQL: SELECT SUM(CASE WHEN T2.Venue_Name = 'Newlands' THEN 1 ELSE 0 END) FROM Match AS T1 INNER JOIN Venue AS T2 ON T2.Venue_Id = T1.Venue_Id

Database: bike_share_1
Question: How many trips which subscription types were Subscriber and ended in San Jose city?
Evidence: ended in refers to end_station_name;
SQL: SELECT COUNT(T1.subscription_type) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.end_station_name WHERE T1.subscription_type = 'Subscriber' AND T2.city = 'San Jose'

Database: software_company
Question: In female customers ages from 50 to 60, how many of them has an number of inhabitants ranges from 19 to 24?
Evidence: female customers ages from 50 to 60 refer to SEX = 'Female' where age BETWEEN 50 AND 60; number of inhabitants ranges from 19 to 24 refers to INHABITANTS_K BETWEEN 19 AND 24;
SQL: SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Female' AND T1.age >= 50 AND T1.age <= 60 AND T2.INHABITANTS_K >= 19 AND T2.INHABITANTS_K <= 24

Database: sales
Question: How many employees sold over 20,000 quantities of "Touring-2000 Blue, 50"?
Evidence: over 20,000 quantities refers to Quantity > 20000; 'Touring-2000 Blue, 50' is name of product;
SQL: SELECT COUNT(*) FROM ( SELECT SUM(Quantity) FROM Sales WHERE ProductID IN ( SELECT ProductID FROM Products WHERE Name = 'Touring-2000 Blue, 50' ) GROUP BY Quantity, SalesPersonID HAVING SUM(Quantity) > 20000 )

Database: sales
Question: Which product has the highest total amount of quantity sold? Calculate its overall total price.
Evidence: highest total amount of quantity refers to MAX(Quantity); overall total price = SUM(MULTIPLY(Quantity, Price));
SQL: SELECT T1.Name, SUM(T2.Quantity * T1.Price) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID, T1.Name ORDER BY SUM(T2.Quantity) DESC LIMIT 1