question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
Return the record companies of orchestras, sorted descending by the years in which they were founded.?
Schema:
- orchestra(COUNT, Major_Record_Format, Record_Company, Year_of_Founded) | SELECT Record_Company FROM orchestra ORDER BY Year_of_Founded DESC NULLS LAST; |
Find the names of all patients who have an undergoing treatment and are staying in room 111.?
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 names of all players who have a crossing score higher than 90 and prefer their right foot.?
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.crossing > 90 AND T2.preferred_foot = 'right'; |
how many countries are in Asia?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT COUNT(*) AS num_countries FROM country WHERE Continent = 'Asia'; |
Find the name of the courses that do not have any prerequisite?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- prereq(...) | SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq); |
Show the names and ages of editors and the theme of journals for which they serve on committees, in ascending alphabetical order of theme.?
Schema:
- journal_committee(...)
- editor(Age, COUNT, Name)
- journal(Theme, homepage, name) | SELECT T2.Name, T2.Age, T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID ORDER BY T3.Theme ASC NULLS LAST; |
Find all the locations whose names contain the word "film".?
Schema:
- Locations(Address, Location_Name, Other_Details) | SELECT Location_Name FROM Locations WHERE Location_Name LIKE '%film%'; |
List the venues of debates in ascending order of the number of audience.?
Schema:
- debate(Date, Venue) | SELECT Venue FROM debate ORDER BY Num_of_Audience ASC NULLS LAST; |
What papers were published at CVPR '16 about Class consistent multi-modal fusion with binary features applied to RGB-D Object Dataset ?
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 = 'RGB-D Object Dataset' AND T3.title = 'Class consistent multi-modal fusion with binary features' AND T3."year" = 2016 AND T4.venueName = 'CVPR'; |
what topics does oren etzioni write about most ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- paperKeyphrase(...)
- writes(...)
- author(...) | SELECT DISTINCT COUNT(T2.keyphraseId) AS num_keyphrases, T2.keyphraseId FROM paper AS T3 JOIN paperKeyphrase AS T2 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 = 'oren etzioni' GROUP BY T2.keyphraseId ORDER BY num_keyphrases DESC NULLS LAST; |
return me the authors who have papers in VLDB conference before 2002 after 1995 .?
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' AND T4."year" < 2002 AND T4."year" > 1995; |
What is the product ID of the most frequently ordered item on invoices?
Schema:
- Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code) | SELECT Product_ID FROM Invoices WHERE Product_ID IS NOT NULL GROUP BY Product_ID ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
List the names of people that are not perpetrators.?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- perpetrator(Country, Date, Injured, Killed, Location, Year) | SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM perpetrator); |
What are the names of poker players whose earnings is higher than 300000?
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 T1.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Earnings > 300000; |
What is the episode for the TV series named "Sky Radio"?
Schema:
- TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name)
- TV_series(Air_Date, Episode, Rating, Share, Weekly_Rank) | SELECT T2.Episode FROM TV_Channel AS T1 JOIN TV_series AS T2 ON T1.id = T2.Channel WHERE T1.series_name = 'Sky Radio'; |
Return the positions of players on the team Ryley Goldner.?
Schema:
- match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team)
- team(Name) | SELECT T1."Position" FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = 'Ryley Goldner'; |
What are the names of movies that get 3 star and 4 star?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year) | SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars IN (3, 4) GROUP BY T2.title HAVING COUNT(DISTINCT T1.stars) = 2; |
How many people reviewed " Bistro Di Napoli " in 2015 ?
Schema:
- review(i_id, rank, rating, text)
- business(business_id, city, full_address, name, rating, review_count, state)
- user_(name) | SELECT COUNT(DISTINCT T3.name) AS num_users FROM review AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN user_ AS T3 ON T3.user_id = T2.user_id WHERE T1.name = 'Bistro Di Napoli' AND T2."year" = 2015; |
What are the ids of the problems reported before the date of any problem reported by Lysanne Turcotte?
Schema:
- Problems(date_problem_reported, problem_id)
- 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.problem_id FROM Problems AS T1 JOIN Staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE date_problem_reported < (SELECT MIN(date_problem_reported) FROM Problems AS T3 JOIN Staff AS T4 ON T3.reported_by_staff_id = T4.staff_id WHERE T4.staff_first_name = 'Lysanne' AND T4.staff_last_name = 'Turcotte'); |
How many classes are held in each department?
Schema:
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
- COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE) | SELECT COUNT(*) AS num_classes, DEPT_CODE FROM CLASS AS T1 JOIN COURSE AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY DEPT_CODE; |
How many customers are there?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT COUNT(*) AS num_customers FROM Customers; |
give me some restaurants in alameda ?
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 = 'alameda'; |
Find the number of students whose age is older than the average age for each gender.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_students, Sex FROM Student WHERE Age > (SELECT AVG(Age) FROM Student) GROUP BY Sex; |
who published the most at chi?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT COUNT(DISTINCT T2.paperId) AS num_papers, 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 T3.venueName = 'chi' GROUP BY T1.authorId ORDER BY num_papers DESC NULLS LAST; |
Question Answering research papers?
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'; |
What is detail of the student who most recently registered course?
Schema:
- Student_Course_Registrations(COUNT, student_id)
- 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 T2.student_details FROM Student_Course_Registrations AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.registration_date DESC NULLS LAST LIMIT 1; |
What is the id, line 1, and line 2 of the address with the most students?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- 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 T1.address_id, T1.line_1, T1.line_2 FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.current_address_id GROUP BY T1.address_id, T1.line_1, T1.line_2 ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Please show the themes of competitions with host cities having populations larger than 1000.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- farm_competition(Hosts, Theme, Year) | SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID WHERE T1.Population > 1000; |
What are the names of entrepreneurs?
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.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID; |
Who wrote on the topic of Bacterial Wilt in 2016 ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T3.authorId FROM paperKeyphrase AS T1 JOIN keyphrase AS T2 ON T1.keyphraseId = T2.keyphraseId JOIN paper AS T4 ON T4.paperId = T1.paperId JOIN writes AS T3 ON T3.paperId = T4.paperId JOIN author AS T5 ON T3.authorId = T5.authorId WHERE T2.keyphraseName = 'Bacterial Wilt' AND T4."year" = 2016; |
What are the template ids of any templates used in more than a single document?
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 Template_ID FROM Documents WHERE Template_ID IS NOT NULL GROUP BY Template_ID HAVING COUNT(*) > 1; |
where are some restaurants good for french 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 T1.food_type = 'french' AND T1.rating > 2.5; |
What products are sold at the 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'; |
Select the name and price of all products with a price larger than or equal to $180, and sort first by price (in descending order), and then by name (in ascending order).?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT Name, Price FROM Products WHERE Price >= 180 ORDER BY Price DESC, Name ASC NULLS LAST; |
number of ACL papers by author?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT COUNT(T2.paperId) AS num_papers, 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 T3.venueName = 'ACL' GROUP BY T1.authorId; |
What are the names of ships, ordered by year they were built and their class?
Schema:
- Ship(Built_Year, COUNT, Class, Flag, Name, Type) | SELECT Name FROM Ship ORDER BY Built_Year, Class ASC NULLS LAST; |
display the country ID and number of cities for each country.?
Schema:
- locations(COUNTRY_ID) | SELECT COUNTRY_ID, COUNT(*) AS num_cities FROM locations GROUP BY COUNTRY_ID; |
How many faculty is there in total in the year of 2002?
Schema:
- faculty(Faculty) | SELECT SUM(Faculty) AS total_faculty FROM faculty WHERE "Year" = 2002; |
In which buildings are there at least ten professors?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT Building FROM Faculty WHERE "Rank" = 'Professor' AND Building IS NOT NULL GROUP BY Building HAVING COUNT(*) >= 10; |
Among the cars that do not have the minimum horsepower , what are the make ids and names of all those with less than 4 cylinders ?
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 < 4; |
Find the average rating star for each movie that received at least 2 ratings.?
Schema:
- Rating(Rat, mID, rID, stars) | SELECT mID, AVG(stars) AS avg_stars FROM Rating WHERE mID IS NOT NULL GROUP BY mID HAVING COUNT(*) >= 2; |
What are the names of regions that were affected by the storm in which the most people died?
Schema:
- affected_region(Region_id)
- region(Label, Region_code, Region_name)
- storm(Damage_millions_USD, Dates_active, Name, Number_Deaths) | SELECT T2.Region_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 ORDER BY T3.Number_Deaths DESC NULLS LAST LIMIT 1; |
Find the the names of the tourist attractions that the tourist named Alison visited but Rosalind did not visit.?
Schema:
- Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more)) | SELECT T1.Name FROM Tourist_Attractions AS T1, Visitors AS T2, Visits AS T3 WHERE T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID AND T2.Tourist_Details = 'Alison' AND T1.Name NOT IN (SELECT T1.Name FROM Tourist_Attractions AS T1, Visitors AS T2, Visits AS T3 WHERE T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID AND T2.Tourist_Details = 'Rosalind'); |
Find all airlines that have at least 10 flights.?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT T1.Airline FROM airlines AS T1 JOIN flights AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline HAVING COUNT(*) > 10; |
return me the papers by " H. V. Jagadish " on PVLDB with more than 200 citations .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name)
- writes(...)
- author(...) | SELECT T4.title FROM publication AS T4 JOIN journal AS T2 ON T4.jid = T2.jid JOIN writes AS T3 ON T3.pid = T4.pid JOIN author AS T1 ON T3.aid = T1.aid WHERE T1.name = 'H. V. Jagadish' AND T2.name = 'PVLDB' AND T4.citation_num > 200; |
What are the names of countains that no climber has climbed?
Schema:
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
- climber(Country, K, Name, Points) | SELECT Name FROM mountain WHERE Mountain_ID NOT IN (SELECT Mountain_ID FROM climber); |
Return the country codes for countries that do not speak English.?
Schema:
- countrylanguage(COUNT, CountryCode, Engl, Language) | SELECT CountryCode FROM countrylanguage WHERE CountryCode NOT IN (SELECT CountryCode FROM countrylanguage WHERE "Language" = 'English'); |
Count the number of Professors who have office in building NEB.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT COUNT(*) AS num_professors FROM Faculty WHERE "Rank" = 'Professor' AND Building = 'NEB'; |
datasets for semantic parsing?
Schema:
- paperDataset(...)
- dataset(...)
- paperKeyphrase(...)
- keyphrase(...) | SELECT DISTINCT T2.datasetId FROM paperDataset AS T3 JOIN dataset AS T2 ON T3.datasetId = T2.datasetId JOIN paperKeyphrase AS T1 ON T1.paperId = T3.paperId JOIN keyphrase AS T4 ON T1.keyphraseId = T4.keyphraseId WHERE T4.keyphraseName = 'semantic parsing'; |
Find the names of stores whose number products is more than the average number of products.?
Schema:
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT Name FROM shop WHERE Number_products > (SELECT AVG(Number_products) FROM shop); |
What are the ids of the two department store chains with the largest number of department stores?
Schema:
- Department_Stores(COUNT, dept_store_chain_id) | SELECT dept_store_chain_id FROM Department_Stores WHERE dept_store_chain_id IS NOT NULL GROUP BY dept_store_chain_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 2; |
Find the major that is studied by the largest number of students.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Major FROM Student WHERE Major IS NOT NULL GROUP BY Major ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Return the city with the customer type code "Good Credit Rating" that had the fewest 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)) | SELECT town_city FROM Customers WHERE customer_type_code = 'Good Credit Rating' AND town_city IS NOT NULL GROUP BY town_city ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
give me all the states of usa?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM state WHERE country_name = 'united states'; |
What are the personal names and family names of the students? Sort the result in alphabetical order of the family name.?
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 personal_name, family_name FROM Students ORDER BY family_name ASC NULLS LAST; |
For each race name, What is the maximum fastest lap speed for races after 2004 ordered by year?
Schema:
- races(date, name)
- results(...) | SELECT MAX(TRY_CAST(T2.fastestLapSpeed AS DOUBLE)) AS max_speed, T1.name, T1."year" FROM races AS T1 JOIN results AS T2 ON T1.raceId = T2.raceId WHERE T1."year" > 2014 GROUP BY T1.name, T1."year" ORDER BY T1."year" ASC NULLS LAST; |
Show the carriers of devices in stock at more than one shop.?
Schema:
- stock(Quantity)
- device(COUNT, Carrier, Software_Platform) | SELECT T2.Carrier FROM stock AS T1 JOIN device AS T2 ON T1.Device_ID = T2.Device_ID GROUP BY T1.Device_ID, T2.Carrier HAVING COUNT(*) > 1; |
What campuses are located in Northridge, Los Angeles or in San Francisco, San Francisco?
Schema:
- Campuses(Campus, County, Franc, Location) | SELECT Campus FROM Campuses WHERE (Location = 'Northridge' AND County = 'Los Angeles') OR (Location = 'San Francisco' AND County = 'San Francisco'); |
List all open years when at least two shops are opened.?
Schema:
- branch(Address_road, City, Name, Open_year, membership_amount) | SELECT Open_year FROM branch WHERE Open_year IS NOT NULL GROUP BY Open_year HAVING COUNT(*) >= 2; |
List the ids of all distinct orders ordered by placed date.?
Schema:
- Orders(customer_id, date_order_placed, order_id) | SELECT order_id FROM Orders WHERE order_id IS NOT NULL AND date_order_placed IS NOT NULL GROUP BY order_id, date_order_placed ORDER BY date_order_placed ASC NULLS LAST; |
What is the code of airport that has fewest number of flights?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT T1.AirportCode FROM airports AS T1 JOIN flights AS T2 ON T1.AirportCode = T2.DestAirport OR T1.AirportCode = T2.SourceAirport GROUP BY T1.AirportCode ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
What is the hometown of the youngest teacher?
Schema:
- teacher(Age, COUNT, D, Hometown, Name) | SELECT Hometown FROM teacher ORDER BY Age ASC NULLS LAST LIMIT 1; |
What are the headquarters and industries of all companies?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Headquarters, Industry FROM company; |
What is the average amount due for all the payments?
Schema:
- Payments(Amount_Payment, COUNT, Date_Payment_Made, Payment_ID, Payment_Method_Code, V, amount_due, amount_paid, payment_date, payment_type_code) | SELECT AVG(amount_due) AS avg_amount_due FROM Payments; |
List the names of the dogs of the rarest breed and the treatment dates of them.?
Schema:
- Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT T1.name, T2.date_of_treatment FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id = T2.dog_id WHERE T1.breed_code = (SELECT breed_code FROM Dogs WHERE breed_code IS NOT NULL GROUP BY breed_code ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1); |
Find all actors who acted in the same movie as " Tom Hanks "?
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 T4 JOIN actor AS T1 ON T4.aid = T1.aid JOIN movie AS T5 ON T5.mid = T4.msid JOIN cast_ AS T3 ON T5.mid = T3.msid JOIN actor AS T2 ON T3.aid = T2.aid WHERE T2.name = 'Tom Hanks'; |
What are the countries that have cartoons on TV that were written by Todd Casey?
Schema:
- TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name)
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by) | SELECT T1.Country FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T2.Written_by = 'Todd Casey'; |
How many project members were leaders or started working before '1989-04-24 23:51:54'?
Schema:
- Project_Staff(COUNT, date_from, date_to, role_code) | SELECT COUNT(*) AS num_members FROM Project_Staff WHERE role_code = 'leader' OR date_from < '1989-04-24 23:51:54'; |
Show names for all aircrafts of which John Williams has certificates.?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
- certificate(eid)
- aircraft(Description, aid, d, distance, name) | SELECT T3.name FROM employee AS T1 JOIN certificate AS T2 ON T1.eid = T2.eid JOIN aircraft AS T3 ON T3.aid = T2.aid WHERE T1.name = 'John Williams'; |
Find the number of users who posted some tweets.?
Schema:
- tweets(I, tweet_text, uid) | SELECT COUNT(DISTINCT uid) AS num_users FROM tweets; |
Find the names of schools that have more than one donator with donation amount above 8.5.?
Schema:
- endowment(School_id, amount, donator_name)
- School(County, Enrollment, Location, Mascot, School_name) | SELECT T2.School_name FROM endowment AS T1 JOIN School AS T2 ON CAST(T1.School_id AS TEXT) = T2.School_id WHERE T1.amount > 8.5 GROUP BY T1.School_id, T2.School_name HAVING COUNT(*) > 1; |
How many employees are living in Canada?
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 COUNT(*) AS num_employees FROM employees WHERE country = 'Canada'; |
return me the paper after 2000 with more than 200 citations .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT title FROM publication WHERE citation_num > 200 AND "year" > 2000; |
Find the name of the nurse who has the largest number of appointments.?
Schema:
- Nurse(Name)
- Appointment(AppointmentID, Start) | SELECT T1.Name FROM Nurse AS T1 JOIN Appointment AS T2 ON T1.EmployeeID = T2.PrepNurse GROUP BY T1.EmployeeID, T1.Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many distinct artists do the volumes associate to?
Schema:
- volume(Artist_ID, Issue_Date, Song, Weeks_on_Top) | SELECT COUNT(DISTINCT Artist_ID) AS num_artists FROM volume; |
What is the first name of the students who are in age 20 to 25 and living in PHL city?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Fname FROM Student WHERE city_code = 'PHL' AND Age BETWEEN 20 AND 25; |
Which complaint status has more than 3 records on file?
Schema:
- Complaints(complaint_status_code, complaint_type_code) | SELECT complaint_status_code FROM Complaints WHERE complaint_status_code IS NOT NULL GROUP BY complaint_status_code HAVING COUNT(*) > 3; |
What are the names of the different artists from Bangladesh who never received a rating higher than a 7?
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 artist_name FROM artist WHERE country = 'Bangladesh' AND artist_name NOT IN (SELECT artist_name FROM song WHERE rating > 7); |
Show the album names and ids for albums that contain tracks with unit price bigger than 1.?
Schema:
- Album(Title)
- Track(Milliseconds, Name, UnitPrice) | SELECT T1.Title, T2.AlbumId FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T1.Title, T2.AlbumId; |
Show the names of artworks in ascending order of the year they are nominated in.?
Schema:
- nomination(...)
- artwork(COUNT, Name, Type)
- festival_detail(Chair_Name, Festival_Name, Location, T1, Year) | SELECT T2.Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID ORDER BY T3."Year" ASC NULLS LAST; |
Show all movie titles, years, and directors, ordered by budget.?
Schema:
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) | SELECT Title, "Year", Director FROM movie ORDER BY Budget_million ASC NULLS LAST; |
What are the ids of stations that are located in San Francisco and have average bike availability above 10.?
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 id FROM (SELECT id FROM station WHERE city = 'San Francisco') T1, (SELECT station_id FROM status WHERE station_id IS NOT NULL GROUP BY station_id HAVING AVG(bikes_available) > 10) AS T2 WHERE T1.id = T2.station_id; |
How many times the number of adults and kids staying in a room reached the maximum capacity of the room?
Schema:
- Reservations(Adults, CheckIn, FirstName, Kids, LastName)
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT COUNT(*) AS num_rooms FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T2.maxOccupancy = T1.Adults + T1.Kids; |
Give the name of the department with the lowest budget.?
Schema:
- department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name) | SELECT dept_name FROM department ORDER BY budget ASC NULLS LAST LIMIT 1; |
List all the salary values players received in 2010 and 2001.?
Schema:
- salary(salary) | SELECT DISTINCT salary FROM (SELECT salary FROM salary WHERE "year" = 2010 UNION ALL SELECT salary FROM salary WHERE "year" = 2001); |
What are the different template type codes?
Schema:
- Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number) | SELECT DISTINCT Template_Type_Code FROM Templates; |
Which professionals have done at least two treatments? List the professional's id, role, and first name.?
Schema:
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street)
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT T1.professional_id, T1.role_code, T1.first_name FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id, T1.role_code, T1.first_name HAVING COUNT(*) >= 2; |
which pilot is in charge of the most number of flights?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT Pilot FROM flight WHERE Pilot IS NOT NULL GROUP BY Pilot ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the distinct ids of customers who made an order after any order that was Cancelled?
Schema:
- Customer_Orders(customer_id, order_date, order_id, order_shipping_charges) | SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date > (SELECT MIN(order_date) FROM Customer_Orders WHERE order_status_code = 'Cancelled'); |
What is the date of enrollment of the course named "Spanish"?
Schema:
- Courses(course_description, course_name)
- Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) | SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'Spanish'; |
Please show the countries and the number of climbers from each country.?
Schema:
- climber(Country, K, Name, Points) | SELECT Country, COUNT(*) AS num_climbers FROM climber GROUP BY Country; |
Show the starting years shared by technicians from team "CLE" and "CWS".?
Schema:
- technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name) | SELECT DISTINCT T1.Starting_Year FROM (SELECT Starting_Year FROM technician WHERE Team = 'CLE') AS T1 JOIN (SELECT Starting_Year FROM technician WHERE Team = 'CWS') AS T2 ON T1.Starting_Year = T2.Starting_Year; |
what is the highest mountain in the us?
Schema:
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more)) | SELECT mountain_name FROM mountain WHERE mountain_altitude = (SELECT MAX(mountain_altitude) FROM mountain); |
Find the checking balance and saving balance in the Brown’s account.?
Schema:
- ACCOUNTS(name)
- CHECKING(balance)
- SAVINGS(SAV, balance) | SELECT T2.balance AS checking_balance, T3.balance AS saving_balance FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid WHERE T1.name = 'Brown'; |
Find the patient who has the most recent undergoing treatment?
Schema:
- Undergoes(DateUndergoes, Patient) | SELECT Patient FROM Undergoes ORDER BY DateUndergoes ASC NULLS LAST LIMIT 1; |
which is the lowest point of the states that the mississippi runs through?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT lowest_point FROM highlow WHERE state_name IN (SELECT traverse FROM river WHERE river_name = 'mississippi') ORDER BY lowest_elevation ASC NULLS LAST LIMIT 1; |
List all information about courses sorted by credits in the ascending order.?
Schema:
- Course(CName, Credits, Days) | SELECT * FROM Course ORDER BY Credits ASC NULLS LAST; |
How many students are there?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_students FROM Student; |
Find the name of customers who did not pay with Cash.?
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 != 'Cash'; |
What is the name and directors of all the cartoons that are ordered by air date?
Schema:
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by) | SELECT Title, Directed_by FROM Cartoon ORDER BY Original_air_date ASC NULLS LAST; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.