question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
What are the names and buildings of the deparments, sorted by budget descending?
Schema:
- department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name) | SELECT dept_name, building FROM department ORDER BY budget DESC NULLS LAST; |
What are the ids and names of all start stations that were the beginning of at least 200 trips?
Schema:
- trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code) | SELECT start_station_id, start_station_name FROM trip WHERE start_station_id IS NOT NULL AND start_station_name IS NOT NULL GROUP BY start_station_id, start_station_name HAVING COUNT(*) >= 200; |
What is the name of the institution the author "Katsuhiro Ueno" belongs to?
Schema:
- Authors(fname, lname)
- Authorship(...)
- Inst(...) | SELECT DISTINCT T3.name FROM Authors AS T1 JOIN Authorship AS T2 ON T1.authID = T2.authID JOIN Inst AS T3 ON T2.instID = T3.instID WHERE T1.fname = 'Katsuhiro' AND T1.lname = 'Ueno'; |
Show all the buildings that have at least 10 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; |
List the names and scores of all wines.?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT Name, Score FROM wine; |
What is the composer who created the track "Fast As a Shark"?
Schema:
- tracks(composer, milliseconds, name, unit_price) | SELECT composer FROM tracks WHERE name = 'Fast As a Shark'; |
return me the number of the organizations .?
Schema:
- organization(continent, homepage, name) | SELECT COUNT(DISTINCT name) AS num_organizations FROM organization; |
What are the full names of customers with the account name 900?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT T2.customer_first_name, T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = '900'; |
pldi papers in 2015?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T1.paperId FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T1."year" = 2015 AND T2.venueName = 'pldi'; |
Return the names of friends of the high school student Kyle.?
Schema:
- Friend(student_id)
- Highschooler(COUNT, ID, grade, name) | SELECT T3.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID JOIN Highschooler AS T3 ON T1.friend_id = T3.ID WHERE T2.name = 'Kyle'; |
How many airports are there per city in the United States? Order the cities by decreasing number of airports.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT COUNT(*) AS num_airports, city FROM airports WHERE country = 'United States' AND city IS NOT NULL GROUP BY city ORDER BY num_airports DESC NULLS LAST; |
Find the ids of the nurses who are on call in block floor 1 and block code 1.?
Schema:
- On_Call(BlockCode, BlockFloor, Nurse) | SELECT Nurse FROM On_Call WHERE BlockFloor = 1 AND BlockCode = 1; |
What is the full name of the employee who has the most customers?
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))
- customers(Mart, city, company, country, email, first_name, last_name, phone, state) | SELECT T1.first_name, T1.last_name FROM employees AS T1 JOIN customers AS T2 ON T1.id = T2.support_rep_id GROUP BY T1.id, T1.first_name, T1.last_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
For each product that has problems, find the number of problems reported after 1986-11-13 and the product id?
Schema:
- Problems(date_problem_reported, problem_id)
- Product(product_id, product_name) | SELECT COUNT(*) AS num_problems, T2.product_id FROM Problems AS T1 JOIN Product AS T2 ON T1.product_id = T2.product_id WHERE T1.date_problem_reported > DATE '1986-11-13' GROUP BY T2.product_id; |
How many colors are there?
Schema:
- Ref_Colors(color_description) | SELECT COUNT(*) AS num_colors FROM Ref_Colors; |
What are the names and ranks of the three youngest winners across all 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 winner_name, winner_rank FROM matches_ WHERE winner_name IS NOT NULL AND winner_rank IS NOT NULL AND winner_age IS NOT NULL GROUP BY winner_name, winner_rank, winner_age ORDER BY winner_age ASC NULLS LAST LIMIT 3; |
Papers authored by Liwen Xiong 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 are some good 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' AND T1.rating > 2.5; |
Find the appelations that produce wines after the year of 2008 but not in Central Coast area.?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
- appellations(Area, County) | SELECT Appelation FROM wine WHERE "Year" > 2008 AND Appelation NOT IN (SELECT Appelation FROM appellations WHERE Area = 'Central Coast'); |
Find the name and population of district with population between 200000 and 2000000?
Schema:
- district(City_Area, City_Population, District_name, d) | SELECT District_name, City_Population FROM district WHERE City_Population BETWEEN 200000 AND 2000000; |
Return the names of all regions other than Denmark.?
Schema:
- region(Label, Region_code, Region_name) | SELECT Region_name FROM region WHERE Region_name != 'Denmark'; |
Find the number of papers published by the institution "University of Pennsylvania".?
Schema:
- Papers(title)
- Authorship(...)
- Inst(...) | SELECT COUNT(DISTINCT T1.title) AS num_papers FROM Papers AS T1 JOIN Authorship AS T2 ON T1.paperID = T2.paperID JOIN Inst AS T3 ON T2.instID = T3.instID WHERE T3.name = 'University of Pennsylvania'; |
Find the texts of assessment notes for teachers with last name "Schuster".?
Schema:
- Assessment_Notes(date_of_notes)
- Teachers(email_address, first_name, gender, last_name) | SELECT T1.text_of_notes FROM Assessment_Notes AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.last_name = 'Schuster'; |
In what years did Pedro Domingos publish a paper ?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT 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 = 'Pedro Domingos' GROUP BY T3."year"; |
return me the paper after 2000 in VLDB conference with the most citations .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- conference(homepage, name) | SELECT T2.title FROM publication AS T2 JOIN conference AS T1 ON T2.cid = CAST(T1.cid AS TEXT) WHERE T1.name = 'VLDB' AND T2."year" > 2000 ORDER BY T2.citation_num DESC NULLS LAST LIMIT 1; |
Which authors did not submit to any workshop?
Schema:
- submission(Author, COUNT, College, Scores)
- Acceptance(...) | SELECT Author FROM submission WHERE Submission_ID NOT IN (SELECT Submission_ID FROM Acceptance); |
Find the last name of the individuals that have been contact individuals of an organization.?
Schema:
- Individuals(...)
- Organization_Contact_Individuals(...) | SELECT DISTINCT T1.individual_last_name FROM Individuals AS T1 JOIN Organization_Contact_Individuals AS T2 ON T1.individual_id = T2.individual_id; |
return me the conference, which have the most number of papers by " H. V. Jagadish " .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- conference(homepage, name)
- writes(...)
- author(...) | SELECT T2.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 T1.name = 'H. V. Jagadish' GROUP BY T2.name ORDER BY COUNT(DISTINCT T4.title) DESC NULLS LAST LIMIT 1; |
Find the name of physicians whose position title contains the word 'senior'.?
Schema:
- Physician(I, Name) | SELECT Name FROM Physician WHERE "Position" ILIKE '%senior%'; |
How many dorms are there?
Schema:
- Dorm(dorm_name, gender, student_capacity) | SELECT COUNT(*) AS num_dorms FROM Dorm; |
What is the name of country that has the shortest life expectancy in Asia?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT Name FROM country WHERE Continent = 'Asia' ORDER BY LifeExpectancy ASC NULLS LAST LIMIT 1; |
character recognition papers before 2010?
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 = 'character recognition' AND T3."year" < 2010; |
What is the decor of room Recluse and defiance?
Schema:
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT decor FROM Rooms WHERE roomName = 'Recluse and defiance'; |
who has written the most papers on semantic parsing since 2005 ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT COUNT(T4.paperId) AS num_papers, 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 WHERE T2.keyphraseName = 'semantic parsing' AND T4."year" > 2005 GROUP BY T3.authorId ORDER BY num_papers DESC NULLS LAST; |
keywords in the papers written by Luke Zettlemoyer?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T1.keyphraseId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T5 ON T4.authorId = T5.authorId WHERE T5.authorName = 'Luke Zettlemoyer'; |
How many documents have the status code done?
Schema:
- Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more)) | SELECT COUNT(*) AS num_documents FROM Documents WHERE document_status_code = 'done'; |
What are the publishers who have published a book in both 1989 and 1990?
Schema:
- book_club(Author_or_Editor, Book_Title, COUNT, Category, Publ, Publisher, T1) | SELECT DISTINCT T1.Publisher FROM book_club AS T1 JOIN book_club AS T2 ON T1.Publisher = T2.Publisher WHERE T1."Year" = 1989 AND T2."Year" = 1990; |
How many concerts are there in year 2014 or 2015?
Schema:
- concert(COUNT, Year) | SELECT COUNT(*) AS num_concerts FROM concert WHERE "Year" = 2014 OR "Year" = 2015; |
What are the distinct first names, last names, and phone numbers for customers with accounts?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT DISTINCT T1.customer_first_name, T1.customer_last_name, T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id; |
How many members are in each party?
Schema:
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more)) | SELECT T2.Party_name, COUNT(*) AS num_members FROM member_ AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID, T2.Party_name; |
Find name of the services that has never been used.?
Schema:
- Services(Service_Type_Code, Service_name)
- Party_Services(...) | SELECT DISTINCT service_name FROM Services WHERE service_name NOT IN (SELECT T1.service_name FROM Services AS T1 JOIN Party_Services AS T2 ON T1.service_id = T2.service_id); |
What is the average horizontal bar points for all gymnasts?
Schema:
- gymnast(Floor_Exercise_Points, Horizontal_Bar_Points) | SELECT AVG(Horizontal_Bar_Points) AS avg_horizontal_bar_points FROM gymnast; |
What is the number of ships?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT COUNT(*) AS num_ships FROM ship; |
Which cities do more than one employee under age 30 come from?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) | SELECT City FROM employee WHERE Age < 30 AND City IS NOT NULL GROUP BY City HAVING COUNT(*) > 1; |
What are the cost and treatment type description of each treatment?
Schema:
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id)
- Treatment_Types(...) | SELECT T1.cost_of_treatment, T2.treatment_type_description FROM Treatments AS T1 JOIN Treatment_Types AS T2 ON T1.treatment_type_code = T2.treatment_type_code; |
Which school has the smallest amount of professors?
Schema:
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) | SELECT T1.SCHOOL_CODE FROM DEPARTMENT AS T1 JOIN PROFESSOR AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.SCHOOL_CODE ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
List all customer status codes and the number of customers having each status code.?
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_status_code, COUNT(*) AS num_customers FROM Customers GROUP BY customer_status_code; |
What are the average fastest lap speed in races held after 2004 grouped by race name and ordered by year?
Schema:
- races(date, name)
- results(...) | SELECT AVG(TRY_CAST(T2.fastestLapSpeed AS DOUBLE)) AS avg_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; |
find the total market rate of the furnitures that have the top 2 market shares.?
Schema:
- furniture(Furniture_ID, Market_Rate, Name) | SELECT SUM(Market_Rate) AS total_market_rate FROM (SELECT Market_Rate FROM furniture ORDER BY Market_Rate DESC NULLS LAST LIMIT 2); |
How many train stations are there?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT COUNT(*) AS num_stations FROM station; |
Show the institution type with the largest number of institutions.?
Schema:
- Institution(COUNT, Enrollment, Founded, Type) | SELECT Type FROM Institution WHERE Type IS NOT NULL GROUP BY Type ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Return the average, maximum, and minimum budgets in millions for movies made before the year 2000.?
Schema:
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) | SELECT AVG(Budget_million) AS avg_budget_million, MAX(Budget_million) AS max_budget_million, MIN(Budget_million) AS min_budget_million FROM movie WHERE "Year" < 2000; |
papers that were not published in the last year?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT paperId FROM paper WHERE "year" != 2015; |
Show ids for all documents with budget types described as 'Government'.?
Schema:
- Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID)
- Ref_Budget_Codes(Budget_Type_Code, Budget_Type_Description) | SELECT T1.Document_ID FROM Documents_with_Expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_Code = T2.Budget_Type_Code WHERE T2.Budget_Type_Description = 'Government'; |
What is the average price for flights from Los Angeles to Honolulu.?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT AVG(price) AS avg_price FROM flight WHERE origin = 'Los Angeles' AND destination = 'Honolulu'; |
What are the average prices of hotels grouped by their pet policy.?
Schema:
- Hotels(hotel_id, other_hotel_details, pets_allowed_yn, price_range, star_rating_code) | SELECT pets_allowed_yn, AVG(price_range) AS avg_price FROM Hotels GROUP BY pets_allowed_yn; |
give me some good places on buchanan in san francisco for arabic food ?
Schema:
- restaurant(...)
- location(...) | SELECT T2.house_number, T1.name FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'san francisco' AND T2.street_name = 'buchanan' AND T1.food_type = 'arabic' AND T1.rating > 2.5; |
What are the different first names and ages of the students who do have pets?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Pet(...) | SELECT DISTINCT T1.Fname, T1.Age FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID; |
Find the buildings which have rooms with capacity more than 50.?
Schema:
- classroom(building, capacity, room_number) | SELECT DISTINCT building FROM classroom WHERE capacity > 50; |
Show invoice dates and order id and details for all invoices.?
Schema:
- Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code)
- Orders(customer_id, date_order_placed, order_id) | SELECT T1.invoice_date, T1.order_id, T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id; |
Find the product names whose average product price is below 1000000.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT Product_Name FROM Products WHERE Product_Name IS NOT NULL GROUP BY Product_Name HAVING AVG(Product_Price) < 1000000; |
Show student ids who don't have any sports.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID) | SELECT StuID FROM Student WHERE StuID NOT IN (SELECT StuID FROM SportsInfo); |
Return the average earnings across all poker players.?
Schema:
- poker_player(Best_Finish, Earnings, Final_Table_Made, Money_Rank) | SELECT AVG(Earnings) AS avg_earnings FROM poker_player; |
What countries are the female artists who sung in the language Bangla from?
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 T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = 'Female' AND T2.languages = 'bangla'; |
What are the procedures that cost more than 1000 or are specialized in by physician John Wen?
Schema:
- Procedures(Cost, Name)
- Physician(I, Name)
- Trained_In(...) | SELECT DISTINCT Name FROM (SELECT Name FROM Procedures WHERE Cost > 1000 UNION ALL SELECT T3.Name FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment WHERE T1.Name = 'John Wen'); |
Show all template type codes and number of templates for each.?
Schema:
- Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number) | SELECT Template_Type_Code, COUNT(*) AS num_templates FROM Templates GROUP BY Template_Type_Code; |
Return the average price of products that have each category code.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT AVG(product_price) AS avg_price, product_category_code FROM Products GROUP BY product_category_code; |
What is the average weeks on top of volumes associated with the artist aged 25 or younger?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
- volume(Artist_ID, Issue_Date, Song, Weeks_on_Top) | SELECT AVG(T2.Weeks_on_Top) AS avg_weeks_on_top FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Age <= 25; |
what is the largest state that borders the state with the lowest point in the usa?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
- border_info(T1, border, state_name)
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT T1.state_name FROM highlow AS T3 JOIN border_info AS T1 ON T3.state_name = T1.border JOIN state AS T2 ON T2.state_name = T1.border WHERE T3.lowest_elevation = (SELECT MIN(lowest_elevation) FROM highlow) ORDER BY T2.area DESC NULLS LAST LIMIT 1; |
Show names of ships involved in a mission launched after 1928.?
Schema:
- mission(...)
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T1.Launched_Year > 1928; |
Show first name and last name for all the students advised by Michael Goodrich.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT T2.Fname, T2.Lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor WHERE T1.Fname = 'Michael' AND T1.Lname = 'Goodrich'; |
Find the number of players for each hand type.?
Schema:
- players(COUNT, birth_date, country_code, first_name, hand, last_name) | SELECT COUNT(*) AS num_players, hand FROM players GROUP BY hand; |
Which schools have more than 1 player? Give me the school locations.?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type) | SELECT T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID, T2.Location HAVING COUNT(*) > 1; |
What is the document id, template id and description for document named "Robbin 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_ID, Template_ID, Document_Description FROM Documents WHERE Document_Name = 'Robbin CV'; |
Count the number of customers who do not have an account.?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT COUNT(*) AS num_customers FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts); |
What are all the the participant ids, type code and details?
Schema:
- Participants(Participant_Details, Participant_ID, Participant_Type_Code) | SELECT Participant_ID, Participant_Type_Code, Participant_Details FROM Participants; |
What is the type of the document whose description starts with the word 'Initial'?
Schema:
- Document_Types(document_description, document_type_code) | SELECT document_type_code FROM Document_Types WHERE document_description LIKE 'Initial%'; |
What are the names of the physicians who have 'senior' in their titles.?
Schema:
- Physician(I, Name) | SELECT Name FROM Physician WHERE "Position" ILIKE '%senior%'; |
Show the headquarters that have at least two 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 HAVING COUNT(*) >= 2; |
Return the title and director of the movie released in the year 2000 or earlier that had the highest worldwide gross.?
Schema:
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) | SELECT Title, Director FROM movie WHERE "Year" <= 2000 ORDER BY Gross_worldwide DESC NULLS LAST LIMIT 1; |
Find the number of professionals who have ever treated dogs.?
Schema:
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT COUNT(DISTINCT professional_id) AS num_professionals FROM Treatments; |
return me the year of " Making database systems usable " .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT "year" FROM publication WHERE title = 'Making database systems usable'; |
Find the business with the most number of reviews in April?
Schema:
- review(i_id, rank, rating, text)
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT T1.name FROM review AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T2."month" = 'April' GROUP BY T1.name ORDER BY COUNT(DISTINCT T2."text") DESC NULLS LAST LIMIT 1; |
Please show the most common type of ships.?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT Type FROM ship WHERE Type IS NOT NULL GROUP BY Type ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are ids of the faculty members who not only participate in an activity but also advise a student.?
Schema:
- Faculty_Participates_in(FacID)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT DISTINCT FacID FROM Faculty_Participates_in WHERE FacID IN (SELECT Advisor FROM Student); |
List of papers in pldi 2015?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T1.paperId FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T1."year" = 2015 AND T2.venueName = 'pldi'; |
Find the department name of the instructor whose name contains 'Soisalon'.?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary) | SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%'; |
Which countries has the most number of airlines whose active status is 'Y'?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name) | SELECT country FROM airlines WHERE active = 'Y' AND country IS NOT NULL GROUP BY country ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the number of medications prescribed for each brand.?
Schema:
- Medication(Name)
- Prescribes(...) | SELECT COUNT(*) AS num_medications, T1.Name FROM Medication AS T1 JOIN Prescribes AS T2 ON T1.Code = T2.Medication GROUP BY T1.Brand, T1.Name; |
What are the names of all the customers in alphabetical order?
Schema:
- ACCOUNTS(name) | SELECT name FROM ACCOUNTS ORDER BY name ASC NULLS LAST; |
What are the names and genders of all artists who released songs in the month of March?
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 T1.artist_name, T1.gender FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.releasedate LIKE '%Mar%'; |
What are the different states that had students successfully try out?
Schema:
- College(M, cName, enr, state)
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT DISTINCT T1.state FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes'; |
Show the names of people, and dates and venues of debates they are on the negative side, ordered in ascending alphabetical order of name.?
Schema:
- debate_people(...)
- debate(Date, Venue)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T3.Name, T2."Date", T2.Venue FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Negative = T3.People_ID ORDER BY T3.Name ASC NULLS LAST; |
Count the number of tracks.?
Schema:
- track(Location, Name, Seat, Seating, T1, Year_Opened) | SELECT COUNT(*) AS num_tracks FROM track; |
What is the name and detail of each staff member?
Schema:
- Staff(COUNT, Name, Other_Details, date_joined_staff, date_left_staff, date_of_birth, email_address, first_name, gender, last_name, middle_name, nickname) | SELECT Name, Other_Details FROM Staff; |
What are the names of all the aircrafts associated with London Gatwick airport?
Schema:
- aircraft(Description, aid, d, distance, name)
- airport_aircraft(...)
- airport(Airport_Name, City, Country, Domestic_Passengers, International_Passengers, Transit_Passengers, id, name) | SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = 'London Gatwick'; |
List the order id, customer id for orders in Cancelled status, ordered by their order dates.?
Schema:
- Customer_Orders(customer_id, order_date, order_id, order_shipping_charges) | SELECT order_id, customer_id FROM Customer_Orders WHERE order_status_code = 'Cancelled' ORDER BY order_date ASC NULLS LAST; |
Find the name and age of the person who is a friend of Dan or Alice.?
Schema:
- Person(M, age, city, eng, gender, job, name)
- PersonFriend(M, friend, name) | SELECT DISTINCT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' OR T2.friend = 'Alice'; |
What is the email and phone number of Astrid Gruber the customer?
Schema:
- customers(Mart, city, company, country, email, first_name, last_name, phone, state) | SELECT email, phone FROM customers WHERE first_name = 'Astrid' AND last_name = 'Gruber'; |
What are the task details, task ids, and project ids for the progrects that are detailed as 'omnis' or have at least 3 outcomes?
Schema:
- Tasks(...)
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
- Project_Outcomes(outcome_code) | SELECT task_details, task_id, project_id FROM (SELECT T1.task_details, T1.task_id, T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'omnis' UNION ALL SELECT T1.task_details, T1.task_id, T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id JOIN Project_Outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T1.task_details, T1.task_id, T2.project_id HAVING COUNT(*) > 2) GROUP BY task_details, task_id, project_id; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.