question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
Find the cities which were once a host city after 2010?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- hosting_city(Host_City, Year) | SELECT T1.City FROM city AS T1 JOIN hosting_city AS T2 ON T1.City_ID = T2.Host_City WHERE T2."Year" > 2010; |
What are the details and star ratings of the three hotels with the lowest price ranges?
Schema:
- Hotels(hotel_id, other_hotel_details, pets_allowed_yn, price_range, star_rating_code) | SELECT other_hotel_details, star_rating_code FROM Hotels ORDER BY price_range ASC NULLS LAST LIMIT 3; |
Which workshop groups have bookings with status code "stop"? Give me the names.?
Schema:
- Bookings(Actual_Delivery_Date, COUNT, Order_Date, Planned_Delivery_Date, Status_Code)
- Drama_Workshop_Groups(COUNT, Currency_Code, Marketing_Region_Code, Store_Name) | SELECT T2.Store_Name FROM Bookings AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Workshop_Group_ID = CAST(T2.Workshop_Group_ID AS TEXT) WHERE T1.Status_Code = 'stop'; |
What is the maximum stars and year for the most recent movie?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year) | SELECT MAX(T1.stars) AS max_stars, T2."year" FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2."year" = (SELECT MAX("year") FROM Movie) GROUP BY T2."year"; |
What are the themes of farm competitions sorted by year in ascending order?
Schema:
- farm_competition(Hosts, Theme, Year) | SELECT Theme FROM farm_competition ORDER BY "Year" ASC NULLS LAST; |
How many party events do we have?
Schema:
- party_events(Event_Name) | SELECT COUNT(*) AS num_events FROM party_events; |
Show all artist names and the year joined who are not from United States.?
Schema:
- FROM(Country, Name, Year_Join) | SELECT Name, Year_Join FROM artist WHERE Country != 'United States'; |
What are the valid from and valid to dates for the card with the number 4560596484842?
Schema:
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to) | SELECT date_valid_from, date_valid_to FROM Customers_Cards WHERE card_number = '4560596484842'; |
Return me the number of businesses that are restaurant .?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT COUNT(DISTINCT T1.name) AS num_businesses FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T2.category_name = 'restaurant'; |
Count the number of distinct governors.?
Schema:
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more)) | SELECT COUNT(DISTINCT Governor) AS num_governors FROM party; |
Which department has the lowest budget?
Schema:
- department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name) | SELECT dept_name FROM department ORDER BY budget ASC NULLS LAST LIMIT 1; |
Show the residences that have at least two players.?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT Residence FROM player WHERE Residence IS NOT NULL GROUP BY Residence HAVING COUNT(*) >= 2; |
Find the names of all reviewers who have contributed three or more ratings.?
Schema:
- Rating(Rat, mID, rID, stars)
- Reviewer(Lew, name, rID) | SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID, T2.name HAVING COUNT(*) >= 3; |
Find the total rating ratio for each channel owner.?
Schema:
- channel(Name, Owner, Rating_in_percent, Share_in_percent) | SELECT SUM(Rating_in_percent) AS total_rating_ratio, Owner FROM channel GROUP BY Owner; |
What are the campuses that opened in 1958?
Schema:
- Campuses(Campus, County, Franc, Location) | SELECT Campus FROM Campuses WHERE "Year" = 1958; |
What is the total number of students?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_students FROM Student; |
return all columns of the albums created in the year of 2012.?
Schema:
- Albums(COUNT, Label, Title) | SELECT * FROM Albums WHERE "Year" = 2012; |
Find the name and description of the role with code "MG".?
Schema:
- Roles(Role_Code, Role_Description, Role_Name, role_code, role_description) | SELECT Role_Name, Role_Description FROM Roles WHERE Role_Code = 'MG'; |
Find the category descriptions of the products whose descriptions include letter 't'.?
Schema:
- Ref_Product_Categories(product_category_code, product_category_description, unit_of_measure)
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT T1.product_category_description FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%'; |
Find the name of the teacher who teaches the largest number of students.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
- teachers(Classroom, FirstName, LastName) | SELECT T2.FirstName, T2.LastName FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom GROUP BY T2.FirstName, T2.LastName ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the names and average salaries for departments with average salary higher than 42000?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary) | SELECT dept_name, AVG(salary) AS avg_salary FROM instructor WHERE dept_name IS NOT NULL GROUP BY dept_name HAVING AVG(salary) > 42000; |
How many parks does Atlanta city have?
Schema:
- park(city, state) | SELECT COUNT(*) AS num_parks FROM park WHERE city = 'Atlanta'; |
Find the names of users whose emails contain ‘superstar’ or ‘edu’.?
Schema:
- user_profiles(email, followers, name, partitionid) | SELECT name FROM user_profiles WHERE email LIKE '%superstar%' OR email LIKE '%edu%'; |
Show the names and main services for train stations that have the top three total number of passengers.?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT Name, Main_Services FROM station ORDER BY Total_Passengers DESC NULLS LAST LIMIT 3; |
Please show the industries of companies in descending order of the number of companies.?
Schema:
- Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name) | SELECT Industry FROM Companies WHERE Industry IS NOT NULL GROUP BY Industry ORDER BY COUNT(*) DESC NULLS LAST; |
What are the distinct grant amount for the grants where the documents were sent before '1986-08-26 20:49:27' and grant were ended after '1989-03-16 18:27:16'?
Schema:
- Grants(grant_amount, organisation_id)
- 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 DISTINCT T1.grant_amount FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id WHERE T2.sent_date < '1986-08-26 20:49:27' AND T1.grant_end_date > '1989-03-16 18:27:16'; |
How many lessons did the customer with the first name Ray take?
Schema:
- Lessons(lesson_status_code)
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT COUNT(*) AS num_lessons FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Ray'; |
For each player, show the team and the location of school they belong to.?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type) | SELECT T1.Team, T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID; |
How many artists are from Bangladesh?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT COUNT(*) AS num_artists FROM artist WHERE country = 'Bangladesh'; |
Papers from 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'; |
how many people stay in california?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT population FROM state WHERE state_name = 'california'; |
Return the number of kids for the room reserved and checked in by DAMIEN TRACHSEL on Sep 21, 2010.?
Schema:
- Reservations(Adults, CheckIn, FirstName, Kids, LastName) | SELECT Kids FROM Reservations WHERE CheckIn = '2010-09-21' AND FirstName = 'DAMIEN' AND LastName = 'TRACHSEL'; |
Find the name of students who took any class in the years of 2009 and 2010.?
Schema:
- student(COUNT, H, dept_name, name, tot_cred)
- takes(COUNT, semester, year) | SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.ID = T2.ID WHERE "year" = 2009 OR "year" = 2010; |
How many different degrees are offered?
Schema:
- Degree_Programs(degree_summary_name, department_id) | SELECT COUNT(DISTINCT degree_summary_name) AS num_degrees FROM Degree_Programs; |
monte carlo simulation later than 2011?
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 = 'monte carlo simulation' AND T3."year" > 2011; |
What is employee Nancy Edwards's phone number?
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 FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'; |
For each staff id, what is the description of the role that is involved with the most number of projects?
Schema:
- Staff_Roles(role_code, role_description)
- Project_Staff(COUNT, date_from, date_to, role_code)
- Project_Outcomes(outcome_code) | SELECT T1.role_description, T2.staff_id FROM Staff_Roles AS T1 JOIN Project_Staff AS T2 ON T1.role_code = T2.role_code JOIN Project_Outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T2.staff_id, T1.role_description ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
List the id, country, city and name of the airports ordered alphabetically by the name.?
Schema:
- airport(Airport_Name, City, Country, Domestic_Passengers, International_Passengers, Transit_Passengers, id, name) | SELECT id, Country, City, name FROM airport ORDER BY name ASC NULLS LAST; |
List all singer names in concerts in year 2014.?
Schema:
- singer_in_concert(...)
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
- concert(COUNT, Year) | SELECT T2.Name FROM singer_in_concert AS T1 JOIN singer AS T2 ON T1.Singer_ID = T2.Singer_ID JOIN concert AS T3 ON T1.concert_ID = T3.concert_ID WHERE T3."Year" = 2014; |
Show the ids and names of all 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)) | SELECT Document_ID, Document_Name FROM Documents; |
Find the id of suppliers whose average amount purchased for each product is above 50000 or below 30000.?
Schema:
- Product_Suppliers(COUNT, DOUBLE, TRY_CAST, product_id, supplier_id) | SELECT supplier_id FROM Product_Suppliers WHERE supplier_id IS NOT NULL GROUP BY supplier_id HAVING AVG(TRY_CAST(total_amount_purchased AS DOUBLE)) > 50000 OR AVG(TRY_CAST(total_amount_purchased AS DOUBLE)) < 30000; |
What are the names of all the tracks that are in both the Movies and music playlists?
Schema:
- tracks(composer, milliseconds, name, unit_price)
- playlist_tracks(...)
- playlists(name) | SELECT DISTINCT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id JOIN (SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music') AS T4 ON T1.name = T4.name WHERE T3.name = 'Movies'; |
Find names and ids of all documents with document type code BK.?
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 Document_Name, Document_ID FROM Documents WHERE Document_Type_Code = 'BK'; |
Which continent speaks the most languages?
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 T1.Continent FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Continent ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show all student ids and the number of hours played.?
Schema:
- Plays_Games(GameID, Hours_Played, StuID) | SELECT StuID, SUM(Hours_Played) AS total_hours_played FROM Plays_Games GROUP BY StuID; |
most popular topics at NIPS 2015?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- venue(venueId, venueName) | SELECT DISTINCT COUNT(T3.paperId) AS num_papers, T1.keyphraseId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T3."year" = 2015 AND T4.venueName = 'NIPS' GROUP BY T1.keyphraseId ORDER BY num_papers DESC NULLS LAST; |
what state has the lowest population density?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM state WHERE density = (SELECT MIN(density) FROM state); |
What are the employee ids for employees who make more than the average?
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 EMPLOYEE_ID FROM employees WHERE SALARY > (SELECT AVG(SALARY) FROM employees); |
Show the document id with paragraph text 'Brazil' and 'Ireland'.?
Schema:
- Paragraphs(COUNT, Document_ID, Other_Details, Paragraph_Text, T1) | SELECT DISTINCT T1.Document_ID FROM Paragraphs AS T1 JOIN Paragraphs AS T2 ON T1.Document_ID = T2.Document_ID WHERE T1.Paragraph_Text = 'Brazil' AND T2.Paragraph_Text = 'Ireland'; |
Which store has most the customers?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) | SELECT store_id FROM customer WHERE store_id IS NOT NULL GROUP BY store_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the year that has the most number of 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 "year" FROM matches_ GROUP BY "year" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Please show different denominations and the corresponding number of schools in descending order.?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type) | SELECT Denomination, COUNT(*) AS num_schools FROM school WHERE Denomination IS NOT NULL GROUP BY Denomination ORDER BY num_schools DESC NULLS LAST; |
Show names of cities and names of counties they are in.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- county_public_safety(COUNT, Case_burden, Crime_rate, Location, Name, Police_force, Police_officers, Population, T1) | SELECT T1.Name, T2.Name FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID; |
return me the number of papers by " H. V. Jagadish " on PVLDB .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name)
- writes(...)
- author(...) | SELECT COUNT(DISTINCT T4.title) AS num_papers FROM publication AS T4 JOIN journal AS T2 ON T4.jid = T2.jid JOIN writes AS T3 ON T3.pid = T4.pid JOIN author AS T1 ON T3.aid = T1.aid WHERE T1.name = 'H. V. Jagadish' AND T2.name = 'PVLDB'; |
Find the oldest log id and its corresponding problem id.?
Schema:
- Problem_Log(log_entry_date, log_entry_description, problem_id, problem_log_id) | SELECT problem_log_id, problem_id FROM Problem_Log ORDER BY log_entry_date ASC NULLS LAST LIMIT 1; |
Return the id and full name of the customer with the most accounts.?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id, T2.customer_first_name, T2.customer_last_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show the citizenship shared by singers with birth year before 1945 and after 1955.?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT Citizenship FROM singer WHERE Birth_Year < 1945 OR Birth_Year > 1955 AND Citizenship IS NOT NULL GROUP BY Citizenship HAVING COUNT(DISTINCT CASE WHEN Birth_Year < 1945 THEN Singer_ID END) > 0 AND COUNT(DISTINCT CASE WHEN Birth_Year > 1955 THEN Singer_ID END) > 0; |
Find all first-grade students who are NOT taught by OTHA MOYER. Report their first and last names.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
- teachers(Classroom, FirstName, LastName) | SELECT DISTINCT T1.FirstName, T1.LastName FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T1.Grade = 1 AND NOT (T2.FirstName = 'OTHA' AND T2.LastName = 'MOYER'); |
How many ships are there?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT COUNT(*) AS num_ships FROM ship; |
what states have rivers named ohio?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT traverse FROM river WHERE river_name = 'ohio'; |
Find all the distinct id and nationality of drivers who have had laptime more than 100000 milliseconds?
Schema:
- drivers(forename, nationality, surname)
- lapTimes(...) | SELECT DISTINCT T1.driverId, T1.nationality FROM drivers AS T1 JOIN lapTimes AS T2 ON T1.driverId = T2.driverId WHERE T2.milliseconds > 100000; |
Show the first names and last names of customers without 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 T1.customer_first_name, T1.customer_last_name FROM Customers AS T1 LEFT JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_id IS NULL; |
what is the number of neighboring states for kentucky?
Schema:
- border_info(T1, border, state_name) | SELECT COUNT(border) AS num_neighboring_states FROM border_info WHERE state_name = 'kentucky'; |
How many students are enrolled in the class taught by some professor from the accounting department?
Schema:
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
- ENROLL(...)
- COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT COUNT(*) AS num_students FROM CLASS AS T1 JOIN ENROLL AS T2 ON T1.CLASS_CODE = T2.CLASS_CODE JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN DEPARTMENT AS T4 ON T3.DEPT_CODE = T4.DEPT_CODE WHERE T4.DEPT_NAME = 'Accounting'; |
chi?
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 T2.venueName = 'chi'; |
What is highest rating for the most recent movie and when was it released?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year) | SELECT MAX(T1.stars) AS max_stars, T2."year" FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2."year" = (SELECT MAX("year") FROM Movie) GROUP BY T2."year"; |
Which teacher teaches the most students? Give me the first name and last name of the teacher.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
- teachers(Classroom, FirstName, LastName) | SELECT T2.FirstName, T2.LastName FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom GROUP BY T2.FirstName, T2.LastName ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many different payment methods are there?
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)) | SELECT COUNT(DISTINCT payment_method) AS num_payment_methods FROM Customers; |
Which cities have 2 to 4 parks?
Schema:
- park(city, state) | SELECT city FROM park WHERE city IS NOT NULL GROUP BY city HAVING COUNT(*) BETWEEN 2 AND 4; |
which states have points higher than the highest point in colorado?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT state_name FROM highlow WHERE highest_elevation > (SELECT highest_elevation FROM highlow WHERE state_name = 'colorado'); |
Give me a list of cities whose temperature in March is lower than that in July or higher than that in Oct?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- temperature(...) | SELECT T1.City FROM city AS T1 JOIN temperature AS T2 ON T1.City_ID = T2.City_ID WHERE T2.Mar < T2.Jul OR T2.Mar > T2.Oct; |
What is the average training hours of all players?
Schema:
- Player(HS, pName, weight, yCard) | SELECT AVG(HS) AS avg_training_hours FROM Player; |
Which tourist attractions do the tourists Vincent and Marcelle visit? Tell me the names of the attractions.?
Schema:
- Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more))
- Visitors(Tourist_Details)
- Visits(Visit_Date) | SELECT T1.Name FROM Tourist_Attractions AS T1 WHERE EXISTS (SELECT 1 FROM Visitors AS T2 JOIN Visits AS T3 ON T2.Tourist_ID = T3.Tourist_ID WHERE T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_Details = 'Vincent') AND EXISTS (SELECT 1 FROM Visitors AS T2 JOIN Visits AS T3 ON T2.Tourist_ID = T3.Tourist_ID WHERE T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_Details = 'Marcelle'); |
Show the names of products that are in at least two events in ascending alphabetical order of product name.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Products_in_Events(...) | SELECT T1.Product_Name FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name HAVING COUNT(*) >= 2 ORDER BY T1.Product_Name ASC NULLS LAST; |
What is the last name of the staff who has handled the first ever complaint?
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.last_name FROM Staff AS T1 JOIN Complaints AS T2 ON T1.staff_id = T2.staff_id ORDER BY T2.date_complaint_raised ASC NULLS LAST LIMIT 1; |
Find the first names of all the teachers that teach in classroom 110.?
Schema:
- teachers(Classroom, FirstName, LastName) | SELECT FirstName FROM teachers WHERE Classroom = 110; |
What is the number of technicians?
Schema:
- technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name) | SELECT COUNT(*) AS num_technicians FROM technician; |
List the name of enzymes in descending lexicographical order.?
Schema:
- enzyme(Chromosome, Location, OMIM, Porphyria, Product, name) | SELECT name FROM enzyme ORDER BY name DESC NULLS LAST; |
Report the name of all campuses in Los Angeles county.?
Schema:
- Campuses(Campus, County, Franc, Location) | SELECT Campus FROM Campuses WHERE County = 'Los Angeles'; |
What is the school color of the school with the largest enrollment?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type) | SELECT School_Colors FROM school ORDER BY Enrollment DESC NULLS LAST LIMIT 1; |
What are the allergies and their types that the student with first name Lisa has? And order the result by name of allergies.?
Schema:
- Allergy_Type(Allergy, AllergyType, COUNT)
- Has_Allergy(Allergy, COUNT, StuID)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT T1.Allergy, T1.AllergyType FROM Allergy_Type AS T1 JOIN Has_Allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = 'Lisa' ORDER BY T1.Allergy ASC NULLS LAST; |
What are the allergies the girl named Lisa has? And what are the types of them? Order the result by allergy names.?
Schema:
- Allergy_Type(Allergy, AllergyType, COUNT)
- Has_Allergy(Allergy, COUNT, StuID)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT T1.Allergy, T1.AllergyType FROM Allergy_Type AS T1 JOIN Has_Allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = 'Lisa' ORDER BY T1.Allergy ASC NULLS LAST; |
What are the log id and entry description of each problem?
Schema:
- Problem_Log(log_entry_date, log_entry_description, problem_id, problem_log_id) | SELECT problem_log_id, log_entry_description FROM Problem_Log; |
Find the average grade of all students who have some friends.?
Schema:
- Highschooler(COUNT, ID, grade, name)
- Friend(student_id) | SELECT AVG(grade) AS avg_grade FROM Highschooler WHERE ID IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID); |
List the most common type of competition.?
Schema:
- competition(COUNT, Competition_type, Country, T1, Year) | SELECT Competition_type FROM competition WHERE Competition_type IS NOT NULL GROUP BY Competition_type ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the average number of attendees for performances?
Schema:
- performance(Attendance, COUNT, Date, Location, T1) | SELECT AVG(Attendance) AS avg_attendees FROM performance; |
How many patients are not using Procrastin-X as medication?
Schema:
- Patient(...)
- Prescribes(...)
- Medication(Name) | SELECT COUNT(*) AS num_patients FROM Patient WHERE SSN NOT IN (SELECT T1.Patient FROM Prescribes AS T1 JOIN Medication AS T2 ON T1.Medication = T2.Code WHERE T2.Name = 'Procrastin-X'); |
Give the name of the wine with the highest score.?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT Name FROM wine ORDER BY Score DESC NULLS LAST LIMIT 1; |
What is the series name of the TV Channel that shows the cartoon "The Rise of the Blue Beetle"?
Schema:
- TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name)
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by) | SELECT T1.series_name FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T2.Title = 'The Rise of the Blue Beetle!'; |
How many players are there?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT COUNT(*) AS num_players FROM player; |
What are the names of different tracks, and how many races has each had?
Schema:
- race(Class, Date, Name)
- track(Location, Name, Seat, Seating, T1, Year_Opened) | SELECT T2.Name, COUNT(*) AS num_races FROM race AS T1 JOIN track AS T2 ON T1.Track_ID = CAST(T2.Track_ID AS TEXT) GROUP BY T1.Track_ID, T2.Name; |
Find all movies featuring both " Woody Strode " and " Jason Robards "?
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 T4.title FROM cast_ AS T5 JOIN actor AS T1 ON T5.aid = T1.aid JOIN movie AS T4 ON T4.mid = T5.msid JOIN cast_ AS T3 ON T4.mid = T3.msid JOIN actor AS T2 ON T3.aid = T2.aid WHERE T1.name = 'Woody Strode' AND T2.name = 'Jason Robards'; |
acl papers in 2012 in Parsing?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- venue(venueId, venueName) | 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 JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.keyphraseName = 'Parsing' AND T3."year" = 2012 AND T4.venueName = 'acl'; |
Find the name of the swimmer who has the most records.?
Schema:
- swimmer(Name, Nationality, meter_100, meter_200, meter_300)
- record(...) | SELECT T1.Name FROM swimmer AS T1 JOIN record AS T2 ON T1.ID = T2.Swimmer_ID GROUP BY T2.Swimmer_ID, T1.Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the average, minimum, and max ages for each of the different majors?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Major, AVG(Age) AS avg_age, MIN(Age) AS min_age, MAX(Age) AS max_age FROM Student GROUP BY Major; |
What are the names and ages of editors?
Schema:
- editor(Age, COUNT, Name) | SELECT Name, Age FROM editor; |
What is the list of program origins ordered alphabetically?
Schema:
- program(Beij, Launch, Name, Origin, Owner) | SELECT Origin FROM program ORDER BY Origin ASC NULLS LAST; |
List the forenames of all distinct drivers in alphabetical order?
Schema:
- drivers(forename, nationality, surname) | SELECT DISTINCT forename FROM drivers ORDER BY forename ASC NULLS LAST; |
when was the first deep learning paper published ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT 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' GROUP BY T3."year" ORDER BY T3."year" ASC NULLS LAST; |
What is the name and salary for employee with id 242518965?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) | SELECT name, salary FROM employee WHERE eid = 242518965; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.