question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
What are the different product names for products that have the 'warm' characteristic:?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Product_Characteristics(...)
- Characteristics(characteristic_name) | SELECT DISTINCT T1.product_name FROM Products AS T1 JOIN Product_Characteristics AS T2 ON T1.product_id = T2.product_id JOIN Characteristics AS T3 ON T2.characteristic_id = T3.characteristic_id WHERE T3.characteristic_name = 'warm'; |
What is the count of cities with more than 3 airports?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT COUNT(*) AS num_cities FROM (SELECT city FROM airports WHERE city IS NOT NULL GROUP BY city HAVING COUNT(*) > 3); |
Find the name and total checking and savings balance of the accounts whose savings balance is lower than corresponding checking balance.?
Schema:
- ACCOUNTS(name)
- CHECKING(balance)
- SAVINGS(SAV, balance) | SELECT T1.name, T3.balance + T2.balance AS total_balance FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid WHERE T3.balance < T2.balance; |
how many residents live 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'; |
Show all publishers and the number of books 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; |
What is the organisation type and id of the organisation which has the most number of research staff?
Schema:
- Organisations(...)
- Research_Staff(staff_details) | SELECT T1.organisation_type, T1.organisation_id 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 ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the final tables made and best finishes for all poker players?
Schema:
- poker_player(Best_Finish, Earnings, Final_Table_Made, Money_Rank) | SELECT Final_Table_Made, Best_Finish FROM poker_player; |
List the studios which average gross is above 4500000.?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) | SELECT Studio FROM film WHERE Studio IS NOT NULL GROUP BY Studio HAVING AVG(Gross_in_dollar) >= 4500000; |
Give the building that the instructor who teaches the greatest number of courses lives in.?
Schema:
- Course(CName, Credits, Days)
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT T2.Building FROM Course AS T1 JOIN Faculty AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor, T2.Building ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show the first names and last names of all the guests that have apartment bookings with status code "Confirmed".?
Schema:
- Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code)
- Guests(date_of_birth, gender_code, guest_first_name, guest_last_name) | SELECT T2.guest_first_name, T2.guest_last_name FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = 'Confirmed'; |
Find the average age of students who live in the city with code "NYC" and have secretary votes in the spring election cycle.?
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 AVG(T1.Age) AS avg_age FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = Secretary_Vote WHERE T1.city_code = 'NYC' AND T2.Election_Cycle = 'Spring'; |
How many high schoolers are in each grade?
Schema:
- Highschooler(COUNT, ID, grade, name) | SELECT grade, COUNT(*) AS num_highschoolers FROM Highschooler GROUP BY grade; |
What are the names of wrestlers and their teams in elimination, ordered descending by days held?
Schema:
- Elimination(Benjam, Eliminated_By, Elimination_Move, T1, Team, Time)
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT T2.Name, T1.Team FROM Elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = CAST(T2.Wrestler_ID AS TEXT) ORDER BY T2.Days_held DESC NULLS LAST; |
Return the weights of entrepreneurs, ordered descending by amount of money requested.?
Schema:
- entrepreneur(COUNT, Company, Investor, Money_Requested)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T2.Weight FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Money_Requested DESC NULLS LAST; |
papers on Question Answering?
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 = 'Question Answering'; |
Which countries have either English or Dutch as an official language?
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 DISTINCT Name FROM (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" = 'english' AND IsOfficial = 't' UNION ALL SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" = 'dutch' AND IsOfficial = 't'); |
Show the most common headquarter for companies.?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Headquarters FROM company WHERE Headquarters IS NOT NULL GROUP BY Headquarters ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the names of wines produced before any wine from the Brander winery?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT Name FROM wine WHERE "Year" < (SELECT MIN("Year") FROM wine WHERE Winery = 'Brander'); |
How many instrument does the musician with last name "Heilo" use?
Schema:
- Instruments(COUNT, Instrument)
- Band(...) | SELECT COUNT(DISTINCT Instrument) AS num_instruments FROM Instruments AS T1 JOIN Band AS T2 ON T1.BandmateId = T2.Id WHERE T2.Lastname = 'Heilo'; |
Find job id and date of hire for those employees who was hired between November 5th, 2007 and July 5th, 2009.?
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 JOB_ID, HIRE_DATE FROM employees WHERE HIRE_DATE BETWEEN '2007-11-05' AND '2009-07-05'; |
Return the ids of templates that have the code PP or PPT.?
Schema:
- Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number) | SELECT Template_ID FROM Templates WHERE Template_Type_Code = 'PP' OR Template_Type_Code = 'PPT'; |
What are the numbers of all flights coming from Los Angeles?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT flno FROM flight WHERE origin = 'Los Angeles'; |
return me the papers by " H. V. Jagadish " after 2000 .?
Schema:
- writes(...)
- author(...)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT T3.title FROM writes AS T2 JOIN author AS T1 ON T2.aid = T1.aid JOIN publication AS T3 ON T2.pid = T3.pid WHERE T1.name = 'H. V. Jagadish' AND T3."year" > 2000; |
Show the name, open date, and organizer for all churches.?
Schema:
- church(Name, Open_Date, Organized_by) | SELECT Name, Open_Date, Organized_by FROM church; |
Return the names of singers who are from UK and released an English song.?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more)) | SELECT DISTINCT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.country = 'UK' AND T2.languages = 'english'; |
Find the dates of orders which belong to the customer named "Jeramie".?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Orders(customer_id, date_order_placed, order_id) | SELECT T2.date_order_placed FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = 'Jeramie'; |
Show all storm names except for those with at least two affected regions.?
Schema:
- storm(Damage_millions_USD, Dates_active, Name, Number_Deaths)
- affected_region(Region_id) | SELECT Name FROM storm WHERE Name NOT IN (SELECT T1.Name FROM storm AS T1 JOIN affected_region AS T2 ON T1.Storm_ID = T2.Storm_ID GROUP BY T1.Storm_ID, T1.Name HAVING COUNT(*) >= 2); |
Which country does customer with first name as Carole and last name as Bernhard lived in?
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))
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = 'Carole' AND T1.last_name = 'Bernhard'; |
which papers in eccv 2014 use ImageNet ?
Schema:
- paperDataset(...)
- dataset(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- venue(venueId, venueName) | SELECT DISTINCT T3.paperId FROM paperDataset AS T2 JOIN dataset AS T1 ON T2.datasetId = T1.datasetId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.datasetName = 'ImageNet' AND T3."year" = 2014 AND T4.venueName = 'eccv'; |
Return the id of the document with the fewest paragraphs.?
Schema:
- Paragraphs(COUNT, Document_ID, Other_Details, Paragraph_Text, T1) | SELECT Document_ID FROM Paragraphs WHERE Document_ID IS NOT NULL GROUP BY Document_ID ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
What are the first names of all students who are older than 20?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Fname FROM Student WHERE Age > 20; |
Find the number of different departments in each school whose number of different departments is less than 5.?
Schema:
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT COUNT(DISTINCT DEPT_NAME) AS num_departments, SCHOOL_CODE FROM DEPARTMENT WHERE SCHOOL_CODE IS NOT NULL GROUP BY SCHOOL_CODE HAVING COUNT(DISTINCT DEPT_NAME) < 5; |
List the name of singers in ascending order of net worth.?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT Name FROM singer ORDER BY Net_Worth_Millions ASC NULLS LAST; |
On average, how old are the members in the club "Hopkins Student Enterprises"?
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 = 'Hopkins Student Enterprises'; |
What is the name of the customer who has the most policies listed?
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_Policies(...) | SELECT T1.Customer_name FROM Customers AS T1 JOIN Customers_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID GROUP BY T1.Customer_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Which products have problems reported by both the staff named Lacey Bosco and the staff named Kenton Champlin?
Schema:
- Problems(date_problem_reported, problem_id)
- Product(product_id, product_name)
- Staff(COUNT, Name, Other_Details, date_joined_staff, date_left_staff, date_of_birth, email_address, first_name, gender, last_name, middle_name, nickname) | SELECT T2.product_name FROM Problems AS T1 JOIN Product AS T2 ON T1.product_id = T2.product_id JOIN Staff AS T3 ON T1.reported_by_staff_id = T3.staff_id JOIN (SELECT T1.product_id FROM Problems AS T1 JOIN Staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = 'Kenton' AND T2.staff_last_name = 'Champlin') AS T4 ON T2.product_id = T4.product_id WHERE T3.staff_first_name = 'Lacey' AND T3.staff_last_name = 'Bosco'; |
Show all company names and headquarters in the descending order of market value.?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Company, Headquarters FROM company ORDER BY Market_Value DESC NULLS LAST; |
What are the reigns and days held of all wrestlers?
Schema:
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT Reign, Days_held FROM wrestler; |
Count the number of wrestlers.?
Schema:
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT COUNT(*) AS num_wrestlers FROM wrestler; |
For each director, what are the titles and ratings for all the movies they reviewed?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year) | SELECT T2.title, T1.stars, T2.director, AVG(T1.stars) AS avg_stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE director IS NOT NULL GROUP BY director, T2.title, T1.stars, T2.director; |
Find the day in which the difference between the max temperature and min temperature was the smallest. Also report the difference.?
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", max_temperature_f - min_temperature_f AS diff FROM weather ORDER BY max_temperature_f - min_temperature_f ASC NULLS LAST LIMIT 1; |
what state has the least 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 is the shop name corresponding to the shop that opened in the most recent year?
Schema:
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT Shop_Name FROM shop ORDER BY Open_Year DESC NULLS LAST LIMIT 1; |
What are the distinct visit dates?
Schema:
- Visits(Visit_Date) | SELECT DISTINCT Visit_Date FROM Visits; |
Show different types of ships and the average tonnage of ships of each type.?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT Type, AVG(Tonnage) AS avg_tonnage FROM ship GROUP BY Type; |
What is the description of the treatment type that costs the least money in total?
Schema:
- Treatment_Types(...)
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT T1.treatment_type_description FROM Treatment_Types AS T1 JOIN Treatments AS T2 ON T1.treatment_type_code = T2.treatment_type_code GROUP BY T1.treatment_type_code, T1.treatment_type_description ORDER BY SUM(cost_of_treatment) ASC NULLS LAST LIMIT 1; |
Show the name for regions not affected.?
Schema:
- region(Label, Region_code, Region_name)
- affected_region(Region_id) | SELECT Region_name FROM region WHERE Region_id NOT IN (SELECT Region_id FROM affected_region); |
display job ID for those jobs that were done by two or more for more than 300 days.?
Schema:
- job_history(EMPLOYEE_ID, END_DATE, JOB_ID) | SELECT JOB_ID FROM job_history WHERE DATEDIFF(DAY, START_DATE, END_DATE) > 300 AND JOB_ID IS NOT NULL GROUP BY JOB_ID HAVING COUNT(*) >= 2; |
Find the names of the products with length smaller than 3 or height greater than 5.?
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 TRY_CAST("length" AS INT) < 3 OR TRY_CAST(width AS INT) > 5; |
Find out the first name and last name of staff lived in city Damianfort.?
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 T2.first_name, T2.last_name FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T1.city = 'Damianfort'; |
Show the stadium name and the number of concerts in each stadium.?
Schema:
- concert(COUNT, Year)
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1) | SELECT T2.Name, COUNT(*) AS num_concerts FROM concert AS T1 JOIN stadium AS T2 ON T1.Stadium_ID = T2.Stadium_ID GROUP BY T1.Stadium_ID, T2.Name; |
List the names of all winners who played in both 2013 and 2016.?
Schema:
- matches_(COUNT, T1, loser_age, loser_name, minutes, tourney_name, winner_age, winner_hand, winner_name, winner_rank, winner_rank_points, year) | SELECT DISTINCT T1.winner_name FROM matches_ AS T1 JOIN matches_ AS T2 ON T1.winner_name = T2.winner_name WHERE T1."year" = 2013 AND T2."year" = 2016; |
What is the city with the most customers?
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))
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the title of the newest movie?
Schema:
- Movie(T1, director, title, year) | SELECT title FROM Movie WHERE "year" = (SELECT MAX("year") FROM Movie); |
What is the total balance of savings accounts not belonging to someone with the name Brown?
Schema:
- ACCOUNTS(name)
- SAVINGS(SAV, balance) | SELECT SUM(T2.balance) AS total_balance FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid WHERE T1.name != 'Brown'; |
what is the biggest river in texas?
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 WHERE traverse = 'texas') AND traverse = 'texas'; |
in which state does the highest point in usa exist?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT state_name FROM highlow WHERE highest_elevation = (SELECT MAX(highest_elevation) FROM highlow); |
List all region names in alphabetical order.?
Schema:
- region(Label, Region_code, Region_name) | SELECT Region_name FROM region ORDER BY Region_name ASC NULLS LAST; |
What are the email, cell phone and home phone of each professional?
Schema:
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street) | SELECT email_address, cell_number, home_phone FROM Professionals; |
What is the primary conference of the school that has the lowest acc percent score in the competition?
Schema:
- university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School)
- basketball_match(ACC_Percent, All_Home, School_ID, Team_Name) | SELECT T1.Primary_conference FROM university AS T1 JOIN basketball_match AS T2 ON T1.School_ID = T2.School_ID ORDER BY T2.ACC_Percent ASC NULLS LAST LIMIT 1; |
List the names of all distinct wines in alphabetical order.?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT DISTINCT Name FROM wine ORDER BY Name ASC NULLS LAST; |
what is the most cited paper of ohad shamir ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...)
- writes(...)
- author(...) | SELECT DISTINCT T4.citedPaperId, COUNT(T4.citedPaperId) AS num_citations FROM paper AS T3 JOIN cite AS T4 ON T3.paperId = T4.citedPaperId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'ohad shamir' GROUP BY T4.citedPaperId ORDER BY num_citations DESC NULLS LAST; |
what is the average population per square km in pennsylvania?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT population / area AS population_per_square_km FROM state WHERE state_name = 'pennsylvania'; |
return me the papers by " H. V. Jagadish " on VLDB conference after 2000 .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- conference(homepage, name)
- writes(...)
- author(...) | SELECT T4.title 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 T1.name = 'H. V. Jagadish' AND T2.name = 'VLDB' AND T4."year" > 2000; |
What is the author of the submission with the highest score?
Schema:
- submission(Author, COUNT, College, Scores) | SELECT Author FROM submission ORDER BY Scores DESC NULLS LAST LIMIT 1; |
Find all Sci-Fi produced in year 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; |
In what year was " Benedict Cumberbatch " born?
Schema:
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT birth_year FROM actor WHERE name = 'Benedict Cumberbatch'; |
When was the last time Mary Crainie published a paper ?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT MAX(T3."year") AS max_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 = 'Mary Crainie'; |
return me the total citations of all the 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) | SELECT SUM(T2.citation_num) AS total_citations FROM publication AS T2 JOIN conference AS T1 ON T2.cid = CAST(T1.cid AS TEXT) WHERE T1.name = 'VLDB'; |
Find the distinct ages of students who have secretary votes in the fall election cycle.?
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.Age FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = 'Fall'; |
What are the name, latitude, and city of the station with the lowest latitude?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT name, lat, city FROM station ORDER BY lat ASC NULLS LAST LIMIT 1; |
return me all the keywords in Databases area .?
Schema:
- domain(...)
- domain_keyword(...)
- keyword(keyword) | SELECT T1.keyword FROM domain AS T3 JOIN domain_keyword AS T2 ON T3.did = T2.did JOIN keyword AS T1 ON T1.kid = T2.kid WHERE T3.name = 'Databases'; |
Show the names of customers who have at least 2 mailshots with outcome code 'Order'.?
Schema:
- Mailshot_Customers(outcome_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 T2.customer_name FROM Mailshot_Customers AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE outcome_code = 'Order' GROUP BY T1.customer_id, T2.customer_name HAVING COUNT(*) >= 2; |
Find the first names of professors who are teaching more than one class.?
Schema:
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) | SELECT T2.EMP_FNAME FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM GROUP BY T1.PROF_NUM, T2.EMP_FNAME HAVING COUNT(*) > 1; |
Find all Bars reviewed by Patrick?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state)
- review(i_id, rank, rating, text)
- user_(name) | SELECT T1."name" FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN review AS T3 ON T3.business_id = T1.business_id JOIN user_ AS T4 ON T4.user_id = T3.user_id WHERE T2.category_name = 'Bars' AND T4."name" = 'Patrick'; |
What are the names of ships that are commanded by both captains with the rank of Midshipman and captains with the rank of Lieutenant?
Schema:
- Ship(Built_Year, COUNT, Class, Flag, Name, Type)
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT T1.Name FROM Ship AS T1 JOIN captain AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2."Rank" = 'Midshipman' AND T1.Name IN (SELECT T1.Name FROM Ship AS T1 JOIN captain AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2."Rank" = 'Lieutenant'); |
What are the names of all players that got more than the average number of points?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT name FROM player WHERE Points > (SELECT AVG(Points) FROM player); |
Find the name of the customers who use the most frequently used 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 customer_name FROM Customers WHERE payment_method = (SELECT payment_method FROM Customers WHERE payment_method IS NOT NULL GROUP BY payment_method ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1); |
Find names of all students who took some course and got A or C.?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
- ENROLL(...) | SELECT T1.STU_FNAME, T1.STU_LNAME FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM WHERE T2.ENROLL_GRADE = 'C' OR T2.ENROLL_GRADE = 'A'; |
Which faculty members are playing either Canoeing or Kayaking? Tell me their last names.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
- Faculty_Participates_in(FacID)
- Activity(activity_name) | SELECT DISTINCT T1.Lname FROM Faculty AS T1 JOIN Faculty_Participates_in AS T2 ON T1.FacID = T2.FacID JOIN Activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'; |
Return the name of the airport with code 'AKO'.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT AirportName FROM airports WHERE AirportCode = 'AKO'; |
Count the 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 COUNT(*) AS num_matches FROM matches_; |
how many places for chinese food 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'; |
How many citation noah a smith has ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...)
- writes(...)
- author(...) | SELECT DISTINCT COUNT(T4.citedPaperId) AS num_citations FROM paper AS T3 JOIN cite AS T4 ON T3.paperId = T4.citedPaperId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'noah a smith'; |
What are the distinct first names for students with a grade point of 3.8 or above in at least one course?
Schema:
- Enrolled_in(Fname, Grade, LName, StuID, T2, T3, gradepoint) | SELECT DISTINCT T3.Fname FROM Enrolled_in AS T1, Gradeconversion AS T2, Student AS T3 WHERE T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID AND T2.gradepoint >= 3.8; |
Return all the information for all employees without any department 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 * FROM employees WHERE DEPARTMENT_ID IS NULL; |
List the total number of horses on farms in ascending order.?
Schema:
- farm(Cows, Working_Horses) | SELECT Total_Horses FROM farm ORDER BY Total_Horses ASC NULLS LAST; |
Which team had the least number of attendances in home games in 1980?
Schema:
- home_game(attendance, year)
- team(Name) | SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1."year" = 1980 ORDER BY T1.attendance ASC NULLS LAST LIMIT 1; |
return me the number of papers written by " H. V. Jagadish " , " Yunyao Li " , and " Cong Yu " .?
Schema:
- writes(...)
- author(...)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT COUNT(DISTINCT T7.title) AS num_papers FROM writes AS T4 JOIN author AS T2 ON T4.aid = T2.aid JOIN publication AS T7 ON T4.pid = T7.pid JOIN writes AS T5 ON T5.pid = T7.pid JOIN writes AS T6 ON T6.pid = T7.pid JOIN author AS T1 ON T5.aid = T1.aid JOIN author AS T3 ON T6.aid = T3.aid WHERE T2.name = 'Cong Yu' AND T1.name = 'H. V. Jagadish' AND T3.name = 'Yunyao Li'; |
Show the names of companies and of employees.?
Schema:
- employment(...)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT T3.Name, T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID; |
Count the number of players who enter hall of fame for each year.?
Schema:
- hall_of_fame(yearid) | SELECT yearid, COUNT(*) AS num_players FROM hall_of_fame GROUP BY yearid; |
give me a good restaurant 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; |
Find the forename and surname of drivers whose nationality is German?
Schema:
- drivers(forename, nationality, surname) | SELECT forename, surname FROM drivers WHERE nationality = 'German'; |
How many rooms whose capacity is less than 50 does the Lamberton building have?
Schema:
- classroom(building, capacity, room_number) | SELECT COUNT(*) AS num_rooms FROM classroom WHERE building = 'Lamberton' AND capacity < 50; |
For each position, what is the maximum number of hours for students who spent more than 1000 hours training?
Schema:
- Player(HS, pName, weight, yCard)
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT MAX(T1.HS) AS max_hours, pPos FROM Player AS T1 JOIN Tryout AS T2 ON T1.pID = T2.pID WHERE T1.HS > 1000 GROUP BY T2.pPos; |
What is the name of the airport that is the destination of the most number of routes that start in China?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
- routes(...) | SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE T1.country = 'China' GROUP BY T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Sort the each workshop in alphabetical order of the venue. Return the date and venue of each workshop.?
Schema:
- workshop(Date, Venue) | SELECT "Date", Venue FROM workshop ORDER BY Venue ASC NULLS LAST; |
What is the date and id of the transcript with at least 2 courses listed?
Schema:
- Transcript_Contents(student_course_id)
- Transcripts(other_details, transcript_date) | SELECT T2.transcript_date, T1.transcript_id FROM Transcript_Contents AS T1 JOIN Transcripts AS T2 ON T1.transcript_id = T2.transcript_id GROUP BY T1.transcript_id, T2.transcript_date HAVING COUNT(*) >= 2; |
What is the average age for each city and what are those cities?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT AVG(Age) AS avg_age, city_code FROM Student GROUP BY city_code; |
What are the line 1 and average monthly rentals of all student addresses?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- Student_Addresses(monthly_rental) | SELECT T1.line_1, AVG(T2.monthly_rental) AS avg_monthly_rental FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id GROUP BY T2.address_id, T1.line_1; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.