question
stringlengths
43
589
query
stringlengths
19
598
Find the average age of the dogs who went through treatments.? Schema: - Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight) - Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id)
SELECT AVG(age) AS avg_age FROM Dogs WHERE dog_id IN (SELECT dog_id FROM Treatments);
List top 3 highest Rating TV series. List the TV series's Episode and Rating.? Schema: - TV_series(Air_Date, Episode, Rating, Share, Weekly_Rank)
SELECT Episode, Rating FROM TV_series ORDER BY Rating DESC NULLS LAST LIMIT 3;
Return the publisher that has published the most books.? Schema: - book_club(Author_or_Editor, Book_Title, COUNT, Category, Publ, Publisher, T1)
SELECT Publisher FROM book_club WHERE Publisher IS NOT NULL GROUP BY Publisher ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Show all origins and the number of flights from each origin.? Schema: - flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more))
SELECT origin, COUNT(*) AS num_flights FROM flight GROUP BY origin;
What are the names of members who are not in charge of any events? Schema: - member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) - party_events(Event_Name)
SELECT Member_Name FROM member_ WHERE Member_Name NOT IN (SELECT T1.Member_Name FROM member_ AS T1 JOIN party_events AS T2 ON T1.Member_ID = T2.Member_in_charge_ID);
Return the codes of countries that do not speak English and do not have Republics for governments.? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) - countrylanguage(COUNT, CountryCode, Engl, Language)
SELECT Code FROM country WHERE GovernmentForm != 'Republic' AND Code NOT IN (SELECT CountryCode FROM countrylanguage WHERE "Language" = 'English');
What are the memories and carriers of phones? Schema: - phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode)
SELECT Memory_in_G, Carrier FROM phone;
For each zip code, how many times has the maximum wind speed reached 25 mph? Schema: - weather(AVG, COUNT, M, Ra, cloud_cover, date, diff, events, mean_humidity, mean_sea_level_pressure_inches, mean_temperature_f, mean_visibility_miles, ... (1 more))
SELECT zip_code, COUNT(*) AS num_times FROM weather WHERE max_wind_Speed_mph >= 25 GROUP BY zip_code;
What are the purchase details of transactions with amount bigger than 10000? Schema: - Purchases(...) - Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code)
SELECT T1.purchase_details FROM Purchases AS T1 JOIN Transactions AS T2 ON T1.purchase_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction > 10000;
what state has the smallest population? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT state_name FROM state WHERE population = (SELECT MIN(population) FROM state);
Return all the distinct secretary votes made in the fall election cycle.? Schema: - Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote)
SELECT DISTINCT Secretary_Vote FROM Voting_record WHERE Election_Cycle = 'Fall';
Return the sum and average of all settlement amounts.? Schema: - Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount)
SELECT SUM(Settlement_Amount) AS total_settlement_amount, AVG(Settlement_Amount) AS avg_settlement_amount FROM Settlements;
What is the name and distance for the aircraft that has an id of 12? Schema: - aircraft(Description, aid, d, distance, name)
SELECT name, distance FROM aircraft WHERE aid = 12;
Select the average price of each manufacturer's products, showing only the manufacturer's code.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT AVG(Price) AS avg_price, Manufacturer FROM Products GROUP BY Manufacturer;
Find the contact channel code that was used by the customer named "Tillman Ernser".? Schema: - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) - Customer_Contact_Channels(DATEDIFF, DAY, active_from_date, active_to_date, channel_code, contact_number, diff)
SELECT DISTINCT channel_code FROM Customers AS T1 JOIN Customer_Contact_Channels AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = 'Tillman Ernser';
find all cities which has a " Taj Mahal " restaurant? Schema: - category(...) - business(business_id, city, full_address, name, rating, review_count, state)
SELECT T1.city FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T1.name = 'Taj Mahal' AND T2.category_name = 'restaurant';
What is the year in which most ships were built? Schema: - Ship(Built_Year, COUNT, Class, Flag, Name, Type)
SELECT Built_Year FROM Ship WHERE Built_Year IS NOT NULL GROUP BY Built_Year ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the maximum and minimum sales of the companies whose industries are not "Banking".? Schema: - Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name)
SELECT MAX(Sales_billion) AS max_sales, MIN(Sales_billion) AS min_sales FROM Companies WHERE Industry != 'Banking';
List the studios of each film and the number of films produced by that studio.? Schema: - film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
SELECT Studio, COUNT(*) AS num_films FROM film GROUP BY Studio;
Return the name, location, and seating of the track that was opened in the most recent year.? Schema: - track(Location, Name, Seat, Seating, T1, Year_Opened)
SELECT Name, Location, Seating FROM track ORDER BY Year_Opened DESC NULLS LAST LIMIT 1;
Show all dates of transactions whose type code is "SALE".? Schema: - Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code)
SELECT date_of_transaction FROM Transactions WHERE transaction_type_code = 'SALE';
What is the name of the language that the film 'AIRPORT POLLOCK' is in? Schema: - film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) - language_(...)
SELECT T2.name FROM film AS T1 JOIN language_ AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'AIRPORT POLLOCK';
datasets used for evaluating semantic parsing? Schema: - paperDataset(...) - dataset(...) - paperKeyphrase(...) - keyphrase(...)
SELECT DISTINCT T2.datasetId FROM paperDataset AS T3 JOIN dataset AS T2 ON T3.datasetId = T2.datasetId JOIN paperKeyphrase AS T1 ON T1.paperId = T3.paperId JOIN keyphrase AS T4 ON T1.keyphraseId = T4.keyphraseId WHERE T4.keyphraseName = 'semantic parsing';
Show the season, the player, and the name of the team that players belong to.? Schema: - match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team) - team(Name)
SELECT T1.Season, T1.Player, T2.Name FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id;
What is the most popular full name of the actors? Schema: - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
SELECT first_name, last_name FROM actor WHERE first_name IS NOT NULL AND last_name IS NOT NULL GROUP BY first_name, last_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Which catalog publisher has published the most catalogs? Schema: - Catalogs(COUNT, catalog_publisher, date_of_latest_revision)
SELECT catalog_publisher FROM Catalogs WHERE catalog_publisher IS NOT NULL GROUP BY catalog_publisher ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
how long is the shortest river in the usa? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT LENGTH FROM river WHERE LENGTH = (SELECT MIN(LENGTH) FROM river);
Find the department name that is in Building "Mergenthaler".? Schema: - Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2)
SELECT DName FROM Department WHERE Building = 'Mergenthaler';
Show the names of editors that are on the committee of journals with sales bigger than 3000.? Schema: - journal_committee(...) - editor(Age, COUNT, Name) - journal(Theme, homepage, name)
SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Sales > 3000;
character recognition papers earlier than 2010? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.keyphraseName = 'character recognition' AND T3."year" < 2010;
give me the number of rivers in idaho? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT COUNT(river_name) AS num_rivers FROM river WHERE traverse = 'idaho';
List the names of phones that are not on any market.? Schema: - phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) - phone_market(...)
SELECT Name FROM phone WHERE CAST(Phone_ID AS TEXT) NOT IN (SELECT Phone_ID FROM phone_market);
How many games in 1885 postseason resulted in ties (that is, the value of "ties" is '1')? Schema: - postseason(ties)
SELECT COUNT(*) AS num_games FROM postseason WHERE "year" = 1885 AND ties = 1;
what ACL papers have less than 5 citations ? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - cite(...) - venue(venueId, venueName)
SELECT DISTINCT T3.citingPaperId FROM paper AS T1 JOIN cite AS T3 ON T1.paperId = T3.citedPaperId JOIN venue AS T2 ON T2.venueId = T1.venueId WHERE T2.venueName = 'ACL' GROUP BY T3.citingPaperId HAVING COUNT(DISTINCT T3.citedPaperId) < 5;
Find the attribute data type for the attribute named "Green".? Schema: - Attribute_Definitions(attribute_data_type, attribute_name)
SELECT attribute_data_type FROM Attribute_Definitions WHERE attribute_name = 'Green';
What is the campus fee for San Francisco State University in 1996? Schema: - Campuses(Campus, County, Franc, Location) - csu_fees(CampusFee)
SELECT CampusFee FROM Campuses AS T1 JOIN csu_fees AS T2 ON T1.Id = T2.Campus WHERE T1.Campus = 'San Francisco State University' AND T2."Year" = 1996;
What are the number of international and domestic passengers of the airport named London "Heathrow"? Schema: - airport(Airport_Name, City, Country, Domestic_Passengers, International_Passengers, Transit_Passengers, id, name)
SELECT International_Passengers, Domestic_Passengers FROM airport WHERE Airport_Name = 'London Heathrow';
What are the names of the campus that have more faculties in 2002 than the maximum number in Orange county? Schema: - Campuses(Campus, County, Franc, Location) - faculty(Faculty)
SELECT T1.Campus FROM Campuses AS T1 JOIN faculty AS T2 ON T1.Id = T2.Campus WHERE T2."Year" = 2002 AND Faculty > (SELECT MAX(Faculty) FROM Campuses AS T1 JOIN faculty AS T2 ON T1.Id = T2.Campus WHERE T2."Year" = 2002 AND T1.County = 'Orange');
Find the brand and name for each camera lens, and sort in descending order of maximum aperture.? Schema: - camera_lens(brand, name)
SELECT brand, name FROM camera_lens ORDER BY max_aperture DESC NULLS LAST;
Find the subject ID, subject name, and the corresponding number of available courses for each subject.? Schema: - Courses(course_description, course_name) - Subjects(subject_name)
SELECT T1.subject_id, T2.subject_name, COUNT(*) AS num_courses FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id, T2.subject_name;
Show all the locations where no cinema has capacity over 800.? Schema: - cinema(COUNT, Capacity, Location, Name, Openning_year, T1, c)
SELECT DISTINCT T1.Location FROM cinema AS T1 LEFT JOIN cinema AS T2 ON T1.Location = T2.Location AND T2.Capacity > 800 WHERE T2.Location IS NULL;
What is the age and hometown of every teacher? Schema: - teacher(Age, COUNT, D, Hometown, Name)
SELECT Age, Hometown FROM teacher;
display all the details from Employees table for those employees who was hired before 2002-06-21.? Schema: - employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more))
SELECT * FROM employees WHERE HIRE_DATE < '2002-06-21';
Show the name and location for all tracks.? Schema: - track(Location, Name, Seat, Seating, T1, Year_Opened)
SELECT Name, Location FROM track;
Find the first name, last name and id for the top three players won the most player awards.? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) - player_award(...)
SELECT T1.name_first, T1.name_last, T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id GROUP BY T1.name_first, T1.name_last, T1.player_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 3;
Show each gender code and the corresponding count of guests sorted by the count in descending order.? Schema: - Guests(date_of_birth, gender_code, guest_first_name, guest_last_name)
SELECT gender_code, COUNT(*) AS num_guests FROM Guests WHERE gender_code IS NOT NULL GROUP BY gender_code ORDER BY num_guests DESC NULLS LAST;
Show the unique first names, last names, and phone numbers for all customers with any account.? Schema: - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
SELECT DISTINCT T1.customer_first_name, T1.customer_last_name, T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id;
name the states which have no surrounding states? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) - border_info(T1, border, state_name)
SELECT state_name FROM state WHERE state_name NOT IN (SELECT state_name FROM border_info);
Return the low and high estimates for all film markets.? Schema: - film_market_estimation(High_Estimate, Low_Estimate, Type)
SELECT Low_Estimate, High_Estimate FROM film_market_estimation;
What are some recent papers written in deep learning ? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.paperId, T3."year" FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.keyphraseName = 'deep learning' ORDER BY T3."year" DESC NULLS LAST;
What are the names of all the stores located in Khanewal District? Schema: - store(Type) - store_district(...) - district(City_Area, City_Population, District_name, d)
SELECT T1.Store_Name 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 T3.District_name = 'Khanewal District';
what is the capital of the state with the longest river? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT capital FROM state WHERE state_name IN (SELECT traverse FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river));
Which allergy is the most common? Schema: - Has_Allergy(Allergy, COUNT, StuID)
SELECT Allergy FROM Has_Allergy WHERE Allergy IS NOT NULL GROUP BY Allergy ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the phone numbers of customers using the policy with the code "Life Insurance"? Schema: - Available_Policies(COUNT, Customer_Phone, Life, policy_type_code)
SELECT Customer_Phone FROM Available_Policies WHERE policy_type_code = 'Life Insurance';
Return the hosts of competitions for which the theme is not Aliens? Schema: - farm_competition(Hosts, Theme, Year)
SELECT Hosts FROM farm_competition WHERE Theme != 'Aliens';
Find the policy type used by more than 4 customers.? Schema: - Available_Policies(COUNT, Customer_Phone, Life, policy_type_code)
SELECT policy_type_code FROM Available_Policies WHERE policy_type_code IS NOT NULL GROUP BY policy_type_code HAVING COUNT(*) > 4;
What are the names of stations that are located in Palo Alto city but have never been the ending point of trips more than 100 times? Schema: - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) - trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code)
SELECT name FROM station WHERE city = 'Palo Alto' AND name NOT IN (SELECT end_station_name FROM trip WHERE end_station_name IS NOT NULL GROUP BY end_station_name HAVING COUNT(*) > 100);
Which allergy type is the least common? Schema: - Allergy_Type(Allergy, AllergyType, COUNT)
SELECT AllergyType FROM Allergy_Type WHERE AllergyType IS NOT NULL GROUP BY AllergyType ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
What are the names of all movies directed by Steven Spielberg? Schema: - Movie(T1, director, title, year)
SELECT title FROM Movie WHERE director = 'Steven Spielberg';
List all manufacturer names and ids ordered by their opening year.? Schema: - manufacturer(Manufacturer_ID, Name, Open_Year)
SELECT Name, Manufacturer_ID FROM manufacturer ORDER BY Open_Year ASC NULLS LAST;
Find the number of patients' prescriptions physician John Dorian made.? Schema: - Patient(...) - Prescribes(...) - Physician(I, Name)
SELECT COUNT(T1.SSN) AS num_patients FROM Patient AS T1 JOIN Prescribes AS T2 ON T1.SSN = T2.Patient JOIN Physician AS T3 ON T2.Physician = T3.EmployeeID WHERE T3.Name = 'John Dorian';
Which staff members who reported problems from the product "rem" but not "aut"? Give me their first and last names.? Schema: - Problems(date_problem_reported, problem_id) - Product(product_id, product_name) - Staff(COUNT, Name, Other_Details, date_joined_staff, date_left_staff, date_of_birth, email_address, first_name, gender, last_name, middle_name, nickname)
SELECT T3.staff_first_name, T3.staff_last_name FROM Problems AS T1 JOIN Product AS T2 ON T1.product_id = T2.product_id JOIN Staff AS T3 ON T1.reported_by_staff_id = T3.staff_id WHERE T2.product_name = 'rem' AND NOT EXISTS (SELECT 1 FROM Problems AS T4 JOIN Product AS T5 ON T4.product_id = T5.product_id JOIN Staff AS T6 ON T4.reported_by_staff_id = T6.staff_id WHERE T5.product_name = 'aut' AND T3.staff_id = T6.staff_id);
What are the titles of all the albums? Schema: - albums(I, title)
SELECT title FROM albums;
Which company started the earliest the maintenance contract? Show the company name.? Schema: - Third_Party_Companies(...) - Maintenance_Contracts(...)
SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id ORDER BY T2.contract_start_date ASC NULLS LAST LIMIT 1;
What are the names of the customers who bought product "food" at least once? Schema: - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) - Orders(customer_id, date_order_placed, order_id) - Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT T1.customer_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_Items AS T3 ON T2.order_id = T3.order_id JOIN Products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_name = 'food' GROUP BY T1.customer_id, T1.customer_name HAVING COUNT(*) >= 1;
What is the name of party with most number of members? Schema: - member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT T2.Party_name FROM member_ AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID, T2.Party_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
How many proteins are associated with an institution in a building with at least 20 floors? Schema: - Institution(COUNT, Enrollment, Founded, Type) - protein(...) - building(Floors, Height_feet, Name, build)
SELECT COUNT(*) AS num_proteins FROM Institution AS T1 JOIN protein AS T2 ON T1.Institution_id = T2.Institution_id JOIN building AS T3 ON T3.building_id = T1.building_id WHERE T3.Floors >= 20;
What are the names of the tracks that are Rock or Jazz songs? Schema: - genres(name) - tracks(composer, milliseconds, name, unit_price)
SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = 'Rock' OR T1.name = 'Jazz';