sentence
stringlengths
3
347
sql
stringlengths
18
804
What is the lowest First Elected, when Results is "Re-elected", and when Incumbent is "Lincoln Davis"?
SELECT MIN(first_elected) FROM table_name_38 WHERE results = "re-elected" AND incumbent = "lincoln davis"
What is last name of William?
SELECT STU_LNAME FROM student where STU_FNAME = "William"
Among the matches, what percentage have a winning margin above 100?
SELECT CAST(COUNT(CASE WHEN Win_Margin > 100 THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(Match_Id) FROM `Match`
Provide the name, located country, and life expectancy of the most populated city
SELECT T2.Name, T1.Code, T1.LifeExpectancy FROM Country AS T1 INNER JOIN City AS T2 ON T1.Code = T2.CountryCode ORDER BY T2.Population DESC LIMIT 1
What are the names of the chairs of festivals, sorted in ascending order of the year held?
SELECT Chair_Name FROM festival_detail ORDER BY YEAR
What are the employee ids for employees who make more than the average?
SELECT employee_id FROM employees WHERE salary > (SELECT AVG(salary) FROM employees)
Which city is the headquarter of the store named "Blackville" in?
SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t1.store_name = "Blackville"
When did the episode viewed by 10.50 millions of people in the US run for the first time?
SELECT original_air_date FROM table_23799653_1 WHERE us_viewers__millions_ = "10.50"
Tell me the shigella for yersinia yopb
SELECT shigella FROM table_name_52 WHERE yersinia = "yopb"
Where is the city of Maharashtra's Pune team?
SELECT city FROM table_name_31 WHERE state = "maharashtra" AND team = "pune"
How many female clients are there older than 30?
SELECT COUNT(sex) FROM client WHERE sex = 'Female' AND age > 30
Which 2009 tournament had Grand Slams?
SELECT tournament FROM table_name_58 WHERE 2009 = "grand slams"
How many incumbents were first elected in 1930?
SELECT COUNT(party) FROM table_1342292_45 WHERE first_elected = 1930
Give me the immunization codes and dates on which Ms. Jacquelyn Shanahan was immunized with influenza seasonal injectable preservative-free vaccine.
SELECT DISTINCT T2.CODE, T2.DATE FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Ms.' AND T1.first = 'Jacquelyn' AND T1.last = 'Shanahan' AND T2.DESCRIPTION = 'Influenza seasonal injectable preservative free'
Which poll source had an other of 15%?
SELECT poll_source FROM table_name_38 WHERE other = "15%"
are in tobago species liophis cobellus cobellus?
SELECT tobago FROM table_1850282_5 WHERE species = "Liophis cobellus cobellus"
Of which company is Mr. Eduardo Martins a customer?
SELECT company FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins"
In the Catalan language, which biwords pair appeared the most in this language/page?
SELECT w1st, w2nd FROM biwords WHERE occurrences = ( SELECT MAX(occurrences) FROM biwords )
Name the un region for 378000 population
SELECT un_region FROM table_16278349_1 WHERE population = 378000
What are the full names of employees who with in department 70 or 90?
SELECT first_name , last_name FROM employees WHERE department_id = 70 OR department_id = 90
What are the different colleges this season?
SELECT DISTINCT college FROM match_season
What is the party of the legislator named Susan M. Collins?
SELECT T2.party FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Susan M. Collins' GROUP BY T2.party
And what is his phone number?
SELECT phone FROM customers WHERE first_name = "Eduardo" AND last_name = "Martins"
How many games did they lose when they tied less than 2 games?
SELECT lost FROM table_name_39 WHERE draw < 2
Give the address of the staff member who has the first name Elsa.
SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa'
What was the average value for Fall 07 when Fall 09 is less than 296?
SELECT AVG(fall_07) FROM table_name_99 WHERE fall_09 < 296
What position did the Belenenses club occupy in 1960/61?
SELECT position_in_1960_1961 FROM table_name_2 WHERE clubs = "belenenses"
What is the engine type when the max torque at rpm is n·m ( lbf·ft ) @ 4,800 Answers:?
SELECT engine_type FROM table_1147705_1 WHERE max_torque_at_rpm = "N·m ( lbf·ft ) @ 4,800"
How many customers have no payment histories?
SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments );
Which class has a power output larger than 700 and a class of 48?
SELECT class FROM table_name_75 WHERE power_output__kw_ > 700 AND number_in_class = 48
Which event is a win by an opponent of Nicolas Smith, with the round marked n/a?
SELECT event FROM table_name_24 WHERE res = "win" AND round = "n/a" AND opponent = "nicolas smith"
Find the personal name, family name, and author ID of the course author that teaches the most courses.
SELECT T1.personal_name , T1.family_name , T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id ORDER BY COUNT(*) DESC LIMIT 1
List the official full names of all the legislators who have facebook, instagram, twitter and youtube accounts.
SELECT T1.official_full_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.facebook IS NOT NULL AND T2.instagram IS NOT NULL AND T2.twitter IS NOT NULL AND T2.youtube IS NOT NULL
What was the total attendance on 10/05/1974?
SELECT COUNT(attendance) FROM table_name_10 WHERE date = "10/05/1974"
What is the outcome of the tournament with partner ilie năstase?
SELECT outcome FROM table_name_65 WHERE partner = "ilie năstase"
How many picks were from round 6?
SELECT COUNT(pick) FROM table_name_84 WHERE round = 6
Name the score for 2 june 2008
SELECT score FROM table_name_97 WHERE date = "2 june 2008"
OK, do you have the names of the above stores?
SELECT store_name FROM department_stores GROUP BY dept_store_chain_id ORDER BY count ( * ) DESC LIMIT 2
what's the district  with candidates being william madison whittington (d) unopposed
SELECT district FROM table_1342379_23 WHERE candidates = "William Madison Whittington (D) Unopposed"
What are the names and buying prices of all the products?
SELECT product_name , typical_buying_price FROM products
What are the names of tourist attractions that can be reached by bus or is at address 254 Ottilie Junction?
SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = "254 Ottilie Junction" OR T2.How_to_Get_There = "bus"
Who did the team play against in the game that resulted with a loss?
SELECT opponent FROM table_21063459_1 WHERE result = "Loss"
Name the series number directed by richard thorpe written by dee johnson
SELECT MAX(series__number) FROM table_17355579_1 WHERE directed_by = "Richard Thorpe" AND written_by = "Dee Johnson"
Show the names of members and the location of the performances they attended.
SELECT T2.Name , T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID
What are the number of international and domestic passengers of the airport named London "Heathrow"?
SELECT International_Passengers , Domestic_Passengers FROM airport WHERE Airport_Name = "London Heathrow"
What is the percentage of matches that are won by runs?
SELECT CAST(SUM(CASE WHEN T1.win_type = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Win_Type) FROM Match AS T1 INNER JOIN Win_By AS T2 ON T1.Win_Type = T2.Win_Id
What is the distance from Jaffa of Jerusalem station?
SELECT distance_from_jaffa FROM table_name_1 WHERE name_location = "jerusalem"
How many gains have a long greater than 8, with avg/g of 124.9?
SELECT SUM(gain) FROM table_name_27 WHERE long > 8 AND avg_g = 124.9
What are the ids and full names for employees who work in a department that has someone with a first name that contains the letter T?
SELECT employee_id , first_name , last_name FROM employees WHERE department_id IN ( SELECT department_id FROM employees WHERE first_name LIKE '%T%' )
What is the role of the aircraft that originates from the European Union?
SELECT role FROM table_name_41 WHERE origin = "european union"
What is average salary of the players in the team named 'Boston Red Stockings' ?
SELECT avg(T1.salary) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'
On which island is Esperadinha airport located?
SELECT island FROM table_name_53 WHERE airportname = "esperadinha airport"
Which building has most faculty members?
SELECT building FROM Faculty GROUP BY building ORDER BY count(*) DESC LIMIT 1
Find the ids and names of stations from which at least 200 trips started.
SELECT start_station_id , start_station_name FROM trip GROUP BY start_station_id HAVING COUNT(*) >= 200
What is the first name of the student whose permanent address is different from his or her current one?
SELECT first_name FROM Students WHERE current_address_id != permanent_address_id
What are all the different first names of the drivers who are in position as standing and won?
SELECT DISTINCT T1.forename FROM drivers AS T1 JOIN driverstandings AS T2 ON T1.driverid = T2.driverid WHERE T2.position = 1 AND T2.wins = 1
What are the shipping methods for the orders on 12/31/1994?
SELECT DISTINCT T2.l_shipmode FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_orderdate = '1994-12-31'
Which role has the most common contact among businesses?
SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID GROUP BY T1.Name ORDER BY COUNT(T1.Name) DESC LIMIT 1
What is the total amount of money spent by Lucas Mancini?
SELECT sum(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = "Lucas" AND T1.last_name = "Mancini";
How many leagues are there in England?
SELECT count(*) FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id WHERE T1.name = "England"
What opponent has april 10 as the date?
SELECT opponent FROM table_name_14 WHERE date = "april 10"
What is hugh white's weight?
SELECT MAX(weight) FROM table_14342210_13 WHERE player = "Hugh White"
Count the number of courses in the Physics department.
SELECT count(DISTINCT course_id) FROM course WHERE dept_name = 'Physics'
Which Description has a Year of Issue of 1983, and a Weight of 3.50grams?
SELECT description FROM table_name_67 WHERE year_of_issue = 1983 AND weight = "3.50grams"
Who wrote the song that runs for 2:22?
SELECT author_s_ FROM table_name_35 WHERE time = "2:22"
When was the status test match with an opposing team of south africa?
SELECT date FROM table_name_77 WHERE status = "test match" AND opposing_teams = "south africa"
Return the name of the high school student with the most friends.
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
What time does the company's night shift begin? Indicate the answer in regular form.
SELECT StartTime FROM Shift WHERE Name = 'Night'
Please show the employee last names that serves no more than 20 customers.
SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20
Who was the customer of shipment no.1275? Give the customer's name.
SELECT T1.cust_name FROM customer AS T1 INNER JOIN shipment AS T2 ON T1.cust_id = T2.cust_id WHERE T2.ship_id = '1275'
What is the name of the airport with an ICAO of ULLI?
SELECT airport FROM table_name_40 WHERE icao = "ulli"
Count the number of high schoolers.
SELECT count(*) FROM Highschooler
how many countries are in Asia?
SELECT count(*) FROM country WHERE continent = "Asia"
What are their planned delivery dates?
SELECT T1.Planned_Delivery_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID JOIN Products AS T3 ON T2.Product_ID = T3.Product_ID WHERE T3.Product_price > 1000
How about the most recent one?
SELECT log_entry_date FROM problem_log ORDER BY log_entry_date DESC LIMIT 1
What is the highest listed year for the partner of Marcel Granollers and a hard surface?
SELECT MAX(year) FROM table_name_28 WHERE partner = "marcel granollers" AND surface = "hard"
How many businesses have more than 1 attribute?
SELECT COUNT(business_id) FROM Business_Attributes WHERE attribute_value > 1
Provide the number of predicted classes.
SELECT COUNT(PRED_CLASS_ID) FROM PRED_CLASSES
Show all the wind speeds in miles per hour.
select wind_speed_mph from weekly_weather
What is the 2012 value with a 1.3 in 2010 and a 3.6 in 2008?
SELECT 2012 FROM table_name_67 WHERE 2010 = "1.3" AND 2008 = "3.6"
Who was the 2007 actor from Moscow for the voyage of Varenka Bakunin?
SELECT actor_in_moscow, _2007 FROM table_name_91 WHERE voyage = "varenka bakunin"
What is the highest total medals winter athlete Clara Hughes has?
SELECT MAX(total) FROM table_name_41 WHERE type = "winter" AND athlete = "clara hughes"
What was the largest crowd at a game where Collingwood was the away team?
SELECT MAX(crowd) FROM table_name_13 WHERE away_team = "collingwood"
What was the position (P) for Clapham?
SELECT p FROM table_12608427_8 WHERE name = "Clapham"
What is the Location for Belshina?
SELECT location FROM table_name_99 WHERE team = "belshina"
What was the max demand charge for the user with a tariff of 8.85?
SELECT max_demand_charge___rs__kva_ FROM table_25479607_3 WHERE tariff___rs__kwh_ = "8.85"
what can you tell me about Rob Dinning?
SELECT * from stores where store_name = "Rob Dinning"
List the name and country of origin for all singers who have produced songs with rating above 9.
SELECT DISTINCT T1.artist_name , T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.rating > 9
Thank you! Can you show me the total number of occurrences for Purchased AAC as the media type?
SELECT T1.Name,count ( * ) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT ( * ) ASC LIMIT 1
What are the names and salaries of instructors who advises students in the History department?
SELECT T2.name , T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_id = T2.id JOIN student AS T3 ON T1.s_id = T3.id WHERE T3.dept_name = 'History'
What are the different cities where students live?
SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id
Which region has the most number of sales team?
SELECT Region FROM `Sales Team` GROUP BY Region ORDER BY COUNT(DISTINCT `Sales Team`) DESC LIMIT 1
Who were the winning riders of the championship in Euer Valley, CA and whose horse was Magic Sirocco?
SELECT rider_names FROM table_27833186_1 WHERE location = "Euer Valley, CA" AND horse_name = "Magic Sirocco"
What is the location shared by most counties?
SELECT LOCATION FROM county_public_safety GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1
Who are the students that are between 20 and 25 years of age? | Do you mean the last name or the first name of the students between 20 and 25 years of age? | What are the first names of the students who are between 20 and 25 years of age?
SELECT fname FROM student WHERE age BETWEEN 20 AND 25
What is the ratio of good to bad business star for a businesses that are opened all the time?
SELECT CAST(SUM(CASE WHEN T1.stars BETWEEN 3.5 AND 5 THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.stars BETWEEN 1 AND 2.5 THEN 1 ELSE 0 END) AS ratio FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id
What is the organisation type for each organisation?
SELECT organisation_type from Organisations
What were the notes when his position was 10th?
SELECT notes FROM table_name_2 WHERE position = "10th"
Describe ID and active status of the business under category of "Diagnostic Imaging".
SELECT T2.business_id, T3.active 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 WHERE T1.category_name = 'Diagnostic Imaging'
What are the titles of the cartoons sorted alphabetically?
SELECT Title FROM Cartoon ORDER BY title