question
stringlengths
43
589
query
stringlengths
19
598
where does Peter Mertens publish ? Schema: - venue(venueId, venueName) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - writes(...) - author(...)
SELECT DISTINCT T3.journalId, T4.venueId FROM venue AS T4 JOIN paper AS T3 ON T4.venueId = T3.venueId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'Peter Mertens';
What are the names of managers in ascending order of level? Schema: - manager(Age, Country, Level, Name, Working_year_starts, m1)
SELECT Name FROM manager ORDER BY Level ASC NULLS LAST;
what river runs through illinois? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT river_name FROM river WHERE traverse = 'illinois';
What are the names of all tryout participants who are from the largest college? Schema: - Tryout(COUNT, EX, T1, cName, decision, pPos) - Player(HS, pName, weight, yCard) - College(M, cName, enr, state)
SELECT T2.pName FROM Tryout AS T1 JOIN Player AS T2 ON T1.pID = T2.pID WHERE T1.cName = (SELECT cName FROM College ORDER BY enr DESC NULLS LAST LIMIT 1);
Find the titles of all the papers written by "Jeremy Gibbons"? Schema: - Authors(fname, lname) - Authorship(...) - Papers(title)
SELECT T3.title FROM Authors AS T1 JOIN Authorship AS T2 ON T1.authID = T2.authID JOIN Papers AS T3 ON T2.paperID = T3.paperID WHERE T1.fname = 'Jeremy' AND T1.lname = 'Gibbons';
subhasis chaudhuri? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'subhasis chaudhuri';
What is the name and category code of the product with the highest price? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT product_name, product_category_code FROM Products ORDER BY product_price DESC NULLS LAST LIMIT 1;
Return the lot details and investor ids.? Schema: - Lots(investor_id, lot_details)
SELECT lot_details, investor_id FROM Lots;
return me the number of papers after 2000 in " University of Michigan " .? Schema: - organization(continent, homepage, name) - author(...) - writes(...) - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
SELECT COUNT(DISTINCT T4.title) AS num_papers FROM organization AS T2 JOIN author AS T1 ON T2.oid = T1.oid JOIN writes AS T3 ON T3.aid = T1.aid JOIN publication AS T4 ON T3.pid = T4.pid WHERE T2.name = 'University of Michigan' AND T4."year" > 2000;
Show all transaction ids with transaction code 'PUR'.? Schema: - Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code)
SELECT transaction_id FROM Transactions WHERE transaction_type_code = 'PUR';
List all church names in descending order of opening date.? Schema: - church(Name, Open_Date, Organized_by)
SELECT Name FROM church ORDER BY Open_Date DESC NULLS LAST;
What are the different district names in order of descending city area? Schema: - district(City_Area, City_Population, District_name, d)
SELECT District_name FROM district WHERE District_name IS NOT NULL AND City_Area IS NOT NULL GROUP BY District_name, City_Area ORDER BY City_Area DESC NULLS LAST;
Find the number of users in each role.? Schema: - Users(COUNT, password, role_code, user_log, user_name)
SELECT COUNT(*) AS num_users, role_code FROM Users GROUP BY role_code;
Find the names of all English songs.? Schema: - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT song_name FROM song WHERE languages = 'english';
Which tourist attractions are related to royal family? Tell me their details and how we can get there.? Schema: - Royal_Family(...) - Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more))
SELECT T1.Royal_Family_Details, T2.How_to_Get_There FROM Royal_Family AS T1 JOIN Tourist_Attractions AS T2 ON T1.Royal_Family_ID = T2.Tourist_Attraction_ID;
how many states does kentucky border? Schema: - border_info(T1, border, state_name)
SELECT COUNT(border) AS num_borders FROM border_info WHERE state_name = 'kentucky';
What is ids of the songs whose resolution is higher than the average resolution of songs in modern genre? Schema: - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT f_id FROM song WHERE resolution > (SELECT AVG(resolution) FROM song WHERE genre_is = 'modern');
What are the first names of all players, and their total ranking points? Schema: - players(COUNT, birth_date, country_code, first_name, hand, last_name) - rankings(ranking_date, tours)
SELECT T1.first_name, SUM(T2.ranking_points) AS total_ranking_points FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id, T1.first_name;
Find all the vocal types.? Schema: - Vocals(COUNT, Type)
SELECT DISTINCT Type FROM Vocals;
How many actors are there? Schema: - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
SELECT COUNT(*) AS num_actors FROM actor;
how many cities are there in the united states? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT COUNT(city_name) AS num_cities FROM city WHERE country_name = 'united states';
Find the personal name, family name, and author ID of the course author that teaches the most courses.? Schema: - Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name) - Courses(course_description, course_name)
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, T1.personal_name, T1.family_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
List all countries of markets in descending order of number of cities.? Schema: - market(Country, Number_cities)
SELECT Country FROM market ORDER BY Number_cities DESC NULLS LAST;
What is the maximum training hours for the students whose training hours is greater than 1000 in different positions? Schema: - Player(HS, pName, weight, yCard) - Tryout(COUNT, EX, T1, cName, decision, pPos)
SELECT MAX(T1.HS) AS max_training_hours, pPos FROM Player AS T1 JOIN Tryout AS T2 ON T1.pID = T2.pID WHERE T1.HS > 1000 GROUP BY T2.pPos;
Find the names of courses taught by the tutor who has personal name "Julio".? Schema: - Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name) - Courses(course_description, course_name)
SELECT T2.course_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T1.personal_name = 'Julio';
what is the least populous state? 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);
What is the id of the appointment that started most recently? Schema: - Appointment(AppointmentID, Start)
SELECT AppointmentID FROM Appointment ORDER BY "Start" DESC NULLS LAST LIMIT 1;
What is the count of states with college students playing in the mid position but not as goalies? Schema: - College(M, cName, enr, state) - Tryout(COUNT, EX, T1, cName, decision, pPos)
SELECT COUNT(*) AS num_states FROM (SELECT DISTINCT T1.state FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'mid' AND T1.state NOT IN (SELECT T1.state FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'goalie'));
What are the title and maximum price of each film? Schema: - schedule(...) - film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
SELECT T2.Title, MAX(T1.Price) AS max_price FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID GROUP BY T1.Film_ID, T2.Title;
What are the full names and ages for all female students whose sex is F? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT Fname, LName, Age FROM Student WHERE Sex = 'F';
what cities in texas? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT city_name FROM city WHERE state_name = 'texas';
What are the full names and hire dates for employees in the same department as someone with the first name Clara, not including Clara? 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 FIRST_NAME, LAST_NAME, HIRE_DATE FROM employees WHERE DEPARTMENT_ID = (SELECT DEPARTMENT_ID FROM employees WHERE FIRST_NAME = 'Clara') AND FIRST_NAME != 'Clara';
Which nations have both hosts of age above 45 and hosts of age below 35? Schema: - host(Age, COUNT, Name, Nationality)
SELECT DISTINCT Nationality FROM host WHERE Nationality IN (SELECT Nationality FROM host WHERE TRY_CAST(Age AS INT) < 35) AND Nationality IN (SELECT Nationality FROM host WHERE TRY_CAST(Age AS INT) > 45);
What are the names of conductors as well as the corresonding orchestras that they have conducted? Schema: - conductor(Age, Name, Nationality, Year_of_Work) - orchestra(COUNT, Major_Record_Format, Record_Company, Year_of_Founded)
SELECT T1.Name, T2.Orchestra FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID;
What is the id, forename, and number of races for all drivers that have participated in at least 2 races? Schema: - drivers(forename, nationality, surname) - results(...) - races(date, name)
SELECT T1.driverId, T1.forename, COUNT(*) AS num_races FROM drivers AS T1 JOIN results AS T2 ON T1.driverId = T2.driverId JOIN races AS T3 ON T2.raceId = T3.raceId GROUP BY T1.driverId, T1.forename HAVING COUNT(*) >= 2;
What are the names of countries that have both players with position forward and players with position defender? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) - match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team)
SELECT DISTINCT T1.Country_name FROM (SELECT T1.Country_name, T1.Country_id FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2."Position" = 'Forward') AS T1 JOIN (SELECT T1.Country_name, T1.Country_id FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2."Position" = 'Defender') AS T2 ON T1.Country_name = T2.Country_name AND T1.Country_id = T2.Country_id;
What are the names of races that were held after 2017 and the circuits were in the country of Spain? Schema: - races(date, name) - circuits(circuitId, country, location, name)
SELECT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitId = T2.circuitId WHERE T2.country = 'Spain' AND T1."year" > 2017;
What are the names of artist who have the letter 'a' in their names? Schema: - Artist(Name)
SELECT Name FROM Artist WHERE Name LIKE '%a%';
What are the unit of measure and category code for the 'chervil' product? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) - Ref_Product_Categories(product_category_code, product_category_description, unit_of_measure)
SELECT T2.unit_of_measure, T2.product_category_code FROM Products AS T1 JOIN Ref_Product_Categories AS T2 ON T1.product_category_code = T2.product_category_code WHERE T1.product_name = 'chervil';
What is the average access count of documents that have the least common structure? Schema: - Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more))
SELECT AVG(access_count) AS avg_access_count FROM Documents WHERE document_structure_code IS NOT NULL GROUP BY document_structure_code ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
Return the first names of the 5 staff members who have handled the most complaints.? Schema: - Staff(COUNT, Name, Other_Details, date_joined_staff, date_left_staff, date_of_birth, email_address, first_name, gender, last_name, middle_name, nickname) - Complaints(complaint_status_code, complaint_type_code)
SELECT T1.first_name FROM Staff AS T1 JOIN Complaints AS T2 ON T1.staff_id = T2.staff_id GROUP BY T2.staff_id, T1.first_name ORDER BY COUNT(*) ASC NULLS LAST LIMIT 5;
What is the number of movies in which " Shahab Hosseini " acted ? Schema: - cast_(...) - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
SELECT COUNT(DISTINCT T2.title) AS num_movies FROM cast_ AS T3 JOIN actor AS T1 ON T3.aid = T1.aid JOIN movie AS T2 ON T2.mid = T3.msid WHERE T1.name = 'Shahab Hosseini';
what is the largest state that borders the state with the highest population? 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 area = (SELECT MAX(area) FROM state WHERE state_name IN (SELECT state_name FROM border_info WHERE border IN (SELECT state_name FROM state WHERE population = (SELECT MAX(population) FROM state)))) AND state_name IN (SELECT state_name FROM border_info WHERE border IN (SELECT state_name FROM state WHERE population = (SELECT MAX(population) FROM state)));
How many different types of beds are there? Schema: - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT COUNT(DISTINCT bedType) AS num_beds FROM Rooms;
show the train name and station name for each train.? Schema: - train_station(...) - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) - train(Name, Service, Time, destination, name, origin, time, train_number)
SELECT T2.Name, T3.Name FROM train_station AS T1 JOIN station AS T2 ON T1.Station_ID = T2.Station_ID JOIN train AS T3 ON T3.Train_ID = T1.Train_ID;
What are the names of tournaments that have more than 10 matches? Schema: - matches_(COUNT, T1, loser_age, loser_name, minutes, tourney_name, winner_age, winner_hand, winner_name, winner_rank, winner_rank_points, year)
SELECT tourney_name FROM matches_ WHERE tourney_name IS NOT NULL GROUP BY tourney_name HAVING COUNT(*) > 10;
List pairs of the owner's first name and the dogs's name.? Schema: - Owners(email_address, first_name, last_name, state) - Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
SELECT T1.first_name, T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id;
What are the id and names of the countries which have more than 3 car makers or produce the 'fiat' model? Schema: - countries(...) - car_makers(...) - model_list(Maker, Model)
SELECT DISTINCT CountryId, CountryName FROM (SELECT T1.CountryId, T1.CountryName FROM countries AS T1 JOIN car_makers AS T2 ON T1.CountryId = T2.CountryId GROUP BY T1.CountryId, T1.CountryName HAVING COUNT(*) > 3 UNION ALL SELECT T1.CountryId, T1.CountryName FROM countries AS T1 JOIN car_makers AS T2 ON T1.CountryId = T2.CountryId JOIN model_list AS T3 ON T2.Id = T3.Maker WHERE T3.Model = 'fiat');
Cound the number of artists who have not released an album.? Schema: - Artist(Name) - Album(Title)
SELECT COUNT(*) AS num_artists FROM Artist WHERE ArtistId NOT IN(SELECT ArtistId FROM Album);
How many reviewers are there? Schema: - Reviewer(Lew, name, rID)
SELECT COUNT(*) AS num_reviewers FROM Reviewer;
Give the names of wines with prices above any wine produced in 2006.? Schema: - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
SELECT Name FROM wine WHERE Price > (SELECT MAX(Price) FROM wine WHERE "Year" = 2006);
Find the names of all artists that have "a" in their names.? Schema: - Artist(Name)
SELECT Name FROM Artist WHERE Name LIKE '%a%';
give me a good restaurant in the bay area ? Schema: - location(...) - restaurant(...) - geographic(...)
SELECT T2.house_number, T1.name FROM location AS T2 JOIN restaurant AS T1 ON T1.id = T2.restaurant_id WHERE T1.city_name IN (SELECT city_name FROM geographic WHERE region = 'bay area') AND T1.rating > 2.5;
Return the phone numbers of employees with salaries between 8000 and 12000.? 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 PHONE_NUMBER FROM employees WHERE SALARY BETWEEN 8000 AND 12000;
Which year has the most degrees conferred? Schema: - degrees(Campus, Degrees, SUM, Year)
SELECT "Year" FROM degrees GROUP BY "Year" ORDER BY SUM(Degrees) DESC NULLS LAST LIMIT 1;
How many countries does each continent have? List the continent id, continent name and the number of countries.? Schema: - continents(...) - countries(...)
SELECT T1.ContId, T1.Continent, COUNT(*) AS num_countries FROM continents AS T1 JOIN countries AS T2 ON T1.ContId = T2.Continent GROUP BY T1.ContId, T1.Continent;
How many professors are teaching class with code ACCT-211? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
SELECT COUNT(DISTINCT PROF_NUM) AS num_professors FROM CLASS WHERE CRS_CODE = 'ACCT-211';
Find the total checking and saving balance of all accounts sorted by the total balance in ascending order.? Schema: - CHECKING(balance) - SAVINGS(SAV, balance)
SELECT T1.balance + T2.balance AS total_balance FROM CHECKING AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid ORDER BY total_balance ASC NULLS LAST;
how many major cities are there in texas? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT COUNT(city_name) AS num_cities FROM city WHERE population > 150000 AND state_name = 'texas';
Show each apartment type code, and the maximum and minimum number of rooms for each type.? Schema: - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT apt_type_code, MAX(TRY_CAST(room_count AS INT)) AS max_room_count, MIN(TRY_CAST(room_count AS INT)) AS min_room_count FROM Apartments GROUP BY apt_type_code;
Show all the Store_Name of drama workshop groups.? Schema: - Drama_Workshop_Groups(COUNT, Currency_Code, Marketing_Region_Code, Store_Name)
SELECT Store_Name FROM Drama_Workshop_Groups;
Find all restaurant with Valet Service in Dallas Texas? Schema: - category(...) - business(business_id, city, full_address, name, rating, review_count, state)
SELECT T1.name FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN category AS T3 ON T3.business_id = T1.business_id WHERE T1.city = 'Dallas' AND T1.state = 'Texas' AND T2.category_name = 'Valet Service' AND T3.category_name = 'restaurant';
Show the description of transaction type with code "PUR".? Schema: - Ref_Transaction_Types(transaction_type_code, transaction_type_description)
SELECT transaction_type_description FROM Ref_Transaction_Types WHERE transaction_type_code = 'PUR';
How many songs have used the instrument "drums"? Schema: - Instruments(COUNT, Instrument)
SELECT COUNT(*) AS num_songs FROM Instruments WHERE Instrument = 'drums';
Who has a friend that is from new york city? Schema: - Person(M, age, city, eng, gender, job, name) - PersonFriend(M, friend, name)
SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.city = 'new york city';
How many different colleges do attend the tryout test? Schema: - Tryout(COUNT, EX, T1, cName, decision, pPos)
SELECT COUNT(DISTINCT cName) AS num_colleges FROM Tryout;
What are the first name and last name of all the teachers? Schema: - teachers(Classroom, FirstName, LastName)
SELECT DISTINCT FirstName, LastName FROM teachers;
How many Starbucks are there in Dallas Texas ? Schema: - business(business_id, city, full_address, name, rating, review_count, state)
SELECT COUNT(DISTINCT business_id) AS num_starbucks FROM business WHERE name = 'Starbucks' AND city = 'Dallas' AND state = 'Texas';
pldi 2015 conference? Schema: - venue(venueId, venueName) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T1.paperId FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T1."year" = 2015 AND T2.venueName = 'pldi';
Return the id and type code of the template that is used for the greatest number of documents.? Schema: - Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more)) - Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number)
SELECT T1.Template_ID, T2.Template_Type_Code FROM Documents AS T1 JOIN Templates AS T2 ON T1.Template_ID = T2.Template_ID GROUP BY T1.Template_ID, T2.Template_Type_Code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Find the name of the stadium that has the maximum capacity.? Schema: - stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
SELECT Name FROM stadium ORDER BY Capacity DESC NULLS LAST LIMIT 1;
Show the distinct apartment numbers of the apartments that have bookings with status code "Confirmed".? Schema: - Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code) - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT DISTINCT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = 'Confirmed';
How many activities does Mark Giuliano participate in? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) - Faculty_Participates_in(FacID)
SELECT COUNT(*) AS num_activities FROM Faculty AS T1 JOIN Faculty_Participates_in AS T2 ON T1.FacID = T2.FacID WHERE T1.Fname = 'Mark' AND T1.Lname = 'Giuliano';
Show the party and the number of drivers in each party.? Schema: - driver(Age, Home_city, Name, Party)
SELECT Party, COUNT(*) AS num_drivers FROM driver GROUP BY Party;
How many drama workshop groups are there in each city? Return both the city and the count.? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) - Drama_Workshop_Groups(COUNT, Currency_Code, Marketing_Region_Code, Store_Name)
SELECT T1.City_Town, COUNT(*) AS num_drama_workshop_groups FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = CAST(T2.Address_ID AS TEXT) GROUP BY T1.City_Town;
Find the official names of cities with population bigger than 1500 or smaller than 500.? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT Official_Name FROM city WHERE Population > 1500 OR Population < 500;
Find the number of routes operated by American Airlines.? Schema: - airlines(Abbreviation, Airline, COUNT, Country, active, country, name) - routes(...)
SELECT COUNT(*) AS num_routes FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid WHERE T1.name = 'American Airlines';
When did Luke S Zettlemoyer publish ? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3."year" FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'Luke S Zettlemoyer' ORDER BY T3."year" ASC NULLS LAST;
On which day and in which zip code was the min dew point lower than any day in zip code 94107? 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 "date", zip_code FROM weather WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = 94107);
List the addresses of all Walmart in " Los Angeles "? Schema: - business(business_id, city, full_address, name, rating, review_count, state)
SELECT full_address FROM business WHERE city = 'Los Angeles' AND name = 'Walmart';
Show the account name, id and the number of transactions for each account.? Schema: - Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type) - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
SELECT T2.account_name, T1.account_id, COUNT(*) AS num_transactions FROM Financial_Transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T2.account_name, T1.account_id;
Show the account id with most number of transactions.? Schema: - Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type)
SELECT account_id FROM Financial_Transactions WHERE account_id IS NOT NULL GROUP BY account_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Show the student IDs and numbers of friends corresponding to each.? Schema: - Friend(student_id)
SELECT student_id, COUNT(*) AS num_friends FROM Friend GROUP BY student_id;
List the names of teachers in ascending order of age.? Schema: - teacher(Age, COUNT, D, Hometown, Name)
SELECT Name FROM teacher ORDER BY Age ASC NULLS LAST;
List the arrival date and the departure date for all the dogs.? Schema: - Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
SELECT date_arrived, date_departed FROM Dogs;
what is the capital of the smallest state? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT capital FROM state WHERE area = (SELECT MIN(area) FROM state);
For each hometown, how many teachers are there? Schema: - teacher(Age, COUNT, D, Hometown, Name)
SELECT Hometown, COUNT(*) AS num_teachers FROM teacher GROUP BY Hometown;
How many settlements were made on the claim with the most recent claim settlement date? List the number and the claim id.? Schema: - Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled) - Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount)
SELECT COUNT(*) AS num_settlements, T1.Claim_ID FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID GROUP BY T1.Claim_ID, T1.Date_Claim_Settled ORDER BY T1.Date_Claim_Settled DESC NULLS LAST LIMIT 1;
What are the orchestras that do not have any performances? Schema: - orchestra(COUNT, Major_Record_Format, Record_Company, Year_of_Founded) - performance(Attendance, COUNT, Date, Location, T1)
SELECT Orchestra FROM orchestra WHERE Orchestra_ID NOT IN (SELECT Orchestra_ID FROM performance);
What are the areas and counties for all appelations? Schema: - appellations(Area, County)
SELECT Area, County FROM appellations;
How many restaurant is the Sandwich type restaurant? Schema: - Restaurant(Address, Rating, ResID, ResName) - Type_Of_Restaurant(ResID, ResTypeID) - Restaurant_Type(ResTypeDescription, ResTypeID, ResTypeName)
SELECT COUNT(*) AS num_restaurants FROM Restaurant JOIN Type_Of_Restaurant ON Restaurant.ResID = Type_Of_Restaurant.ResID JOIN Restaurant_Type ON Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID GROUP BY Type_Of_Restaurant.ResTypeID, Restaurant_Type.ResTypeName HAVING Restaurant_Type.ResTypeName = 'Sandwich';
What is the salaray and name of the employee that is certified to fly the most planes? Schema: - employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) - certificate(eid)
SELECT T1.name, ANY_VALUE(T1.salary) AS salary FROM employee AS T1 JOIN certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid, T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
what is the average population of the us by state? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT AVG(population) AS avg_population FROM state;
How many citations does noah a smith has ? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - cite(...) - writes(...) - author(...)
SELECT DISTINCT COUNT(T4.citedPaperId) AS num_citations FROM paper AS T3 JOIN cite AS T4 ON T3.paperId = T4.citedPaperId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'noah a smith';
How many settlements are there in total? Schema: - Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount)
SELECT COUNT(*) AS num_settlements FROM Settlements;
Return the names and ids of each account, as well as the number of transactions.? Schema: - Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type) - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
SELECT T2.account_name, T1.account_id, COUNT(*) AS num_transactions FROM Financial_Transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T2.account_name, T1.account_id;
Show the name of the party that has at least two records.? Schema: - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT Party FROM party WHERE Party IS NOT NULL GROUP BY Party HAVING COUNT(*) >= 2;
What are the names and locations of the stadiums that had concerts that occurred in both 2014 and 2015? Schema: - concert(COUNT, Year) - stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
SELECT T2.Name, T2.Location FROM concert AS T1 JOIN stadium AS T2 ON T1.Stadium_ID = T2.Stadium_ID WHERE T1."Year" = 2014 AND EXISTS (SELECT 1 FROM concert AS T3 JOIN stadium AS T4 ON T3.Stadium_ID = T4.Stadium_ID WHERE T3."Year" = 2015 AND T4.Name = T2.Name AND T4.Location = T2.Location);
return me the papers in PVLDB containing keyword " Keyword search " .? Schema: - publication_keyword(...) - keyword(keyword) - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - journal(Theme, homepage, name)
SELECT T4.title FROM publication_keyword AS T2 JOIN keyword AS T1 ON T2.kid = T1.kid JOIN publication AS T4 ON T4.pid = T2.pid JOIN journal AS T3 ON T4.jid = T3.jid WHERE T3.name = 'PVLDB' AND T1.keyword = 'Keyword search';
What is the name of the dorm with both a TV Lounge and Study Room listed as amenities? Schema: - Dorm(dorm_name, gender, student_capacity) - Has_amenity(dormid) - Dorm_amenity(amenity_name)
SELECT T1.dorm_name FROM Dorm AS T1 JOIN Has_amenity AS T2 ON T1.dormid = T2.dormid JOIN Dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name IN ('TV Lounge', 'Study Room') GROUP BY T1.dorm_name HAVING COUNT(DISTINCT T3.amenity_name) = 2;