question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
Which nationality has the most hosts?
Schema:
- host(Age, COUNT, Name, Nationality) | SELECT Nationality FROM host WHERE Nationality IS NOT NULL GROUP BY Nationality ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Which physicians are affiliated with both Surgery and Psychiatry departments? Tell me their names.?
Schema:
- Physician(I, Name)
- Affiliated_With(Department, Physician, PrimaryAffiliation)
- Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2) | SELECT T1.Name FROM Physician AS T1 JOIN Affiliated_With AS T2 ON T1.EmployeeID = T2.Physician JOIN Department AS T3 ON T2.Department = T3.DepartmentID WHERE T3.Name IN ('Surgery', 'Psychiatry') GROUP BY T1.Name HAVING COUNT(DISTINCT T3.Name) = 2; |
Show the denomination shared by more than one school.?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type) | SELECT Denomination FROM school WHERE Denomination IS NOT NULL GROUP BY Denomination HAVING COUNT(*) > 1; |
Find the number of tweets in record.?
Schema:
- tweets(I, tweet_text, uid) | SELECT COUNT(*) AS num_tweets FROM tweets; |
What is the venue of the competition "1994 FIFA World Cup qualification" hosted by "Nanjing ( Jiangsu )"?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- hosting_city(Host_City, Year)
- match_(Competition, Date, Match_ID, Venue) | SELECT T3.Venue FROM city AS T1 JOIN hosting_city AS T2 ON T1.City_ID = T2.Host_City JOIN match_ AS T3 ON T2.Match_ID = T3.Match_ID WHERE T1.City = 'Nanjing (Jiangsu)' AND T3.Competition = '1994 FIFA World Cup qualification'; |
authors who collaborated with Noah A Smith?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT T1.authorId FROM writes AS T3 JOIN author AS T2 ON T3.authorId = T2.authorId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T2.authorName = 'Noah A Smith'; |
What is the maximum price of wines from the appelation in the Central Coast area, which was produced before 2005?
Schema:
- appellations(Area, County)
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT MAX(T2.Price) AS max_price FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = 'Central Coast' AND T2."Year" < 2005; |
How many different items were reviewed by some users?
Schema:
- review(i_id, rank, rating, text) | SELECT COUNT(DISTINCT i_id) AS num_items FROM review; |
What major is every student who does not own a cat as a pet, and also how old are they?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Pet(...)
- Pets(PetID, PetType, pet_age, weight) | SELECT Major, Age FROM Student WHERE StuID NOT IN (SELECT T1.StuID FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID JOIN Pets AS T3 ON T3.PetID = T2.PetID WHERE T3.PetType = 'cat'); |
Find the job ID for those jobs which average salary is above 8000.?
Schema:
- employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) | SELECT JOB_ID FROM employees WHERE JOB_ID IS NOT NULL GROUP BY JOB_ID HAVING AVG(SALARY) > 8000; |
Show the station name with greatest number of trains.?
Schema:
- train_station(...)
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT T2.Name FROM train_station AS T1 JOIN station AS T2 ON T1.Station_ID = T2.Station_ID GROUP BY T1.Station_ID, T2.Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Report the distinct president vote and the vice president vote.?
Schema:
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT President_Vote, Vice_President_Vote FROM Voting_record; |
return me the number of papers in " University of Michigan " in Databases area .?
Schema:
- domain_author(...)
- author(...)
- domain(...)
- domain_publication(...)
- organization(continent, homepage, name)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT COUNT(DISTINCT T4.title) AS num_papers FROM domain_author AS T6 JOIN author AS T1 ON T6.aid = T1.aid JOIN domain AS T3 ON T3.did = T6.did JOIN domain_publication AS T2 ON T3.did = T2.did JOIN organization AS T5 ON T5.oid = T1.oid JOIN publication AS T4 ON T4.pid = T2.pid WHERE T3.name = 'Databases' AND T5.name = 'University of Michigan'; |
how many states border kentucky?
Schema:
- border_info(T1, border, state_name) | SELECT COUNT(border) AS num_states FROM border_info WHERE state_name = 'kentucky'; |
Find the description of the club called "Tennis Club".?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn) | SELECT ClubDesc FROM Club WHERE ClubName = 'Tennis Club'; |
List all the directors of movies about nuclear weapons?
Schema:
- director(Afghan, name, nationality)
- directed_by(...)
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
- tags(...)
- keyword(keyword) | SELECT T3.name FROM director AS T3 JOIN directed_by AS T2 ON T3.did = T2.did JOIN movie AS T4 ON T4.mid = T2.msid JOIN tags AS T5 ON T5.msid = T4.mid JOIN keyword AS T1 ON T5.kid = T1.id WHERE T1.keyword = 'nuclear weapons'; |
What are the names of circuits that belong to UK or Malaysia?
Schema:
- circuits(circuitId, country, location, name) | SELECT name FROM circuits WHERE country = 'UK' OR country = 'Malaysia'; |
Show the famous titles of the artists with both volumes that lasted more than 2 weeks on top and volumes that lasted less than 2 weeks on top.?
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 T1.Famous_Title FROM artist AS T1 WHERE EXISTS (SELECT 1 FROM volume AS T2 WHERE T1.Artist_ID = T2.Artist_ID AND T2.Weeks_on_Top > 2) AND EXISTS (SELECT 1 FROM volume AS T2 WHERE T1.Artist_ID = T2.Artist_ID AND T2.Weeks_on_Top < 2); |
For each city, list their names in decreasing order by their highest station latitude.?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT city FROM station WHERE city IS NOT NULL GROUP BY city ORDER BY MAX(lat) DESC NULLS LAST; |
Select the project names which are not assigned yet.?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
- AssignedTo(Scientist) | SELECT Name FROM Projects WHERE Code NOT IN (SELECT Project FROM AssignedTo); |
Count the number of United Airlines flights arriving in ASY Airport.?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT COUNT(*) AS num_flights FROM airlines AS T1 JOIN flights AS T2 ON T2.Airline = T1.uid WHERE T1.Airline = 'United Airlines' AND T2.DestAirport = 'ASY'; |
What is the average fee for a CSU campus in the year of 2005?
Schema:
- csu_fees(CampusFee) | SELECT AVG(CampusFee) AS avg_fee FROM csu_fees WHERE "Year" = 2005; |
List every album ordered by album title in ascending order.?
Schema:
- albums(I, title) | SELECT title FROM albums ORDER BY title ASC NULLS LAST; |
What are the titles of courses that are offered in more than one department?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) | SELECT title FROM course WHERE title IS NOT NULL GROUP BY title HAVING COUNT(*) > 1; |
Find the name of the students and their department names sorted by their total credits in ascending order.?
Schema:
- student(COUNT, H, dept_name, name, tot_cred) | SELECT name, dept_name FROM student ORDER BY tot_cred ASC NULLS LAST; |
Show all city with a branch opened in 2001 and a branch with more than 100 membership.?
Schema:
- branch(Address_road, City, Name, Open_year, membership_amount) | SELECT City FROM branch WHERE Open_year = 2001 AND membership_amount > 100; |
What are the staff ids and genders of all staffs whose job title is Department Manager?
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)
- Staff_Department_Assignments(COUNT, date_assigned_to, department_id, job_title_code, staff_id) | SELECT T1.staff_id, T1.staff_gender FROM Staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = 'Department Manager'; |
Find the name of the user who tweeted more than once, and number of tweets tweeted by them.?
Schema:
- user_profiles(email, followers, name, partitionid)
- tweets(I, tweet_text, uid) | SELECT T1.name, COUNT(*) AS num_tweets FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid, T1.name HAVING COUNT(*) > 1; |
Show all allergy types.?
Schema:
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT DISTINCT AllergyType FROM Allergy_Type; |
Find the names of the top 10 airlines that operate the most number of routes.?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- routes(...) | SELECT T1.name, T2.alid FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.name, T2.alid ORDER BY COUNT(*) DESC NULLS LAST LIMIT 10; |
Which event names were used more than twice for party events?
Schema:
- party_events(Event_Name) | SELECT Event_Name FROM party_events WHERE Event_Name IS NOT NULL GROUP BY Event_Name HAVING COUNT(*) > 2; |
How many technicians are there?
Schema:
- technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name) | SELECT COUNT(*) AS num_technicians FROM technician; |
Find the names and phone numbers of customers living in California state.?
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_Addresses(address_type_code)
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT T1.customer_name, T1.customer_phone FROM Customers AS T1 JOIN Customer_Addresses AS T2 ON T1.customer_id = T2.customer_id JOIN Addresses AS T3 ON T2.address_id = T3.address_id WHERE T3.state_province_county = 'California'; |
Return the names of cities, ordered alphabetically.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT Name FROM city ORDER BY Name ASC NULLS LAST; |
Which colleges have both authors with submission score above 90 and authors with submission score below 80?
Schema:
- submission(Author, COUNT, College, Scores) | SELECT College FROM submission WHERE Scores > 90 OR Scores < 80 AND College IS NOT NULL GROUP BY College HAVING COUNT(DISTINCT CASE WHEN Scores > 90 THEN 'High' WHEN Scores < 80 THEN 'Low' END) = 2; |
What papers were written on question answering this year ?
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' AND T3."year" = 2016; |
Show the date of the transcript which shows the least number of results, also list the id.?
Schema:
- Transcript_Contents(student_course_id)
- Transcripts(other_details, transcript_date) | SELECT T2.transcript_date, T1.transcript_id FROM Transcript_Contents AS T1 JOIN Transcripts AS T2 ON T1.transcript_id = T2.transcript_id GROUP BY T1.transcript_id, T2.transcript_date ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
Show total points of all players.?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT SUM(Points) AS total_points FROM player; |
What are the names of all the stores in the largest district by population?
Schema:
- store(Type)
- store_district(...)
- district(City_Area, City_Population, District_name, d) | SELECT T1.Store_Name FROM store AS T1 JOIN store_district AS T2 ON T1.Store_ID = T2.Store_ID WHERE District_ID = (SELECT District_ID FROM district ORDER BY City_Population DESC NULLS LAST LIMIT 1); |
How many adults stay in the room CONRAD SELBIG checked in on Oct 23, 2010?
Schema:
- Reservations(Adults, CheckIn, FirstName, Kids, LastName) | SELECT Adults FROM Reservations WHERE CheckIn = '2010-10-23' AND FirstName = 'CONRAD' AND LastName = 'SELBIG'; |
What are the names of climbers and the corresponding heights of the mountains that they climb?
Schema:
- climber(Country, K, Name, Points)
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more)) | SELECT T1.Name, T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID; |
return me the keywords of " Making database systems usable " .?
Schema:
- publication_keyword(...)
- keyword(keyword)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT T1.keyword FROM publication_keyword AS T3 JOIN keyword AS T1 ON T3.kid = T1.kid JOIN publication AS T2 ON T2.pid = T3.pid WHERE T2.title = 'Making database systems usable'; |
Find the level name of the catalog with the lowest price (in USD).?
Schema:
- Catalog_Contents(capacity, catalog_entry_name, height, next_entry_id, price_in_dollars, price_in_euros, product_stock_number)
- Catalog_Structure(catalog_level_name, catalog_level_number) | SELECT T2.catalog_level_name FROM Catalog_Contents AS T1 JOIN Catalog_Structure AS T2 ON T1.catalog_level_number = T2.catalog_level_number ORDER BY T1.price_in_dollars ASC NULLS LAST LIMIT 1; |
What are the names of the 3 departments with the most courses?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) | SELECT dept_name FROM course WHERE dept_name IS NOT NULL GROUP BY dept_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 3; |
Find the last names of teachers teaching in classroom 109.?
Schema:
- teachers(Classroom, FirstName, LastName) | SELECT LastName FROM teachers WHERE Classroom = 109; |
Does ali farhadi have a paper in eccv in 2016 ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T3.paperId FROM venue AS T4 JOIN paper AS T3 ON T4.venueId = T3.venueId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'ali farhadi' AND T3."year" = 2016 AND T4.venueName = 'eccv'; |
Find the phone number of all the customers and staff.?
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))
- 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 DISTINCT phone_number FROM (SELECT phone_number FROM Customers UNION ALL SELECT phone_number FROM Staff); |
How many policies are listed for the customer named "Dayana Robel"?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Customers_Policies(...) | SELECT COUNT(*) AS num_policies FROM Customers AS T1 JOIN Customers_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID WHERE T1.Customer_name = 'Dayana Robel'; |
what state contains the highest point of those the colorado river traverses?
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 state_name FROM highlow WHERE highest_elevation = (SELECT MAX(highest_elevation) FROM highlow WHERE state_name IN (SELECT traverse FROM river WHERE river_name = 'colorado')); |
List the physicians' employee ids together with their primary affiliation departments' ids.?
Schema:
- Affiliated_With(Department, Physician, PrimaryAffiliation) | SELECT Physician, Department FROM Affiliated_With WHERE PrimaryAffiliation = 1; |
How many schools are there?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type) | SELECT COUNT(*) AS num_schools FROM school; |
give me the best restaurant in the bay area for american food ?
Schema:
- restaurant(...)
- geographic(...)
- location(...) | SELECT T3.house_number, T1.name FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name JOIN location AS T3 ON T1.id = T3.restaurant_id WHERE T2.region = 'bay area' AND T1.food_type = 'american' AND T1.rating = (SELECT MAX(T1.rating) FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name WHERE T2.region = 'bay area' AND T1.food_type = 'american'); |
how many ships are there?
Schema:
- Ship(Built_Year, COUNT, Class, Flag, Name, Type) | SELECT COUNT(*) AS num_ships FROM Ship; |
Count the number of courses.?
Schema:
- Course(CName, Credits, Days) | SELECT COUNT(*) AS num_courses FROM Course; |
What is last date created of votes from the state 'CA'?
Schema:
- VOTES(created, phone_number, state, vote_id) | SELECT MAX(created) AS max_created FROM VOTES WHERE state = 'CA'; |
How many publications were added to the Cell journal this year ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- journal(Theme, homepage, name)
- paperKeyphrase(...) | SELECT DISTINCT COUNT(T3.paperId) AS num_publications FROM paper AS T3 JOIN journal AS T2 ON T3.journalId = T2.journalId JOIN paperKeyphrase AS T1 ON T3.paperId = T1.paperId WHERE T2.journalName = 'Cell' AND T3."year" = 2015; |
What are the IDs of customers who have "Diana" in part of their names?
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_ID FROM Customers WHERE Customer_name LIKE '%Diana%'; |
Find the number of students in each major.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_students, Major FROM Student GROUP BY Major; |
Which head's name has the substring 'Ha'? List the id and name.?
Schema:
- head(age, born_state, head_ID, name) | SELECT head_ID, name FROM head WHERE name LIKE '%Ha%'; |
What are the names and ids of stations that had more than 14 bikes available on average or were installed in December?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
- status(...) | SELECT name, id FROM (SELECT T1.name, T1.id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.station_id IS NOT NULL AND T1.name IS NOT NULL AND T1.id IS NOT NULL GROUP BY T2.station_id, T1.name, T1.id HAVING AVG(T2.bikes_available) > 14 UNION ALL SELECT name, id FROM station WHERE installation_date LIKE '12/%') WHERE name IS NOT NULL AND id IS NOT NULL GROUP BY name, id; |
How many degrees were conferred in "San Jose State University" in 2000?
Schema:
- Campuses(Campus, County, Franc, Location)
- degrees(Campus, Degrees, SUM, Year) | SELECT Degrees FROM Campuses AS T1 JOIN degrees AS T2 ON T1.Id = T2.Campus WHERE T1.Campus = 'San Jose State University' AND T2."Year" = 2000; |
What's the name of the course with most number of enrollments?
Schema:
- Courses(course_description, course_name)
- Student_Enrolment_Courses(...) | SELECT T1.course_name FROM Courses AS T1 JOIN Student_Enrolment_Courses AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the average total score of body builders with height bigger than 200?
Schema:
- body_builder(Clean_Jerk, Snatch, Total)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT AVG(T1.Total) AS avg_total_score FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 200; |
Report the distinct registration date and the election cycle.?
Schema:
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT Registration_Date, Election_Cycle FROM Voting_record; |
List the project details of the projects with the research outcome described with the substring 'Published'.?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
- Project_Outcomes(outcome_code)
- Research_Outcomes(...) | SELECT T1.project_details FROM Projects AS T1 JOIN Project_Outcomes AS T2 ON T1.project_id = T2.project_id JOIN Research_Outcomes AS T3 ON T2.outcome_code = T3.outcome_code WHERE T3.outcome_description LIKE '%Published%'; |
Find the last names of faculties who are members of computer science department.?
Schema:
- Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2) | SELECT T2.LName FROM Department AS T1, Faculty AS T2, Member_of AS T3 WHERE T1.DNO = T3.DNO AND T2.FacID = T3.FacID AND T1.DName = 'Computer Science'; |
Find all users who reviewed restaurant " Mesa Grill "?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state)
- review(i_id, rank, rating, text)
- user_(name) | SELECT T4."name" FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN review AS T3 ON T3.business_id = T1.business_id JOIN user_ AS T4 ON T4.user_id = T3.user_id WHERE T1.name = 'Mesa Grill' AND T2.category_name = 'restaurant'; |
What are the teams that have both wrestlers eliminated by Orton and wrestlers eliminated by Benjamin?
Schema:
- Elimination(Benjam, Eliminated_By, Elimination_Move, T1, Team, Time) | SELECT DISTINCT T1.Team FROM Elimination AS T1 JOIN Elimination AS T2 ON T1.Team = T2.Team WHERE T1.Eliminated_By = 'Orton' AND T2.Eliminated_By = 'Benjamin'; |
How many movie reviews does each director get?
Schema:
- Movie(T1, director, title, year)
- Rating(Rat, mID, rID, stars) | SELECT COUNT(*) AS num_reviews, T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director; |
What are the names of representatives with more than 10000 votes in election?
Schema:
- election(Committee, Date, Delegate, District, Vote_Percent, Votes)
- representative(JO, Lifespan, Name, Party, State, T1) | SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE Votes > 10000; |
what state has the shortest river?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT DISTINCT traverse FROM river WHERE LENGTH = (SELECT MIN(DISTINCT LENGTH) FROM river); |
Give the distinct famous release dates for all artists.?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT DISTINCT Famous_Release_date FROM artist; |
How many persons are not body builders?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- body_builder(Clean_Jerk, Snatch, Total) | SELECT COUNT(*) AS num_persons FROM people WHERE People_ID NOT IN (SELECT People_ID FROM body_builder); |
Find all the forenames of distinct drivers who won in position 1 as driver standing and had more than 20 points?
Schema:
- drivers(forename, nationality, surname)
- driverStandings(...) | SELECT DISTINCT T1.forename FROM drivers AS T1 JOIN driverStandings AS T2 ON T1.driverId = T2.driverId WHERE T2."position" = 1 AND T2.wins = 1 AND T2.points > 20; |
How many papers were written on convolutional neural networks in the past year ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(T3.paperId) AS num_papers FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.keyphraseName = 'convolutional neural networks' AND T3."year" = 2016; |
Show times of elimination of wrestlers with days held more than 50.?
Schema:
- Elimination(Benjam, Eliminated_By, Elimination_Move, T1, Team, Time)
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT T1."Time" FROM Elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = CAST(T2.Wrestler_ID AS TEXT) WHERE TRY_CAST(T2.Days_held AS INT) > 50; |
What are the average access counts of documents that have the functional area description "Acknowledgement"?
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))
- Document_Functional_Areas(...)
- Functional_Areas(...) | SELECT AVG(T1.access_count) AS avg_access_count FROM Documents AS T1 JOIN Document_Functional_Areas AS T2 ON T1.document_code = T2.document_code JOIN Functional_Areas AS T3 ON T2.functional_area_code = T3.functional_area_code WHERE T3.functional_area_description = 'Acknowledgement'; |
What are the names of the people who have no friends who are students?
Schema:
- Person(M, age, city, eng, gender, job, name)
- PersonFriend(M, friend, name) | SELECT name FROM Person WHERE name NOT IN (SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.job = 'student'); |
Find the most prominent max page size among all the products.?
Schema:
- product(COUNT, pages_per_minute_color, product) | SELECT max_page_size FROM product WHERE max_page_size IS NOT NULL GROUP BY max_page_size ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the id of the pet owned by student whose last name is ‘Smith’.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Pet(...) | SELECT T2.PetID FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID WHERE T1.LName = 'Smith'; |
Show the names of high school students and their corresponding number of friends.?
Schema:
- Friend(student_id)
- Highschooler(COUNT, ID, grade, name) | SELECT T2.name, COUNT(*) AS num_friends FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID GROUP BY T1.student_id, T2.name; |
Find the name of airline which runs the most number of routes.?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- routes(...) | SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the lot details of lots associated with transactions whose share count is bigger than 100 and whose type code is "PUR"?
Schema:
- Lots(investor_id, lot_details)
- Transactions_Lots(...)
- Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code) | SELECT T1.lot_details FROM Lots AS T1 JOIN Transactions_Lots AS T2 ON T1.lot_id = T2.transaction_id JOIN Transactions AS T3 ON T2.transaction_id = T3.transaction_id WHERE TRY_CAST(T3.share_count AS DOUBLE) > 100 AND T3.transaction_type_code = 'PUR'; |
Which third party companies have at least 2 maintenance engineers or have at least 2 maintenance contracts? List the company id and name.?
Schema:
- Third_Party_Companies(...)
- Maintenance_Engineers(COUNT, T1, engineer_id, first_name, last_name)
- Maintenance_Contracts(...) | SELECT DISTINCT company_id, company_name FROM (SELECT T1.company_id, T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Engineers AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id, T1.company_name HAVING COUNT(*) >= 2 UNION ALL SELECT T3.company_id, T3.company_name FROM Third_Party_Companies AS T3 JOIN Maintenance_Contracts AS T4 ON T3.company_id = T4.maintenance_contract_company_id GROUP BY T3.company_id, T3.company_name HAVING COUNT(*) >= 2); |
Show origins of all flights with destination Honolulu.?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT origin FROM flight WHERE destination = 'Honolulu'; |
keyphrases used by Luke S Zettlemoyer for each year?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- paperKeyphrase(...)
- writes(...)
- author(...) | SELECT DISTINCT T2.keyphraseId, T3."year" 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 = 'Luke S Zettlemoyer' ORDER BY T3."year", T2.keyphraseId ASC NULLS LAST; |
List the hardware model name and company name for the phone whose screen mode type is "Graphics."?
Schema:
- screen_mode(used_kb)
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) | SELECT T2.Hardware_Model_name, T2.Company_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = 'Graphics'; |
return me the paper 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' ORDER BY T2.citation_num DESC NULLS LAST LIMIT 1; |
which state borders kentucky?
Schema:
- border_info(T1, border, state_name) | SELECT border FROM border_info WHERE state_name = 'kentucky'; |
Retrieve the open and close dates of all the policies associated with the customer whose name contains "Diana"?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Customers_Policies(...) | SELECT T2.Date_Opened, T2.Date_Closed FROM Customers AS T1 JOIN Customers_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID WHERE T1.Customer_name LIKE '%Diana%'; |
How many students are there?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName) | SELECT COUNT(*) AS num_students FROM list; |
How many customers do we have?
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; |
What are all of the products whose name includes the substring "Scanner"?
Schema:
- product(COUNT, pages_per_minute_color, product) | SELECT product FROM product WHERE product LIKE '%Scanner%'; |
List the status shared by more than two roller coaster.?
Schema:
- roller_coaster(DOUBLE, Height, LENGTH, Park, Speed, Status, TRY_CAST) | SELECT Status FROM roller_coaster WHERE Status IS NOT NULL GROUP BY Status HAVING COUNT(*) > 2; |
What is the average unit price of all the tracks?
Schema:
- Track(Milliseconds, Name, UnitPrice) | SELECT AVG(UnitPrice) AS avg_unit_price FROM Track; |
What are the employee ids and job ids for employees who make less than the lowest earning employee with title MK_MAN?
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 EMPLOYEE_ID, JOB_ID FROM employees WHERE SALARY < (SELECT MIN(SALARY) FROM employees WHERE JOB_ID = 'MK_MAN'); |
List the names of pilots in ascending order of rank.?
Schema:
- pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team) | SELECT Pilot_name FROM pilot ORDER BY "Rank" ASC NULLS LAST; |
List the name, date and result of each battle.?
Schema:
- battle(Baldw, bulgarian_commander, date, latin_commander, name, result) | SELECT name, "date", "result" FROM battle; |
Please show the different statuses, ordered by the number of cities that have each.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT Status FROM city WHERE Status IS NOT NULL GROUP BY Status ORDER BY COUNT(*) ASC NULLS LAST; |
Which patient is undergoing the most recent treatment?
Schema:
- Undergoes(DateUndergoes, Patient) | SELECT Patient FROM Undergoes ORDER BY DateUndergoes ASC NULLS LAST LIMIT 1; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.