question
stringlengths
43
589
query
stringlengths
19
598
What are the last names of faculty in building Barton, sorted by last name? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
SELECT LName FROM Faculty WHERE Building = 'Barton' ORDER BY LName ASC NULLS LAST;
List the final tables made and the best finishes of poker players.? Schema: - poker_player(Best_Finish, Earnings, Final_Table_Made, Money_Rank)
SELECT Final_Table_Made, Best_Finish FROM poker_player;
What is the document type name for the document with name "How to read a book"? Schema: - All_Documents(Date_Stored, Document_Name, Document_Type_Code) - Ref_Document_Types(Document_Type_Code, Document_Type_Description, Document_Type_Name, document_type_code, document_type_description)
SELECT T2.Document_Type_Name FROM All_Documents AS T1 JOIN Ref_Document_Types AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code WHERE T1.Document_Name = 'How to read a book';
Find the claimed amount in the claim with the least amount settled. Show both the settlement amount and claim amount.? Schema: - Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled)
SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC NULLS LAST LIMIT 1;
Show the names of high schoolers who have at least 3 friends.? Schema: - Friend(student_id) - Highschooler(COUNT, ID, grade, name)
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID GROUP BY T1.student_id, T2.name HAVING COUNT(*) >= 3;
which ACL 2014 papers about Parsing used Jeopardy! Questions ? Schema: - paperDataset(...) - dataset(...) - paperKeyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - venue(venueId, venueName) - keyphrase(...)
SELECT DISTINCT T2.paperId FROM paperDataset AS T3 JOIN dataset AS T5 ON T3.datasetId = T5.datasetId JOIN paperKeyphrase AS T4 ON T4.paperId = T3.paperId JOIN paper AS T2 ON T2.paperId = T3.paperId JOIN venue AS T6 ON T6.venueId = T2.venueId JOIN keyphrase AS T1 ON T4.keyphraseId = T1.keyphraseId WHERE T5.datasetName = 'Jeopardy! Questions' AND T1.keyphraseName = 'Parsing' AND T2."year" = 2014 AND T6.venueName = 'ACL';
What are the song titles on the album "A Kiss Before You Go: Live in Hamburg"? Schema: - Albums(COUNT, Label, Title) - Tracklists(...) - Songs(Title)
SELECT T3.Title FROM Albums AS T1 JOIN Tracklists AS T2 ON T1.AId = T2.AlbumId JOIN Songs AS T3 ON T2.SongId = T3.SongId WHERE T1.Title = 'A Kiss Before You Go: Live in Hamburg';
what is the longest river in the largest state? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT river_name FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river WHERE traverse IN (SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state))) AND traverse IN (SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state));
What is the sex of the candidate who had the highest unsure rate? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) - candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_rate)
SELECT T1.Sex FROM people AS T1 JOIN candidate AS T2 ON T1.People_ID = T2.People_ID GROUP BY T1.Sex ORDER BY AVG(T2.Unsure_rate) DESC NULLS LAST LIMIT 1;
What is the average song rating for each language? Schema: - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT AVG(rating) AS avg_rating, languages FROM song GROUP BY languages;
What are the names of courses that give either 3 credits, or 1 credit and 4 hours? Schema: - Course(CName, Credits, Days)
SELECT DISTINCT CName FROM (SELECT CName FROM Course WHERE Credits = 3 UNION ALL SELECT CName FROM Course WHERE Credits = 1 AND TRY_CAST(Hours AS INT) = 4);
What is the type of the document named "David 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_type_code FROM Documents WHERE document_name = 'David CV';
What are the different ids and stop durations of all the drivers whose stop lasted longer than the driver in the race with the id 841? Schema: - pitStops(driverId, raceId, stop)
SELECT DISTINCT driverId, stop FROM pitStops WHERE TRY_CAST(duration AS INT) < (SELECT MAX(TRY_CAST(duration AS INT)) FROM pitStops WHERE raceId = 841);
What is the average quantity of stocks? Schema: - stock(Quantity)
SELECT AVG(Quantity) AS avg_quantity FROM stock;
How many rooms are there? Schema: - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT COUNT(*) AS num_rooms FROM Rooms;
which papers used WebKB ? Schema: - paperDataset(...) - dataset(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
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 WHERE T1.datasetName = 'WebKB';
List the names of all the distinct customers who bought a keyboard.? 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)) - Customer_Orders(customer_id, order_date, order_id, order_shipping_charges) - Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT DISTINCT T1.customer_name FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_Items AS T3 ON T2.order_id = T3.order_id JOIN Products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_name = 'keyboard';
List from which date and to which date these staff work: project staff of the project which hires the most staffs? Schema: - Project_Staff(COUNT, date_from, date_to, role_code) - IS(...)
SELECT date_from, date_to FROM (SELECT date_from, date_to FROM Project_Staff WHERE project_id IN (SELECT project_id FROM Project_Staff WHERE project_id IS NOT NULL GROUP BY project_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1) UNION ALL SELECT date_from, date_to FROM Project_Staff WHERE role_code = 'leader') WHERE date_from IS NOT NULL AND date_to IS NOT NULL GROUP BY date_from, date_to;
What are the positions of both players that have more than 20 points and less than 10 points? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
SELECT DISTINCT T1."Position" FROM player AS T1 JOIN player AS T2 ON T1."Position" = T2."Position" WHERE T1.Points > 20 AND T2.Points < 10;
Show the working years of managers in descending order of their level.? Schema: - manager(Age, Country, Level, Name, Working_year_starts, m1)
SELECT Working_year_starts FROM manager ORDER BY Level DESC NULLS LAST;
Find the names of customers who never placed an order.? 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)) - Customer_Orders(customer_id, order_date, order_id, order_shipping_charges)
SELECT customer_name FROM Customers WHERE customer_name NOT IN (SELECT T1.customer_name FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id);
For each room, find its name and the number of times reservations were made for it.? Schema: - Reservations(Adults, CheckIn, FirstName, Kids, LastName) - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT T2.roomName, COUNT(*) AS num_reservations, T1.Room FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room, T2.roomName;
What papers are authored by sharon goldwater ? Schema: - writes(...) - author(...)
SELECT DISTINCT T2.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'sharon goldwater';
How many movies did " Quentin Tarantino " direct after 2010 ? Schema: - director(Afghan, name, nationality) - directed_by(...) - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
SELECT COUNT(DISTINCT T3.title) AS num_movies FROM director AS T2 JOIN directed_by AS T1 ON T2.did = T1.did JOIN movie AS T3 ON T3.mid = T1.msid WHERE T2.name = 'Quentin Tarantino' AND T3.release_year > 2010;
Who is the director of movie Avatar? Schema: - Movie(T1, director, title, year)
SELECT director FROM Movie WHERE title = 'Avatar';
papers at NIPS related to TAIL? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - venue(venueId, venueName)
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 JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.keyphraseName = 'TAIL' AND T4.venueName = 'NIPS';
how many people are in the state of california? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT population FROM state WHERE state_name = 'california';
Please show the songs that have result "nominated" at music festivals.? Schema: - music_festival(COUNT, Category, Date_of_ceremony, Result) - volume(Artist_ID, Issue_Date, Song, Weeks_on_Top)
SELECT T2.Song FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T1."Result" = 'Nominated';
Find the description of the most popular role among the users that have logged in.? Schema: - Roles(Role_Code, Role_Description, Role_Name, role_code, role_description) - Users(COUNT, password, role_code, user_log, user_name)
SELECT role_description FROM Roles WHERE role_code = (SELECT role_code FROM Users WHERE TRY_CAST(user_login AS INT) = 1 AND role_code IS NOT NULL GROUP BY role_code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1);
Find the id of songs that are available in mp4 format and have resolution lower than 1000.? Schema: - files(COUNT, duration, f_id, formats) - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT DISTINCT T1.f_id FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp4' AND T2.resolution < 1000;
What are the names and data types of the characteristics of the 'cumin' product? 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 T3.characteristic_name, T3.characteristic_data_type 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 T1.product_name = 'cumin';
What is the number of cars with more than 4 cylinders? Schema: - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT COUNT(*) AS num_cars FROM cars_data WHERE Cylinders > 4;
Find the name and budget of the latest movie by " Quentin Tarantino "? Schema: - director(Afghan, name, nationality) - directed_by(...) - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
SELECT T3.budget, T3.title FROM director AS T2 JOIN directed_by AS T1 ON T2.did = T1.did JOIN movie AS T3 ON T3.mid = T1.msid WHERE T2.name = 'Quentin Tarantino' ORDER BY T3.release_year DESC NULLS LAST LIMIT 1;
Show all allergy type with number of students affected.? Schema: - Has_Allergy(Allergy, COUNT, StuID) - Allergy_Type(Allergy, AllergyType, COUNT)
SELECT T2.AllergyType, COUNT(*) AS num_students FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy GROUP BY T2.AllergyType;
which 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 are the type come, name, and description of the document that has either the name 'Noel CV' or 'King Book'? 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_Type_Code, Document_Name, Document_Description FROM Documents WHERE Document_Name = 'Noel CV' OR Document_Name = 'King Book';
Give id of the instructor who advises students in the History department.? Schema: - advisor(s_ID) - student(COUNT, H, dept_name, name, tot_cred)
SELECT i_ID FROM advisor AS T1 JOIN student AS T2 ON T1.s_ID = T2.ID WHERE T2.dept_name = 'History';
Find the rank of the faculty that the fewest faculties belong to.? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
SELECT "Rank" FROM Faculty GROUP BY "Rank" ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
Which friend of Zach has the longest-lasting friendship? Schema: - PersonFriend(M, friend, name)
SELECT friend FROM PersonFriend WHERE name = 'Zach' AND "year" = (SELECT MAX("year") FROM PersonFriend WHERE name = 'Zach');
Find the parties associated with the delegates from district 1. Who served as governors of the parties? Schema: - election(Committee, Date, Delegate, District, Vote_Percent, Votes) - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1;
What is the average enrollment of schools? Schema: - school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type)
SELECT AVG(Enrollment) AS avg_enrollment FROM school;
What is the number of distinct cities the stations are located at? Schema: - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
SELECT COUNT(DISTINCT city) AS num_cities FROM station;
What is all the information regarding employees who are managers? Schema: - employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) - departments(DEPARTMENT_NAME, Market)
SELECT DISTINCT * FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID WHERE T1.EMPLOYEE_ID = T2.MANAGER_ID;
where is the highest mountain of the united states? Schema: - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT state_name FROM mountain WHERE mountain_altitude = (SELECT MAX(mountain_altitude) FROM mountain);
List the project details of the project both producing patent and paper as outcomes.? Schema: - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) - Project_Outcomes(outcome_code)
SELECT T1.project_details FROM Projects AS T1 JOIN Project_Outcomes AS T2 ON T1.project_id = T2.project_id WHERE (T2.outcome_code = 'Paper' AND T1.project_id IN (SELECT project_id FROM Project_Outcomes WHERE outcome_code = 'Patent'));
What is the id of the reviewer whose name has substring “Mike”? Schema: - Reviewer(Lew, name, rID)
SELECT rID FROM Reviewer WHERE name LIKE '%Mike%';
What is the address of each course author or tutor? Schema: - Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name)
SELECT address_line_1 FROM Course_Authors_and_Tutors;
Return the id of the project that has the fewest corresponding documents.? Schema: - Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more))
SELECT Project_ID FROM Documents WHERE Project_ID IS NOT NULL GROUP BY Project_ID ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
What is the average age of the female students with 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.Sex = 'F' AND T2.Election_Cycle = 'Spring';
What is the total number of purchases for members with level 6? Schema: - purchase(...) - member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
SELECT COUNT(*) AS num_purchases FROM purchase AS T1 JOIN member_ AS T2 ON T1.Member_ID = T2.Member_ID WHERE T2.Level = 6;
What is the description of the product named "Chocolate"? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT product_description FROM Products WHERE product_name = 'Chocolate';
What are the cities whose population is between 160000 and 900000? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT Name FROM city WHERE Population BETWEEN 160000 AND 900000;
List in alphabetic order the names of all distinct instructors.? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT DISTINCT name FROM instructor ORDER BY name ASC NULLS LAST;
What are the names of all aircrafts that are associated with both London Heathrow and Gatwick airports? 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 IN ('London Heathrow', 'London Gatwick') GROUP BY T1.Aircraft HAVING COUNT(DISTINCT T3.Airport_Name) = 2;
Show the budget type code and description and the corresponding document id.? Schema: - Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID) - Ref_Budget_Codes(Budget_Type_Code, Budget_Type_Description)
SELECT T2.Budget_Type_Code, T2.Budget_Type_Description, T1.Document_ID FROM Documents_with_Expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_Code = T2.Budget_Type_Code;
What are the different names for all songs that have a higher resolution than English songs? Schema: - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT DISTINCT song_name FROM song WHERE resolution > (SELECT MIN(resolution) FROM song WHERE languages = 'english');
What are each physician's employee id and department id primarily affiliated.? Schema: - Affiliated_With(Department, Physician, PrimaryAffiliation)
SELECT Physician, Department FROM Affiliated_With WHERE PrimaryAffiliation = 1;
What are the official names of cities that have not hosted a farm competition? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) - farm_competition(Hosts, Theme, Year)
SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition);
What is the name of the breed with the most dogs? Schema: - Breeds(...) - Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
SELECT T1.breed_name FROM Breeds AS T1 JOIN Dogs AS T2 ON T1.breed_code = T2.breed_code GROUP BY T1.breed_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
How many artists do not have any album? Schema: - Artist(Name) - Album(Title)
SELECT COUNT(*) AS num_artists FROM Artist WHERE ArtistId NOT IN(SELECT ArtistId FROM Album);
List the name of all rooms sorted by their prices.? Schema: - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT roomName FROM Rooms ORDER BY basePrice ASC NULLS LAST;
How many students have each different allergy? Schema: - Has_Allergy(Allergy, COUNT, StuID)
SELECT Allergy, COUNT(*) AS num_students FROM Has_Allergy GROUP BY Allergy;
How many professors teach a class with the code ACCT-211? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
SELECT COUNT(DISTINCT PROF_NUM) AS num_professors FROM CLASS WHERE CRS_CODE = 'ACCT-211';
What is the id of the store that has the most items in inventory? Schema: - inventory(COUNT, store_id)
SELECT store_id FROM inventory WHERE store_id IS NOT NULL GROUP BY store_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the title of the course with Differential Geometry as a prerequisite? Schema: - course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) - prereq(...)
SELECT title FROM course WHERE course_id IN (SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id = T2.course_id WHERE T2.title = 'Differential Geometry');
What is the latitude, longitude, city of the station from which the shortest trip started? Schema: - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) - trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code)
SELECT T1.lat, T1.long, T1.city FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id ORDER BY T2.duration ASC NULLS LAST LIMIT 1;
Show the protein name and the institution name.? Schema: - Institution(COUNT, Enrollment, Founded, Type) - protein(...)
SELECT T2.protein_name, T1.Institution FROM Institution AS T1 JOIN protein AS T2 ON T1.Institution_id = T2.Institution_id;
How many faculty members are at the university that gave the least number of degrees in 2001? Schema: - Campuses(Campus, County, Franc, Location) - faculty(Faculty) - degrees(Campus, Degrees, SUM, Year)
SELECT T2.Faculty FROM Campuses AS T1 JOIN faculty AS T2 ON T1.Id = T2.Campus JOIN degrees AS T3 ON T1.Id = T3.Campus AND T2."Year" = T3."Year" WHERE T2."Year" = 2001 ORDER BY T3.Degrees ASC NULLS LAST LIMIT 1;
Find the number of classes 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;
List the actual delivery date for all the orders with quantity 1? Schema: - Customer_Orders(customer_id, order_date, order_id, order_shipping_charges) - Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
SELECT T1.Actual_Delivery_Date FROM Customer_Orders AS T1 JOIN Order_Items AS T2 ON T1.Order_ID = T2.Order_ID WHERE TRY_CAST(T2.Order_Quantity AS INT) = 1;
What are the names of all stations with a latitude smaller than 37.5? Schema: - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
SELECT name FROM station WHERE lat < 37.5;
Sort all the industries in descending order of the count of companies in each industry? Schema: - Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name)
SELECT Industry FROM Companies WHERE Industry IS NOT NULL GROUP BY Industry ORDER BY COUNT(*) DESC NULLS LAST;
Show distinct types of artworks that are nominated in festivals in 2007.? Schema: - nomination(...) - artwork(COUNT, Name, Type) - festival_detail(Chair_Name, Festival_Name, Location, T1, Year)
SELECT DISTINCT T2.Type 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 WHERE T3."Year" = 2007;
What are the last names of the faculty members playing both Canoeing and Kayaking? 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 = T3.actid JOIN Faculty_Participates_in AS T4 ON T1.FacID = T4.FacID JOIN Activity AS T5 ON T4.actid = T5.actid WHERE (T3.activity_name = 'Canoeing' AND T5.activity_name = 'Kayaking');
What are the codes of all the courses that are located in room KLR209? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
SELECT CLASS_CODE FROM CLASS WHERE CLASS_ROOM = 'KLR209';
Find the names of courses that have either 3 credits or 1 credit but 4 hours.? Schema: - Course(CName, Credits, Days)
SELECT DISTINCT CName FROM (SELECT CName FROM Course WHERE Credits = 3 UNION ALL SELECT CName FROM Course WHERE Credits = 1 AND TRY_CAST(Hours AS INT) = 4);
How many dogs have an age below the average? Schema: - Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
SELECT COUNT(*) AS num_dogs FROM Dogs WHERE age < (SELECT AVG(age) FROM Dogs);
how many people live in the biggest city in alaska state? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT population FROM city WHERE population = (SELECT MAX(population) FROM city WHERE state_name = 'alaska') AND state_name = 'alaska';
Find the stories of the building with the largest height.? Schema: - buildings(Height, Status, Stories, name)
SELECT Stories FROM buildings ORDER BY Height DESC NULLS LAST LIMIT 1;
Show home city where at least two drivers older than 40 are from.? Schema: - driver(Age, Home_city, Name, Party)
SELECT Home_city FROM driver WHERE Age > 40 AND Home_city IS NOT NULL GROUP BY Home_city HAVING COUNT(*) >= 2;
What are the description and credit of the course which the student whose last name is Smithson took? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) - ENROLL(...) - STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE) - COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE)
SELECT T4.CRS_DESCRIPTION, T4.CRS_CREDIT FROM CLASS AS T1 JOIN ENROLL AS T2 ON T1.CLASS_CODE = T2.CLASS_CODE JOIN STUDENT AS T3 ON T3.STU_NUM = T2.STU_NUM JOIN COURSE AS T4 ON T4.CRS_CODE = T1.CRS_CODE WHERE T3.STU_LNAME = 'Smithson';
What is the number of routes operated by the airline American Airlines whose destinations are in Italy? Schema: - routes(...) - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) - airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
SELECT COUNT(*) AS num_routes FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid JOIN airlines AS T3 ON T1.alid = T3.alid WHERE T2.country = 'Italy' AND T3.name = 'American Airlines';
Return the famous titles of the artist called "Triumfall".? Schema: - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
SELECT Famous_Title FROM artist WHERE Artist = 'Triumfall';
Find the last names of the students in third grade that are not taught by COVIN JEROME.? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName) - teachers(Classroom, FirstName, LastName)
SELECT DISTINCT T1.LastName FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T1.Grade = 3 AND T2.FirstName != 'COVIN' AND T2.LastName != 'JEROME';
How old is each gender, on average? Schema: - Person(M, age, city, eng, gender, job, name)
SELECT AVG(age) AS avg_age, gender FROM Person GROUP BY gender;
What is the total ticket expense of the visitors whose membership level is 1? Schema: - visitor(Age, Level_of_membership, Name) - visit(...)
SELECT SUM(T2.Total_spent) AS total_ticket_expense FROM visitor AS T1 JOIN visit AS T2 ON T1.ID = T2.visitor_ID WHERE T1.Level_of_membership = 1;
return me the number of citations of " Making database systems usable " before 2010 .? Schema: - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - cite(...)
SELECT COUNT(DISTINCT T2.title) AS num_citations FROM publication AS T3 JOIN cite AS T1 ON T3.pid = T1.cited JOIN publication AS T2 ON T2.pid = T1.citing WHERE T3.title = 'Making database systems usable' AND T2."year" < 2010;
What is the id of the routes whose source and destination airports are in the United States? Schema: - routes(...) - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT rid FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country = 'United States') AND src_apid IN (SELECT apid FROM airports WHERE country = 'United States');
What are the number of different course codes? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
SELECT COUNT(DISTINCT CRS_CODE) AS num_courses FROM CLASS;
How many papers has Christopher D. Manning ? Schema: - writes(...) - author(...)
SELECT DISTINCT COUNT(DISTINCT T2.paperId) AS num_papers FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'Christopher D. Manning';
How many allergies have type animal? Schema: - Allergy_Type(Allergy, AllergyType, COUNT)
SELECT COUNT(*) AS num_allergies FROM Allergy_Type WHERE AllergyType = 'animal';
Which program was launched most recently? Return the program name.? Schema: - program(Beij, Launch, Name, Origin, Owner)
SELECT Name FROM program ORDER BY Launch DESC NULLS LAST LIMIT 1;
What are the locations and names of all stations with capacity between 5000 and 10000? Schema: - stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
SELECT Location, Name FROM stadium WHERE Capacity BETWEEN 5000 AND 10000;
How many papers published in nature communications in 2015 ? Schema: - venue(venueId, venueName) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT COUNT(T1.paperId) AS num_papers FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T1."year" = 2015 AND T2.venueName = 'nature communications';
What is the total number of postseason games that team Boston Red Stockings participated in? Schema: - postseason(ties) - team(Name)
SELECT COUNT(*) AS num_games FROM (SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' UNION ALL SELECT * FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings');
Find the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties? Schema: - election(Committee, Date, Delegate, District, Vote_Percent, Votes) - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2;
Show the names of editors and the theme of journals for which they serve on committees.? Schema: - journal_committee(...) - editor(Age, COUNT, Name) - journal(Theme, homepage, name)
SELECT T2.Name, 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;
Find all the female actors from Austin? Schema: - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
SELECT name FROM actor WHERE birth_city = 'Austin' AND gender = 'female';
Show the shipping charge and customer id for customer orders with order status Cancelled or Paid.? Schema: - Customer_Orders(customer_id, order_date, order_id, order_shipping_charges)
SELECT order_shipping_charges, customer_id FROM Customer_Orders WHERE order_status_code = 'Cancelled' OR order_status_code = 'Paid';
What is the total and minimum enrollment of all schools? Schema: - university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School)
SELECT SUM(Enrollment) AS total_enrollment, MIN(Enrollment) AS min_enrollment FROM university;