question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
What are the average ages of losers and winners across 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 AVG(loser_age) AS avg_loser_age, AVG(winner_age) AS avg_winner_age FROM matches_; |
What are the names of all the teams in the basketball competition, sorted by all home scores in descending order?
Schema:
- basketball_match(ACC_Percent, All_Home, School_ID, Team_Name) | SELECT Team_Name FROM basketball_match ORDER BY All_Home DESC NULLS LAST; |
Find all the female actors in the movie " Saving Private Ryan "?
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 T1.name FROM cast_ AS T2 JOIN actor AS T1 ON T2.aid = T1.aid JOIN movie AS T3 ON T3.mid = T2.msid WHERE T1.gender = 'female' AND T3.title = 'Saving Private Ryan'; |
Find the total number of available hotels.?
Schema:
- Hotels(hotel_id, other_hotel_details, pets_allowed_yn, price_range, star_rating_code) | SELECT COUNT(*) AS num_hotels FROM Hotels; |
Find all the songs whose name contains the word "the".?
Schema:
- Songs(Title) | SELECT Title FROM Songs WHERE Title LIKE '% the %'; |
What are the official native languages that contain the string "English".?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT Official_native_language FROM country WHERE Official_native_language LIKE '%English%'; |
Count the number of distinct claim outcome codes.?
Schema:
- Claims_Processing(Claim_Outcome_Code) | SELECT COUNT(DISTINCT Claim_Outcome_Code) AS num_codes FROM Claims_Processing; |
what states are next to the ohio?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT traverse FROM river WHERE river_name = 'ohio'; |
How many professors who has a either Ph.D. or MA degree?
Schema:
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) | SELECT COUNT(*) AS num_professors FROM PROFESSOR WHERE PROF_HIGH_DEGREE = 'Ph.D.' OR PROF_HIGH_DEGREE = 'MA'; |
jamie callan 's publications by year?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId, 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 = 'jamie callan' ORDER BY T3."year" ASC NULLS LAST; |
what is capital of the state with the lowest point?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT T1.capital FROM highlow AS T2 JOIN state AS T1 ON T1.state_name = T2.state_name WHERE T2.lowest_elevation = (SELECT MIN(lowest_elevation) FROM highlow); |
Find the name of companies whose revenue is greater than the average revenue of all companies.?
Schema:
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT Name FROM Manufacturers WHERE Revenue > (SELECT AVG(Revenue) FROM Manufacturers); |
Which tourist attraction is associated with the photo "game1"? Return its name.?
Schema:
- Photos(Name)
- 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 T2.Name FROM Photos AS T1 JOIN Tourist_Attractions AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T1.Name = 'game1'; |
Which employees have either destroyed a document or made an authorization to do so? Return their employee ids.?
Schema:
- Documents_to_be_Destroyed(Destroyed_by_Employee_ID, Destruction_Authorised_by_Employee_ID) | SELECT DISTINCT Destroyed_by_Employee_ID FROM (SELECT Destroyed_by_Employee_ID FROM Documents_to_be_Destroyed UNION ALL SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_Destroyed); |
How many customers use each payment method?
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 payment_method_code, COUNT(*) AS num_customers FROM Customers GROUP BY payment_method_code; |
Show the transaction type descriptions and dates if the share count is smaller than 10.?
Schema:
- Ref_Transaction_Types(transaction_type_code, transaction_type_description)
- Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code) | SELECT T1.transaction_type_description, T2.date_of_transaction FROM Ref_Transaction_Types AS T1 JOIN Transactions AS T2 ON T1.transaction_type_code = T2.transaction_type_code WHERE TRY_CAST(T2.share_count AS DOUBLE) < 10; |
What are the prices of wines produced before the year of 2010?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT Price FROM wine WHERE "Year" < 2010; |
Find the number of complaints with Product Failure type for each complaint status.?
Schema:
- Complaints(complaint_status_code, complaint_type_code) | SELECT complaint_status_code, COUNT(*) AS num_complaints FROM Complaints WHERE complaint_type_code = 'Product Failure' GROUP BY complaint_status_code; |
What are the codes of card types that have 5 or more cards?
Schema:
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to) | SELECT card_type_code FROM Customers_Cards WHERE card_type_code IS NOT NULL GROUP BY card_type_code HAVING COUNT(*) >= 5; |
What is the average number of gold medals for a club?
Schema:
- club_rank(Gold, Silver, Total) | SELECT AVG(Gold) AS avg_gold_medals FROM club_rank; |
What articles have been published since 2006 about the effects of juicing for cancer patients ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT paperId, title FROM paper WHERE title LIKE 'the effects of juicing for cancer patients' AND "year" > 2006; |
What is the first and last name of the student who played the most sports?
Schema:
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT T2.Fname, T2.LName FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID, T2.Fname, T2.LName ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the different ranges of the 3 mountains with the highest prominence?
Schema:
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more)) | SELECT "Range" FROM mountain GROUP BY "Range" ORDER BY AVG(Prominence) DESC NULLS LAST LIMIT 3; |
Count the number of documents with the type code BK that correspond to each product id.?
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, Project_ID FROM Documents WHERE Document_Type_Code = 'BK' GROUP BY Project_ID; |
How many international and domestic passengers are there in the airport London Heathrow?
Schema:
- airport(Airport_Name, City, Country, Domestic_Passengers, International_Passengers, Transit_Passengers, id, name) | SELECT International_Passengers, Domestic_Passengers FROM airport WHERE Airport_Name = 'London Heathrow'; |
how many papers has Christopher D. Manning written ?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT COUNT(DISTINCT T2.paperId) AS num_papers FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'Christopher D. Manning'; |
How many accounts are there in total?
Schema:
- ACCOUNTS(name) | SELECT COUNT(*) AS num_accounts FROM ACCOUNTS; |
Compute the average number of hosts for parties.?
Schema:
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more)) | SELECT AVG(Number_of_hosts) AS avg_number_of_hosts FROM party; |
what are the parsing papers that have the most citations ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...) | SELECT DISTINCT T4.citedPaperId, COUNT(T4.citedPaperId) AS num_citations FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN cite AS T4 ON T3.paperId = T4.citedPaperId WHERE T1.keyphraseName = 'parsing' GROUP BY T4.citedPaperId ORDER BY num_citations DESC NULLS LAST; |
What is the average bike availability in stations that are not located in Palo Alto?
Schema:
- status(...)
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT AVG(bikes_available) AS avg_bike_availability FROM status WHERE station_id NOT IN (SELECT id FROM station WHERE city = 'Palo Alto'); |
How many papers were written on the convolutional neural networks this year ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(T3.paperId) AS num_papers 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 = 'convolutional neural networks' AND T3."year" = 2016; |
What are the names of patients who are staying in room 111 and have an undergoing treatment?
Schema:
- Undergoes(DateUndergoes, Patient)
- Patient(...)
- Stay(Patient, Room, StayStart) | SELECT DISTINCT T2.Name FROM Undergoes AS T1 JOIN Patient AS T2 ON T1.Patient = T2.SSN JOIN Stay AS T3 ON T1.Stay = T3.StayID WHERE T3.Room = 111; |
List the distinct director of all films.?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) | SELECT DISTINCT Director FROM film; |
Show the average, minimum, and maximum capacity for all the cinemas opened in year 2011 or later.?
Schema:
- cinema(COUNT, Capacity, Location, Name, Openning_year, T1, c) | SELECT AVG(Capacity) AS avg_capacity, MIN(Capacity) AS min_capacity, MAX(Capacity) AS max_capacity FROM cinema WHERE Openning_year >= 2011; |
Display the first name, and department number for all employees whose last name is "McEwen".?
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, DEPARTMENT_ID FROM employees WHERE LAST_NAME = 'McEwen'; |
Count the number of transactions.?
Schema:
- Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type) | SELECT COUNT(*) AS num_transactions FROM Financial_Transactions; |
which state has the sparsest 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); |
Find the checking balance of the accounts whose savings balance is higher than the average savings balance.?
Schema:
- ACCOUNTS(name)
- CHECKING(balance)
- SAVINGS(SAV, balance) | SELECT T2.balance FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid WHERE T1.name IN (SELECT T1.name FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid WHERE T2.balance > (SELECT AVG(balance) FROM SAVINGS)); |
what are syntactic parsing papers not written by chris dyer?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T1.authorName, T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T5 ON T2.keyphraseId = T5.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T1.authorName != 'chris dyer' AND T5.keyphraseName = 'syntactic parsing'; |
How many transactions do we have?
Schema:
- Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type) | SELECT COUNT(*) AS num_transactions FROM Financial_Transactions; |
number of states bordering kentucky?
Schema:
- border_info(T1, border, state_name) | SELECT COUNT(border) AS num_borders FROM border_info WHERE state_name = 'kentucky'; |
What are the names for the 3 branches that have the most memberships?
Schema:
- branch(Address_road, City, Name, Open_year, membership_amount) | SELECT Name FROM branch ORDER BY membership_amount DESC NULLS LAST LIMIT 3; |
How many books are there for each publisher?
Schema:
- book_club(Author_or_Editor, Book_Title, COUNT, Category, Publ, Publisher, T1) | SELECT Publisher, COUNT(*) AS num_books FROM book_club GROUP BY Publisher; |
how many chinese restaurants are there in the bay area ?
Schema:
- restaurant(...)
- geographic(...) | SELECT COUNT(*) AS num_restaurants FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name WHERE T2.region = 'bay area' AND T1.food_type = 'chinese'; |
Liwen Xiong 's papers in 2015 ?
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 = 'Liwen Xiong' AND T3."year" = 2015; |
what is the name and age of the youngest winning pilot?
Schema:
- pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team)
- match_(Competition, Date, Match_ID, Venue) | SELECT T1.Name, T1.Age FROM pilot AS T1 JOIN match_ AS T2 ON T1.Pilot_Id = T2.Winning_Pilot ORDER BY T1.Age ASC NULLS LAST LIMIT 1; |
list the local authorities and services provided by all stations.?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT local_authority, services FROM station; |
What are the names of gymnasts whose hometown is not "Santo Domingo"?
Schema:
- gymnast(Floor_Exercise_Points, Horizontal_Bar_Points)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T2.Hometown != 'Santo Domingo'; |
How many tracks does each genre have and what are the names of the top 5?
Schema:
- genres(name)
- tracks(composer, milliseconds, name, unit_price) | SELECT T1.name, COUNT(*) AS num_tracks FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id = T1.id GROUP BY T1.id, T1.name ORDER BY num_tracks DESC NULLS LAST LIMIT 5; |
How many distinct complaint type codes are there in the database?
Schema:
- Complaints(complaint_status_code, complaint_type_code) | SELECT COUNT(DISTINCT complaint_type_code) AS num_complaint_types FROM Complaints; |
Return the color code and description for the product with the name 'chervil'.?
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.color_code, T2.color_description FROM Products AS T1 JOIN Ref_Colors AS T2 ON T1.color_code = T2.color_code WHERE T1.product_name = 'chervil'; |
Which locations have 2 or more cinemas with capacity over 300?
Schema:
- cinema(COUNT, Capacity, Location, Name, Openning_year, T1, c) | SELECT Location FROM cinema WHERE Capacity > 300 AND Location IS NOT NULL GROUP BY Location HAVING COUNT(*) >= 2; |
Count the number of farms.?
Schema:
- farm(Cows, Working_Horses) | SELECT COUNT(*) AS num_farms FROM farm; |
What are the type codes and descriptions for all template types?
Schema:
- Ref_Template_Types(Template_Type_Code, Template_Type_Description) | SELECT Template_Type_Code, Template_Type_Description FROM Ref_Template_Types; |
What are the names of the singers whose birth years are either 1948 or 1949?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT Name FROM singer WHERE Birth_Year = 1948 OR Birth_Year = 1949; |
Which three cities have the largest regional population?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT City FROM city ORDER BY Regional_Population DESC NULLS LAST LIMIT 3; |
What is the average age for a male in each job?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT AVG(age) AS avg_age, job FROM Person WHERE gender = 'male' GROUP BY job; |
papers cited by at least 5 papers?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...) | SELECT DISTINCT T2.citingPaperId FROM paper AS T1 JOIN cite AS T2 ON T1.paperId = T2.citedPaperId GROUP BY T2.citingPaperId HAVING COUNT(DISTINCT T2.citedPaperId) >= 5; |
Find the number of students who are older than 18 and do not have allergy to either food or animal.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Allergy(Allergy, COUNT, StuID)
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT COUNT(*) AS num_students FROM Student WHERE Age > 18 AND StuID NOT IN (SELECT StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = 'food' OR T2.AllergyType = 'animal'); |
What are the different names for each station that has ever had 7 bikes available?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
- status(...) | SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available = 7; |
List all the document names which contains "CV".?
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 FROM Documents WHERE document_name LIKE '%CV%'; |
What are the ids and trade names of the medicine that can interact with at least 3 enzymes?
Schema:
- medicine(FDA_approved, Trade_Name, name)
- medicine_enzyme_interaction(interaction_type) | SELECT T1.id, T1.Trade_Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id, T1.Trade_Name HAVING COUNT(*) >= 3; |
List the name of artworks whose type is not "Program Talent Show".?
Schema:
- artwork(COUNT, Name, Type) | SELECT Name FROM artwork WHERE Type != 'Program Talent Show'; |
author published 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 are all the players who played in match season, sorted by college in ascending alphabetical order?
Schema:
- match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team) | SELECT Player FROM match_season ORDER BY College ASC NULLS LAST; |
Find the name of the storm that affected both Afghanistan and Albania regions.?
Schema:
- affected_region(Region_id)
- region(Label, Region_code, Region_name)
- storm(Damage_millions_USD, Dates_active, Name, Number_Deaths) | SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.Region_id = T2.Region_id JOIN storm AS T3 ON T1.Storm_ID = T3.Storm_ID WHERE T2.Region_name IN ('Afghanistan', 'Albania') GROUP BY T3.Name HAVING COUNT(DISTINCT T2.Region_name) = 2; |
What are the elimination moves of wrestlers whose team is "Team Orton"?
Schema:
- Elimination(Benjam, Eliminated_By, Elimination_Move, T1, Team, Time) | SELECT Elimination_Move FROM Elimination WHERE Team = 'Team Orton'; |
Find the name of department that offers the class whose description has the word "Statistics".?
Schema:
- COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT T2.DEPT_NAME FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE WHERE T1.CRS_DESCRIPTION LIKE '%Statistics%'; |
What is the location code with the most documents?
Schema:
- Document_Locations(COUNT, Date_in_Location_From, Date_in_Locaton_To, Location_Code) | SELECT Location_Code FROM Document_Locations WHERE Location_Code IS NOT NULL GROUP BY Location_Code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
what is the lowest point of the state with the largest area?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT T2.lowest_point FROM state AS T1 JOIN highlow AS T2 ON T1.state_name = T2.state_name WHERE T1.state_name IN (SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state)); |
Find the name of bank branch that provided the greatest total amount of loans.?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state)
- loan(...) | SELECT T1.bname FROM bank AS T1 JOIN loan AS T2 ON CAST(T1.branch_ID AS TEXT) = T2.branch_ID GROUP BY T1.bname ORDER BY SUM(T2.amount) DESC NULLS LAST LIMIT 1; |
On which day has it neither been foggy nor rained in the zip code of 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" FROM weather WHERE zip_code = 94107 AND events != 'Fog' AND events != 'Rain'; |
Which advisors have more than two students?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Advisor FROM Student WHERE Advisor IS NOT NULL GROUP BY Advisor HAVING COUNT(*) > 2; |
List all the student details in reversed lexicographical order.?
Schema:
- Students(cell_mobile_number, current_address_id, date_first_registered, date_left, date_of_latest_logon, email_address, family_name, first_name, last_name, login_name, middle_name, other_student_details, ... (1 more)) | SELECT other_student_details FROM Students ORDER BY other_student_details DESC NULLS LAST; |
How many gold medals has the club with the most coaches won?
Schema:
- match_result(...)
- coach(...) | SELECT T1.Club_ID, T1.Gold FROM match_result AS T1 JOIN coach AS T2 ON T1.Club_ID = T2.Club_ID GROUP BY T1.Club_ID, T1.Gold ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the average age of the members of the club "Bootup Baltimore"?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn)
- Member_of_club(...)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT AVG(T3.Age) AS avg_age FROM Club AS T1 JOIN Member_of_club AS T2 ON T1.ClubID = T2.ClubID JOIN Student AS T3 ON T2.StuID = T3.StuID WHERE T1.ClubName = 'Bootup Baltimore'; |
How many different services are provided by all stations?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT COUNT(DISTINCT services) AS num_services FROM station; |
What are the names of the ships that are not from the United States?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT Name FROM ship WHERE Nationality != 'United States'; |
List all the Sci-Fi movies which released in 2010?
Schema:
- genre(g_name, rating)
- classification(...)
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) | SELECT T3.title FROM genre AS T2 JOIN classification AS T1 ON T2.gid = T1.gid JOIN movie AS T3 ON T3.mid = T1.msid WHERE T2.genre = 'Sci-Fi' AND T3.release_year = 2010; |
List the first name of all employees with job code PROF ordered by their date of birth.?
Schema:
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) | SELECT EMP_FNAME FROM EMPLOYEE WHERE EMP_JOBCODE = 'PROF' ORDER BY EMP_DOB ASC NULLS LAST; |
List the locations of schools that do not have any player.?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type)
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT Location FROM school WHERE School_ID NOT IN (SELECT School_ID FROM player); |
What college has a student who successfully made the team in the role of a goalie?
Schema:
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT cName FROM Tryout WHERE decision = 'yes' AND pPos = 'goalie'; |
From which hometowns did both people older than 23 and younger than 20 come from?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT DISTINCT p1.Hometown FROM people p1 JOIN people p2 ON p1.Hometown = p2.Hometown WHERE p1.Age > 23 AND p2.Age < 20; |
what paper has Richard Ladner published in chi journal ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T3.paperId 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 = 'Richard Ladner' AND T4.venueName = 'chi'; |
Return the id and full name of the customer who has the fewest accounts.?
Schema:
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to)
- 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 Customers_Cards 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(*) ASC NULLS LAST LIMIT 1; |
Give me the name of all the actors from Afghanistan?
Schema:
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT name FROM actor WHERE nationality = 'Afghanistan'; |
What are the names of players who have the best dribbling?
Schema:
- Player(HS, pName, weight, yCard)
- Player_Attributes(overall_rating, preferred_foot) | SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.dribbling = (SELECT MAX(dribbling) FROM Player_Attributes); |
how many states border colorado and border new mexico?
Schema:
- border_info(T1, border, state_name) | SELECT COUNT(border) AS num_borders FROM border_info WHERE border IN (SELECT border FROM border_info WHERE state_name = 'new mexico') AND state_name = 'colorado'; |
What is the id of the product that was ordered the most often?
Schema:
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) | SELECT product_id FROM Order_Items WHERE product_id IS NOT NULL GROUP BY product_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Which organisation hired the most number of research staff? List the organisation id, type and detail.?
Schema:
- Organisations(...)
- Research_Staff(staff_details) | SELECT T1.organisation_id, T1.organisation_type, T1.organisation_details FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_id, T1.organisation_type, T1.organisation_details ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the name of the activity that has the most faculty members involved in?
Schema:
- Activity(activity_name)
- Faculty_Participates_in(FacID) | SELECT T1.activity_name FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid, T1.activity_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the actual delivery dates of orders with quantity 1?
Schema:
- Customer_Orders(customer_id, order_date, order_id, order_shipping_charges)
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) | SELECT T1.Actual_Delivery_Date FROM Customer_Orders AS T1 JOIN Order_Items AS T2 ON T1.Order_ID = T2.Order_ID WHERE TRY_CAST(T2.Order_Quantity AS INT) = 1; |
List the last name of the owner owning the youngest dog.?
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.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T2.age = (SELECT MIN(age) FROM Dogs); |
What are the bed type and name of all the rooms with traditional decor?
Schema:
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT roomName, bedType FROM Rooms WHERE decor = 'traditional'; |
How many distinct kinds of injuries happened after season 2010?
Schema:
- injury_accident(Source)
- game(Date, Home_team, Season) | SELECT COUNT(DISTINCT T1.Injury) AS num_injuries FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.Season > 2010; |
What are the names of the singers that have more than one song?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more)) | SELECT T1.Name FROM singer AS T1 JOIN song AS T2 ON T1.Singer_ID = T2.Singer_ID GROUP BY T1.Name HAVING COUNT(*) > 1; |
List the names of people that are not poker players.?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- poker_player(Best_Finish, Earnings, Final_Table_Made, Money_Rank) | SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM poker_player); |
return me the authors who have more than 10 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' GROUP BY T1.name HAVING COUNT(DISTINCT T4.title) > 10; |
Find all restaurant Seafood in Los Angeles?
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 = 'Los Angeles' AND T2.category_name = 'Seafood' AND T3.category_name = 'restaurant'; |
Give me a list of cities whose temperature in Feb is higher than that in Jun or cities that were once host cities?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- temperature(...)
- hosting_city(Host_City, Year) | SELECT DISTINCT City FROM (SELECT T1.City FROM city AS T1 JOIN temperature AS T2 ON T1.City_ID = T2.City_ID WHERE T2.Feb > T2.Jun UNION ALL SELECT T3.City FROM city AS T3 JOIN hosting_city AS T4 ON T3.City_ID = T4.Host_City); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.