question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
For each zip code, select all those that have an average mean visiblity below 10.?
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 FROM weather WHERE zip_code IS NOT NULL GROUP BY zip_code HAVING AVG(mean_visibility_miles) < 10; |
What are the first name and last name of the players whose death record is empty?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT name_first, name_last FROM player WHERE death_year IS NULL; |
where is a good place on buchanan in san francisco for arabic food ?
Schema:
- restaurant(...)
- location(...) | SELECT T2.house_number, T1.name FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'san francisco' AND T2.street_name = 'buchanan' AND T1.food_type = 'arabic' AND T1.rating > 2.5; |
What is the name and checking balance of the account which has the lowest savings balance?
Schema:
- ACCOUNTS(name)
- CHECKING(balance)
- SAVINGS(SAV, balance) | SELECT T2.balance, T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid ORDER BY T3.balance ASC NULLS LAST LIMIT 1; |
who had papers at acl 2016 ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT T1.authorId FROM venue AS T3 JOIN paper AS T2 ON T3.venueId = T2.venueId JOIN writes AS T1 ON T1.paperId = T2.paperId WHERE T2."year" = 2016 AND T3.venueName = 'acl'; |
What venues are for Neuroscience ?
Schema:
- venue(venueId, venueName) | SELECT DISTINCT venueId FROM venue WHERE venueName = 'Neuroscience'; |
What is the city with the most number of flagship stores?
Schema:
- store(Type)
- store_district(...)
- district(City_Area, City_Population, District_name, d) | 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 GROUP BY T3.Headquartered_City ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many students exist?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_students FROM Student; |
return me the papers on VLDB conference .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- conference(homepage, name) | SELECT T2.title FROM publication AS T2 JOIN conference AS T1 ON T2.cid = CAST(T1.cid AS TEXT) WHERE T1.name = 'VLDB'; |
What are the names and balances of checking accounts belonging to the customer with the lowest savings balance?
Schema:
- ACCOUNTS(name)
- CHECKING(balance)
- SAVINGS(SAV, balance) | SELECT T1.name, T2.balance FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid ORDER BY T3.balance ASC NULLS LAST LIMIT 1; |
How many documents are using the template with type code 'PPT'?
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 COUNT(*) AS num_documents FROM Documents AS T1 JOIN Templates AS T2 ON T1.Template_ID = T2.Template_ID WHERE T2.Template_Type_Code = 'PPT'; |
Find the titles of all movies directed by steven spielberg.?
Schema:
- Movie(T1, director, title, year) | SELECT title FROM Movie WHERE director = 'Steven Spielberg'; |
Find the distinct last names of all the students who have president votes and whose advisor is not 2192.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT T1.LName FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = President_Vote WHERE T1.LName NOT IN (SELECT DISTINCT LName FROM Student WHERE Advisor = '2192'); |
Show me all grades that have at least 4 students.?
Schema:
- Highschooler(COUNT, ID, grade, name) | SELECT grade FROM Highschooler WHERE grade IS NOT NULL GROUP BY grade HAVING COUNT(*) >= 4; |
List all company names with a book published by Alyson.?
Schema:
- culture_company(...)
- book_club(Author_or_Editor, Book_Title, COUNT, Category, Publ, Publisher, T1) | SELECT T1.Company_name FROM culture_company AS T1 JOIN book_club AS T2 ON T1.book_club_id = CAST(T2.book_club_id AS TEXT) WHERE T2.Publisher = 'Alyson'; |
What are the maximum, minimum, and average booked count for the products booked?
Schema:
- Products_Booked(booked_count, product_id) | SELECT MAX(booked_count) AS max_booked_count, MIN(booked_count) AS min_booked_count, AVG(booked_count) AS avg_booked_count FROM Products_Booked; |
Find all states in which there is a Whataburger?
Schema:
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT state FROM business WHERE name = 'Whataburger'; |
What is the grade of each high schooler?
Schema:
- Highschooler(COUNT, ID, grade, name) | SELECT grade FROM Highschooler; |
what is the longest river?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river); |
what is the population of 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'; |
Find the name of all students who were in the tryout sorted in alphabetic order.?
Schema:
- Player(HS, pName, weight, yCard)
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT T1.pName FROM Player AS T1 JOIN Tryout AS T2 ON T1.pID = T2.pID ORDER BY T1.pName ASC NULLS LAST; |
Find the average life expectancy and total population for each continent where the average life expectancy is shorter than 72?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT SUM(Population) AS total_population, AVG(LifeExpectancy) AS avg_life_expectancy, Continent FROM country WHERE Continent IS NOT NULL GROUP BY Continent HAVING AVG(LifeExpectancy) < 72; |
Find the first name of students in the descending order of age.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Fname FROM Student ORDER BY Age DESC NULLS LAST; |
What are the birth date and birth place of the body builder with the highest total points?
Schema:
- body_builder(Clean_Jerk, Snatch, Total)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T2.Birth_Date, T2.Birth_Place FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Total DESC NULLS LAST LIMIT 1; |
Find the average room count of the apartments that have the "Studio" type code.?
Schema:
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count) | SELECT AVG(TRY_CAST(room_count AS INT)) AS avg_room_count FROM Apartments WHERE apt_type_code = 'Studio'; |
what is the best american in the bay area ?
Schema:
- restaurant(...)
- geographic(...)
- location(...) | SELECT T3.house_number, T1.name FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name JOIN location AS T3 ON T1.id = T3.restaurant_id WHERE T2.region = 'bay area' AND T1.food_type = 'american' AND T1.rating = (SELECT MAX(T1.rating) FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name WHERE T2.region = 'bay area' AND T1.food_type = 'american'); |
How many classrooms are not in Lamberton?
Schema:
- classroom(building, capacity, room_number) | SELECT COUNT(*) AS num_classrooms FROM classroom WHERE building != 'Lamberton'; |
What are the names of the teachers who teach at least two courses?
Schema:
- course_arrange(...)
- teacher(Age, COUNT, D, Hometown, Name) | SELECT T2.Name FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name HAVING COUNT(*) >= 2; |
what is the most 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 MAX(population) FROM state); |
What are the name of pilots aged 25 or older?
Schema:
- pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team) | SELECT Name FROM pilot WHERE Age >= 25; |
Show different colleges along with the number of authors of submission from each college.?
Schema:
- submission(Author, COUNT, College, Scores) | SELECT College, COUNT(*) AS num_authors FROM submission GROUP BY College; |
Parsing papers from ACL 2014 that used Jeopardy! Questions?
Schema:
- paperDataset(...)
- dataset(...)
- paperKeyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- venue(venueId, venueName)
- keyphrase(...) | SELECT DISTINCT T2.paperId FROM paperDataset AS T3 JOIN dataset AS T5 ON T3.datasetId = T5.datasetId JOIN paperKeyphrase AS T4 ON T4.paperId = T3.paperId JOIN paper AS T2 ON T2.paperId = T3.paperId JOIN venue AS T6 ON T6.venueId = T2.venueId JOIN keyphrase AS T1 ON T4.keyphraseId = T1.keyphraseId WHERE T5.datasetName = 'Jeopardy! Questions' AND T1.keyphraseName = 'Parsing' AND T2."year" = 2014 AND T6.venueName = 'ACL'; |
Return the template type code of the template that is used by a document named Data base.?
Schema:
- Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number)
- 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 T1.Template_Type_Code FROM Templates AS T1 JOIN Documents AS T2 ON T1.Template_ID = T2.Template_ID WHERE T2.Document_Name = 'Data base'; |
Find the name of students who have taken the prerequisite course of the course with title International Finance.?
Schema:
- student(COUNT, H, dept_name, name, tot_cred)
- takes(COUNT, semester, year)
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- prereq(...) | SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.ID = T2.ID WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id = T4.course_id WHERE T3.title = 'International Finance'); |
Show member names without any registered branch.?
Schema:
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
- membership_register_branch(...) | SELECT Name FROM member_ WHERE Member_ID NOT IN (SELECT Member_ID FROM membership_register_branch); |
Which country and state does staff with first name as Janessa and last name as Sawayn lived?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- 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 T1.country, T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'; |
authors with at least 5 papers?
Schema:
- writes(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(T2.paperId) AS num_papers, T1.authorId FROM writes AS T1 JOIN paper AS T2 ON T1.paperId = T2.paperId GROUP BY T1.authorId HAVING COUNT(T2.paperId) >= 5; |
What are the names and enrollment numbers for colleges that have more than 10000 enrolled and are located in Louisiana?
Schema:
- College(M, cName, enr, state) | SELECT cName, enr FROM College WHERE enr > 10000 AND state = 'LA'; |
Show the different nationalities and the number of journalists of each nationality.?
Schema:
- journalist(Age, COUNT, Name, Nationality, T1, Years_working) | SELECT Nationality, COUNT(*) AS num_journalists FROM journalist GROUP BY Nationality; |
Show the church names for the weddings of all people older than 30.?
Schema:
- wedding(...)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- church(Name, Open_Date, Organized_by) | SELECT T4.Name FROM wedding AS T1 JOIN people AS T2 ON T1.Male_ID = T2.People_ID JOIN people AS T3 ON T1.Female_ID = T3.People_ID JOIN church AS T4 ON T4.Church_ID = T1.Church_ID WHERE T2.Age > 30 OR T3.Age > 30; |
List the type of the services in alphabetical order.?
Schema:
- Services(Service_Type_Code, Service_name) | SELECT Service_Type_Code FROM Services ORDER BY Service_Type_Code ASC NULLS LAST; |
What are the name and assets of each company, sorted in ascending order of company name?
Schema:
- Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name) | SELECT name, Assets_billion FROM Companies ORDER BY name ASC NULLS LAST; |
What is the age of the friend of Zach with longest year relationship?
Schema:
- Person(M, age, city, eng, gender, job, name)
- PersonFriend(M, friend, name) | SELECT T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Zach' AND T2."year" = (SELECT MAX("year") FROM PersonFriend WHERE name = 'Zach'); |
Find the number of matches happened in each year.?
Schema:
- matches_(COUNT, T1, loser_age, loser_name, minutes, tourney_name, winner_age, winner_hand, winner_name, winner_rank, winner_rank_points, year) | SELECT COUNT(*) AS num_matches, "year" FROM matches_ GROUP BY "year"; |
How many events are there?
Schema:
- event(Date, Event_Attendance, Name, Venue, Year) | SELECT COUNT(*) AS num_events FROM event; |
How many tasks does each project have? List the task count and the project detail.?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
- Tasks(...) | SELECT COUNT(*) AS num_tasks, T1.project_details FROM Projects AS T1 JOIN Tasks AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id, T1.project_details; |
Show all card type codes.?
Schema:
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to) | SELECT DISTINCT card_type_code FROM Customers_Cards; |
For each grant id, how many documents does it have, and which one has the most?
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 grant_id, COUNT(*) AS num_documents FROM Documents WHERE grant_id IS NOT NULL GROUP BY grant_id ORDER BY num_documents DESC NULLS LAST LIMIT 1; |
List the name of singers whose citizenship is not "France".?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT Name FROM singer WHERE Citizenship != 'France'; |
What are the name and location of the cinema with the largest capacity?
Schema:
- cinema(COUNT, Capacity, Location, Name, Openning_year, T1, c) | SELECT Name, Location FROM cinema ORDER BY Capacity DESC NULLS LAST LIMIT 1; |
Which course author teaches the "advanced database" course? Give me his or her login name.?
Schema:
- Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name)
- Courses(course_description, course_name) | SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = 'advanced database'; |
what are the names of the channels that broadcast in both morning and night?
Schema:
- channel(Name, Owner, Rating_in_percent, Share_in_percent)
- broadcast(Program_ID, Time_of_day) | SELECT DISTINCT T1.Name FROM channel AS T1 JOIN broadcast AS T2 ON T1.Channel_ID = T2.Channel_ID WHERE T2.Time_of_day = 'Morning' AND T1.Name IN (SELECT T1.Name FROM channel AS T1 JOIN broadcast AS T2 ON T1.Channel_ID = T2.Channel_ID WHERE T2.Time_of_day = 'Night'); |
List the companies of entrepreneurs in descending order of money requested.?
Schema:
- entrepreneur(COUNT, Company, Investor, Money_Requested) | SELECT Company FROM entrepreneur ORDER BY Money_Requested DESC NULLS LAST; |
I want the co-authors of papers on Machine Translation Output with Philipp Koehn?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- writes(...)
- author(...) | SELECT DISTINCT T1.authorId FROM paperKeyphrase AS T6 JOIN keyphrase AS T3 ON T6.keyphraseId = T3.keyphraseId JOIN writes AS T4 ON T4.paperId = T6.paperId JOIN writes AS T5 ON T5.paperId = T4.paperId JOIN author AS T1 ON T5.authorId = T1.authorId JOIN author AS T2 ON T4.authorId = T2.authorId WHERE T2.authorName = 'Philipp Koehn' AND T3.keyphraseName = 'Machine Translation Output'; |
How many climbers are there?
Schema:
- climber(Country, K, Name, Points) | SELECT COUNT(*) AS num_climbers FROM climber; |
What is the number of continents?
Schema:
- continents(...) | SELECT COUNT(*) AS num_continents FROM continents; |
Find the distinct first names of all the students who have vice president votes and whose city code is not PIT.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT T1.Fname FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.Vice_President_Vote WHERE T1.Fname NOT IN (SELECT DISTINCT Fname FROM Student WHERE city_code = 'PIT'); |
How many bank branches are there?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state) | SELECT COUNT(*) AS num_branches FROM bank; |
Return the top 3 greatest support rates.?
Schema:
- candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_rate) | SELECT Support_rate FROM candidate ORDER BY Support_rate DESC NULLS LAST LIMIT 3; |
What are the lifespans of representatives in descending order of vote percent?
Schema:
- election(Committee, Date, Delegate, District, Vote_Percent, Votes)
- representative(JO, Lifespan, Name, Party, State, T1) | SELECT T2.Lifespan FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY Vote_Percent DESC NULLS LAST; |
For each main industry, what is the total number of companies for the industry with the highest total market value?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Main_Industry, COUNT(*) AS num_companies FROM company WHERE Main_Industry IS NOT NULL GROUP BY Main_Industry ORDER BY SUM(Market_Value) DESC NULLS LAST LIMIT 1; |
List all the distinct stations from which a trip of duration below 100 started.?
Schema:
- trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code) | SELECT DISTINCT start_station_name FROM trip WHERE duration < 100; |
Find the names of the swimmers who have both "win" and "loss" results in the record.?
Schema:
- swimmer(Name, Nationality, meter_100, meter_200, meter_300)
- record(...) | SELECT T1.Name FROM swimmer AS T1 WHERE EXISTS (SELECT 1 FROM record AS T2 WHERE T1.ID = T2.Swimmer_ID AND T2."Result" = 'Win') AND EXISTS (SELECT 1 FROM record AS T3 WHERE T1.ID = T3.Swimmer_ID AND T3."Result" = 'Loss'); |
Who has written a paper that has the word "Functional" in its title? Return the first names of the authors.?
Schema:
- Authors(fname, lname)
- Authorship(...)
- Papers(title) | SELECT T1.fname FROM Authors AS T1 JOIN Authorship AS T2 ON T1.authID = T2.authID JOIN Papers AS T3 ON T2.paperID = T3.paperID WHERE T3.title LIKE '%Functional%'; |
How many customers live in the city of Prague?
Schema:
- customers(Mart, city, company, country, email, first_name, last_name, phone, state) | SELECT COUNT(*) AS num_customers FROM customers WHERE city = 'Prague'; |
Find the captain rank that has no captain in Third-rate ship of the line class.?
Schema:
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT DISTINCT "Rank" FROM captain WHERE "Rank" NOT IN (SELECT "Rank" FROM captain WHERE Class = 'Third-rate Ship of the line'); |
Give the name of the products that have a color description 'yellow'.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Ref_Colors(color_description) | SELECT T1.product_name FROM Products AS T1 JOIN Ref_Colors AS T2 ON T1.color_code = T2.color_code WHERE T2.color_description = 'yellow'; |
List the race class with at least two races.?
Schema:
- race(Class, Date, Name) | SELECT Class FROM race WHERE Class IS NOT NULL GROUP BY Class HAVING COUNT(*) >= 2; |
Find the id of the candidate who got the lowest oppose rate.?
Schema:
- candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_rate) | SELECT Candidate_ID FROM candidate ORDER BY Oppose_rate ASC NULLS LAST LIMIT 1; |
What are the ids for courses that were offered in both Fall of 2009 and Spring of 2010?
Schema:
- section(COUNT, JO, Spr, T1, course_id, semester, year) | SELECT DISTINCT T1.course_id FROM (SELECT course_id FROM section WHERE semester = 'Fall' AND "year" = 2009) AS T1 JOIN (SELECT course_id FROM section WHERE semester = 'Spring' AND "year" = 2010) AS T2 ON T1.course_id = T2.course_id; |
Return the name of the wrestler who had the lowest number of days held.?
Schema:
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT Name FROM wrestler ORDER BY Days_held ASC NULLS LAST LIMIT 1; |
Among the cars with more than lowest horsepower, which ones do not have more than 3 cylinders? List the car makeid and make name.?
Schema:
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
- car_names(COUNT, Model) | SELECT T2.MakeId, T2.Make FROM cars_data AS T1 JOIN car_names AS T2 ON T1.Id = T2.MakeId WHERE T1.Horsepower > (SELECT MIN(Horsepower) FROM cars_data) AND T1.Cylinders <= 3; |
Find the location of the club "Pen and Paper Gaming".?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn) | SELECT ClubLocation FROM Club WHERE ClubName = 'Pen and Paper Gaming'; |
find the number of different programs that are broadcast during night time.?
Schema:
- broadcast(Program_ID, Time_of_day) | SELECT COUNT(DISTINCT Program_ID) AS num_programs FROM broadcast WHERE Time_of_day = 'Night'; |
Please show different types of artworks with the corresponding number of artworks of each type.?
Schema:
- artwork(COUNT, Name, Type) | SELECT Type, COUNT(*) AS num_artworks FROM artwork GROUP BY Type; |
what is the size of the largest state in the usa?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT MAX(area) AS max_area FROM state; |
what are the populations of the states through which the mississippi river runs?
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 population FROM state WHERE state_name IN (SELECT traverse FROM river WHERE river_name = 'mississippi'); |
Show the 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)) | SELECT COUNT(*) AS num_documents FROM Documents; |
papers that are coauthored by Peter Mertens and Dina Barbian?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT T3.paperId FROM writes AS T3 JOIN author AS T2 ON T3.authorId = T2.authorId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T2.authorName = 'Peter Mertens' AND T1.authorName = 'Dina Barbian'; |
What products are available at store named "Miramichi"?
Schema:
- product(COUNT, pages_per_minute_color, product)
- store_product(...)
- store(Type) | SELECT T1.product FROM product AS T1 JOIN store_product AS T2 ON T1.product_id = T2.product_id JOIN store AS T3 ON T2.Store_ID = T3.Store_ID WHERE T3.Store_Name = 'Miramichi'; |
Return the names of parties that have two or more events.?
Schema:
- party_events(Event_Name)
- 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 party_events AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID, T2.Party_name HAVING COUNT(*) >= 2; |
Return the ids of all products that were ordered more than three times or supplied more than 80000.?
Schema:
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
- Product_Suppliers(COUNT, DOUBLE, TRY_CAST, product_id, supplier_id) | SELECT DISTINCT product_id FROM (SELECT product_id FROM Order_Items WHERE product_id IS NOT NULL GROUP BY product_id HAVING COUNT(*) > 3 UNION ALL SELECT product_id FROM Product_Suppliers WHERE product_id IS NOT NULL GROUP BY product_id HAVING SUM(TRY_CAST(total_amount_purchased AS DOUBLE)) > 80000); |
List the amount and donor name for the largest amount of donation.?
Schema:
- endowment(School_id, amount, donator_name) | SELECT amount, donator_name FROM endowment ORDER BY amount DESC NULLS LAST LIMIT 1; |
return me the authors who have papers in the VLDB conference .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- conference(homepage, name)
- writes(...)
- author(...) | SELECT T1.name FROM publication AS T4 JOIN conference AS T2 ON T4.cid = CAST(T2.cid AS TEXT) JOIN writes AS T3 ON T3.pid = T4.pid JOIN author AS T1 ON T3.aid = T1.aid WHERE T2.name = 'VLDB'; |
Count the number of different payment method codes used by parties.?
Schema:
- Parties(party_email, party_phone, payment_method_code) | SELECT COUNT(DISTINCT payment_method_code) AS num_payment_methods FROM Parties; |
What are the name and id of the team with the most victories in 2008 postseason?
Schema:
- postseason(ties)
- team(Name) | SELECT T2.name, T1.team_id_winner FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T1."year" = 2008 GROUP BY T2.name, T1.team_id_winner ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many undergraduates are there in "San Jose State University" in year 2004?
Schema:
- discipline_enrollments(...)
- Campuses(Campus, County, Franc, Location) | SELECT SUM(T1.Undergraduate) AS num_undergraduates FROM discipline_enrollments AS T1 JOIN Campuses AS T2 ON T1.Campus = T2.Id WHERE T1."Year" = 2004 AND T2.Campus = 'San Jose State University'; |
Find the number and averaged salary of all instructors who are in the department with the highest budget.?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary)
- department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name) | SELECT AVG(T1.salary) AS avg_salary, COUNT(*) AS num_instructors FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name = T2.dept_name GROUP BY T2.budget ORDER BY T2.budget DESC NULLS LAST LIMIT 1; |
What are the catalog entry names of the products with next entry ID above 8?
Schema:
- Catalog_Contents(capacity, catalog_entry_name, height, next_entry_id, price_in_dollars, price_in_euros, product_stock_number) | SELECT catalog_entry_name FROM Catalog_Contents WHERE next_entry_id > 8; |
Compute the total order quantities of the product "photo".?
Schema:
- 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 SUM(TRY_CAST(T1.Order_Quantity AS DOUBLE)) AS total_order_quantity FROM Order_Items AS T1 JOIN Products AS T2 ON CAST(T1.Product_ID AS TEXT) = T2.Product_ID WHERE T2.Product_Name = 'photo'; |
Which kind of part has the least number of faults? List the part name.?
Schema:
- Parts(chargeable_amount, part_id)
- Part_Faults(...) | SELECT T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
Count the number of countries.?
Schema:
- county_public_safety(COUNT, Case_burden, Crime_rate, Location, Name, Police_force, Police_officers, Population, T1) | SELECT COUNT(*) AS num_countries FROM county_public_safety; |
Show the customer ids and firstname without a credit card.?
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))
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to) | SELECT T1.customer_id, T1.customer_first_name FROM Customers AS T1 LEFT JOIN (SELECT Customers_Cards.customer_id, Customers.customer_first_name FROM Customers_Cards JOIN Customers ON Customers_Cards.customer_id = Customers.customer_id WHERE Customers_Cards.card_type_code = 'Credit') AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_id IS NULL; |
Show the most common type code across products.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT Product_Type_Code FROM Products WHERE Product_Type_Code IS NOT NULL GROUP BY Product_Type_Code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many medicines are offered by each trade name?
Schema:
- medicine(FDA_approved, Trade_Name, name) | SELECT Trade_Name, COUNT(*) AS num_medicines FROM medicine GROUP BY Trade_Name; |
Who publishes in sensor fusion ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- writes(...)
- author(...) | SELECT DISTINCT T1.authorName FROM paperKeyphrase AS T2 JOIN keyphrase AS T4 ON T2.keyphraseId = T4.keyphraseId JOIN writes AS T3 ON T3.paperId = T2.paperId JOIN author AS T1 ON T3.authorId = T1.authorId WHERE T4.keyphraseName LIKE 'sensor fusion'; |
List the major of each male student.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Major FROM Student WHERE Sex = 'M'; |
What is the full name of each car maker, along with its id and how many models it produces?
Schema:
- car_makers(...)
- model_list(Maker, Model) | SELECT T1.FullName, T1.Id, COUNT(*) AS num_models FROM car_makers AS T1 JOIN model_list AS T2 ON T1.Id = T2.Maker GROUP BY T1.Id, T1.FullName; |
What are the department names and how many employees work in each of them?
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))
- departments(DEPARTMENT_NAME, Market) | SELECT DEPARTMENT_NAME, COUNT(*) AS num_employees FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID GROUP BY DEPARTMENT_NAME; |
List all the restaurant rated more than 3.5?
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 WHERE T1.rating > 3.5 AND T2.category_name = 'restaurant'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.