question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
Find the average hours of all projects.?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT AVG(Hours) AS avg_hours FROM Projects; |
Hom many musicians performed in the song "Flash"?
Schema:
- Performance(...)
- Band(...)
- Songs(Title) | SELECT COUNT(*) AS num_musicians FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = 'Flash'; |
When was the document named "Marry CV" stored? Give me the date.?
Schema:
- All_Documents(Date_Stored, Document_Name, Document_Type_Code) | SELECT Date_Stored FROM All_Documents WHERE Document_Name = 'Marry CV'; |
List the top 10 customers by total gross sales. List customers' first and last name and total gross sales.?
Schema:
- customers(Mart, city, company, country, email, first_name, last_name, phone, state)
- invoices(billing_city, billing_country, billing_state, total) | SELECT T1.first_name, T1.last_name, SUM(T2.total) AS total_gross_sales FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id, T1.first_name, T1.last_name ORDER BY total_gross_sales DESC NULLS LAST LIMIT 10; |
Find the names of scientists who are not working on the project with the highest hours.?
Schema:
- Scientists(Name)
- AssignedTo(Scientist)
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT Name FROM Scientists WHERE Name NOT IN (SELECT T3.Name FROM AssignedTo AS T1 JOIN Projects AS T2 ON T1.Project = T2.Code JOIN Scientists AS T3 ON T1.Scientist = T3.SSN WHERE T2.Hours = (SELECT MAX(Hours) FROM Projects)); |
What are the maximum and minimum number of cows across all farms.?
Schema:
- farm(Cows, Working_Horses) | SELECT MAX(Cows) AS max_cows, MIN(Cows) AS min_cows FROM farm; |
top authors working on ImageNet ?
Schema:
- paperDataset(...)
- dataset(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT COUNT(T4.paperId) AS num_authors, T3.paperId FROM paperDataset AS T2 JOIN dataset AS T1 ON T2.datasetId = T1.datasetId JOIN paper AS T4 ON T4.paperId = T2.paperId JOIN writes AS T3 ON T3.paperId = T4.paperId WHERE T1.datasetName = 'ImageNet' GROUP BY T3.paperId ORDER BY num_authors DESC NULLS LAST; |
Find the number of settlements each claim corresponds to. Show the number together with the claim id.?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled)
- Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount) | SELECT T1.Claim_ID, COUNT(*) AS num_settlements FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID GROUP BY T1.Claim_ID; |
Find the average rating star for each movie that are not reviewed by Brittany Harris.?
Schema:
- Rating(Rat, mID, rID, stars)
- Reviewer(Lew, name, rID) | SELECT mID, AVG(stars) AS avg_stars FROM Rating WHERE mID NOT IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = 'Brittany Harris') GROUP BY mID; |
Find the name of instructors who are advisors of the students from the Math department, and sort the results by students' total credit.?
Schema:
- advisor(s_ID)
- instructor(AVG, M, So, Stat, dept_name, name, salary)
- student(COUNT, H, dept_name, name, tot_cred) | SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_ID = T2.ID JOIN student AS T3 ON T1.s_ID = T3.ID WHERE T3.dept_name = 'Math' ORDER BY T3.tot_cred ASC NULLS LAST; |
How many king beds are there?
Schema:
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT SUM(beds) AS num_beds FROM Rooms WHERE bedType = 'King'; |
Of all players with an overall rating greater than 80, how many are right-footed and left-footed?
Schema:
- Player_Attributes(overall_rating, preferred_foot) | SELECT preferred_foot, COUNT(*) AS num_players FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot; |
Return the address content for the customer whose name is "Maudie Kertzmann".?
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 T3.address_content 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 T1.customer_name = 'Maudie Kertzmann'; |
What are the names of all songs that are ordered by their resolution numbers?
Schema:
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more)) | SELECT song_name FROM song ORDER BY resolution ASC NULLS LAST; |
What are the type and nationality of ships?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT Type, Nationality FROM ship; |
What are the apartment number, start date, and end date of each apartment booking?
Schema:
- Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code)
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count) | SELECT T2.apt_number, T1.booking_start_date, T1.booking_end_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id; |
Show the name of cities in the county that has the largest number of police officers.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- county_public_safety(COUNT, Case_burden, Crime_rate, Location, Name, Police_force, Police_officers, Population, T1) | SELECT Name FROM city WHERE County_ID = (SELECT County_ID FROM county_public_safety ORDER BY Police_officers DESC NULLS LAST LIMIT 1); |
What are the names and locations of all tracks?
Schema:
- track(Location, Name, Seat, Seating, T1, Year_Opened) | SELECT Name, Location FROM track; |
What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
- certificate(eid)
- aircraft(Description, aid, d, distance, name) | SELECT T1.name FROM employee AS T1 JOIN certificate AS T2 ON T1.eid = T2.eid JOIN aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid, T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many hours do the players train on average?
Schema:
- Player(HS, pName, weight, yCard) | SELECT AVG(HS) AS avg_hours FROM Player; |
Find the names of nurses who are nursing an undergoing treatment.?
Schema:
- Undergoes(DateUndergoes, Patient)
- Nurse(Name) | SELECT DISTINCT T2.Name FROM Undergoes AS T1 JOIN Nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID; |
List the names of all routes in alphabetic order.?
Schema:
- Delivery_Routes(route_name) | SELECT route_name FROM Delivery_Routes ORDER BY route_name ASC NULLS LAST; |
What is the minimum snatch score?
Schema:
- body_builder(Clean_Jerk, Snatch, Total) | SELECT MIN(Snatch) AS min_snatch FROM body_builder; |
Which publishers did not publish a book in 1989?
Schema:
- book_club(Author_or_Editor, Book_Title, COUNT, Category, Publ, Publisher, T1) | SELECT Publisher FROM book_club WHERE Publisher NOT IN (SELECT Publisher FROM book_club WHERE "Year" = 1989); |
Find the names of stadiums that the most swimmers have been to.?
Schema:
- record(...)
- event(Date, Event_Attendance, Name, Venue, Year)
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1) | SELECT T3.Name FROM record AS T1 JOIN event AS T2 ON T1.Event_ID = T2.ID JOIN stadium AS T3 ON T3.ID = T2.Stadium_ID GROUP BY T2.Stadium_ID, T3.Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the distinct years in which the competitions type is not "Tournament"?
Schema:
- competition(COUNT, Competition_type, Country, T1, Year) | SELECT DISTINCT "Year" FROM competition WHERE Competition_type != 'Tournament'; |
Find the payment method code used by more than 3 parties.?
Schema:
- Parties(party_email, party_phone, payment_method_code) | SELECT payment_method_code FROM Parties WHERE payment_method_code IS NOT NULL GROUP BY payment_method_code HAVING COUNT(*) > 3; |
Which clubs have one or more members whose advisor is "1121"?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn)
- Member_of_club(...)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT DISTINCT T1.ClubName FROM Club AS T1 JOIN Member_of_club AS T2 ON T1.ClubID = T2.ClubID JOIN Student AS T3 ON T2.StuID = T3.StuID WHERE T3.Advisor = 1121; |
For all directors who have directed more than one movie, what movies have they directed and what are their names?
Schema:
- Movie(T1, director, title, year) | SELECT T1.title, T1.director FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title ORDER BY T1.director, T1.title ASC NULLS LAST; |
Return the name and id of the furniture with the highest market rate.?
Schema:
- furniture(Furniture_ID, Market_Rate, Name) | SELECT Name, Furniture_ID FROM furniture ORDER BY Market_Rate DESC NULLS LAST LIMIT 1; |
How many authors published at sigcse in 2010 ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT COUNT(T2.paperId) AS num_authors FROM venue AS T3 JOIN paper AS T2 ON T3.venueId = T2.venueId JOIN writes AS T1 ON T1.paperId = T2.paperId WHERE T2."year" = 2010 AND T3.venueName = 'sigcse'; |
List the name for storms and the number of affected regions for each storm.?
Schema:
- storm(Damage_millions_USD, Dates_active, Name, Number_Deaths)
- affected_region(Region_id) | SELECT T1.Name, COUNT(*) AS num_affected_regions FROM storm AS T1 JOIN affected_region AS T2 ON T1.Storm_ID = T2.Storm_ID GROUP BY T1.Storm_ID, T1.Name; |
Which teachers teach the student named EVELINA BROMLEY? Give me the first and last name of the teachers.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
- teachers(Classroom, FirstName, LastName) | SELECT T2.FirstName, T2.LastName FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T1.FirstName = 'EVELINA' AND T1.LastName = 'BROMLEY'; |
Which catalog content has the smallest capacity? Return the catalog entry name.?
Schema:
- Catalog_Contents(capacity, catalog_entry_name, height, next_entry_id, price_in_dollars, price_in_euros, product_stock_number) | SELECT catalog_entry_name FROM Catalog_Contents ORDER BY capacity ASC NULLS LAST LIMIT 1; |
List the hardware model name for the phones that were produced by "Nokia Corporation" or 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 DISTINCT T2.Hardware_Model_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.Type = 'Graphics' OR T2.Company_name = 'Nokia Corporation'; |
which papers in acl 2012 had Parsing in them ?
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 = 'Parsing' AND T3."year" = 2012 AND T4.venueName = 'acl'; |
What is the least common faculty rank?
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; |
For each reviewer id, what is the title and rating for the movie with the smallest rating?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year) | SELECT T2.title, T1.rID, T1.stars, MIN(T1.stars) AS min_stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.rID, T2.title, T1.stars; |
How many papers were accepted at nature communications 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'; |
How many papers are "Atsushi Ohori" the author of?
Schema:
- Authors(fname, lname)
- Authorship(...)
- Papers(title) | SELECT COUNT(*) AS num_papers FROM Authors AS T1 JOIN Authorship AS T2 ON T1.authID = T2.authID JOIN Papers AS T3 ON T2.paperID = T3.paperID WHERE T1.fname = 'Atsushi' AND T1.lname = 'Ohori'; |
Which reign is the most common among wrestlers?
Schema:
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT Reign FROM wrestler WHERE Reign IS NOT NULL GROUP BY Reign ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the addresses of the course authors who teach the course with name "operating system" or "data structure".?
Schema:
- Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name)
- Courses(course_description, course_name) | SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = 'operating system' OR T2.course_name = 'data structure'; |
give me a good arabic restaurant on buchanan in san francisco ?
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; |
How many students are over 18 and do not have allergy to food type or animal type?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Allergy(Allergy, COUNT, StuID)
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT COUNT(*) AS num_students FROM Student WHERE Age > 18 AND StuID NOT IN (SELECT StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = 'food' OR T2.AllergyType = 'animal'); |
What are the ids and names of customers with addressed that contain WY and who do not use a credit card for payment?
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, customer_name FROM Customers WHERE customer_address LIKE '%WY%' AND payment_method_code != 'Credit Card'; |
Find the number of routes and airport name for each source airport, order the results by decreasing number of routes.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
- routes(...) | SELECT COUNT(*) AS num_routes, T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid GROUP BY T1.name ORDER BY num_routes DESC NULLS LAST; |
How many customers does Steve Johnson support?
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 COUNT(*) AS num_customers FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = 'Steve' AND T1.last_name = 'Johnson'; |
List each owner's first name, last name, and the size of his for her dog.?
Schema:
- Owners(email_address, first_name, last_name, state)
- Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight) | SELECT T1.first_name, T1.last_name, T2.size_code FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id; |
Find all information of all the products with a price between $60 and $120.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT * FROM Products WHERE Price BETWEEN 60 AND 120; |
What is minimum hours of the students playing in different position?
Schema:
- Tryout(COUNT, EX, T1, cName, decision, pPos)
- Player(HS, pName, weight, yCard) | SELECT MIN(T2.HS) AS min_hours, T1.pPos FROM Tryout AS T1 JOIN Player AS T2 ON T1.pID = T2.pID GROUP BY T1.pPos; |
List the titles of all items in alphabetic order .?
Schema:
- item(title) | SELECT title FROM item ORDER BY title ASC NULLS LAST; |
How many movies did " Quentin Tarantino " direct before 2002 and after 2010 ?
Schema:
- director(Afghan, name, nationality)
- directed_by(...)
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
- made_by(...)
- producer(...) | SELECT COUNT(DISTINCT T4.title) AS num_movies FROM director AS T3 JOIN directed_by AS T2 ON T3.did = T2.did JOIN movie AS T4 ON T4.mid = T2.msid JOIN made_by AS T5 ON T4.mid = T5.msid JOIN producer AS T1 ON T1.pid = T5.pid WHERE T3.name = 'Quentin Tarantino' AND T4.release_year < 2010 AND T4.release_year > 2002; |
what is the capital of the state that borders the state that borders texas?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
- border_info(T1, border, state_name) | SELECT capital FROM state WHERE state_name IN (SELECT border FROM border_info WHERE state_name IN (SELECT border FROM border_info WHERE state_name = 'texas')); |
Which major has most number of students?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Major FROM Student WHERE Major IS NOT NULL GROUP BY Major ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the number of routes that have destination John F Kennedy International Airport.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
- routes(...) | SELECT COUNT(*) AS num_routes FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE T1.name = 'John F Kennedy International Airport'; |
Which grade is studying in room 105?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName) | SELECT DISTINCT Grade FROM list WHERE Classroom = 105; |
Find the number of customers in total.?
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; |
Return the average money requested across all entrepreneurs.?
Schema:
- entrepreneur(COUNT, Company, Investor, Money_Requested) | SELECT AVG(Money_Requested) AS avg_money_requested FROM entrepreneur; |
What are the names and type codes of products?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT Product_Name, Product_Type_Code FROM Products; |
Find the name and address of the customers who have both New and Pending orders.?
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 DISTINCT T1.customer_name, T1.customer_address FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code IN ('New', 'Pending'); |
What are the names of all games played by Linda Smith?
Schema:
- Plays_Games(GameID, Hours_Played, StuID)
- Video_Games(COUNT, Dest, GName, GType, onl)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT GName FROM Plays_Games AS T1 JOIN Video_Games AS T2 ON T1.GameID = T2.GameID JOIN Student AS T3 ON T3.StuID = T1.StuID WHERE T3.LName = 'Smith' AND T3.Fname = 'Linda'; |
How many tasks are there in total?
Schema:
- Tasks(...) | SELECT COUNT(*) AS num_tasks FROM Tasks; |
what is the largest city in wyoming by population?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT city_name FROM city WHERE population = (SELECT MAX(population) FROM city WHERE state_name = 'wyoming') AND state_name = 'wyoming'; |
Find the first names of all the authors who have written a paper with title containing the word "Functional".?
Schema:
- Authors(fname, lname)
- Authorship(...)
- Papers(title) | SELECT T1.fname FROM Authors AS T1 JOIN Authorship AS T2 ON T1.authID = T2.authID JOIN Papers AS T3 ON T2.paperID = T3.paperID WHERE T3.title LIKE '%Functional%'; |
What are the codes and names of the cheapest products in each category?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT Code, Name, MIN(Price) AS min_price FROM Products GROUP BY Name, Code; |
Which film actor (actress) starred the most films? List his or her first name, last name and actor id.?
Schema:
- film_actor(...)
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT T2.first_name, T2.last_name, T2.actor_id FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.first_name, T2.last_name, T2.actor_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show the institution type with an institution founded after 1990 and an institution with at least 1000 enrollment.?
Schema:
- Institution(COUNT, Enrollment, Founded, Type) | SELECT Type FROM Institution WHERE Founded > 1990 AND Enrollment >= 1000; |
Give the ids of documents that have expenses and contain the letter s in their names.?
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))
- Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID) | SELECT T1.Document_ID FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.Document_ID = T2.Document_ID WHERE T1.Document_Name LIKE '%s%'; |
List the names and locations of all stations ordered by their yearly entry exit and interchange amounts.?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT Name, Location FROM station ORDER BY Annual_entry_exit, Annual_interchanges ASC NULLS LAST; |
Give the flight numbers of flights leaving from APG.?
Schema:
- flights(DestAirport, FlightNo, SourceAirport) | SELECT FlightNo FROM flights WHERE SourceAirport = 'APG'; |
What are the ids of documents with the type code CV that do not have expenses.?
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))
- Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID) | SELECT Document_ID FROM Documents WHERE Document_Type_Code = 'CV' AND Document_ID NOT IN (SELECT Document_ID FROM Documents_with_Expenses); |
What are each owner's first name and their dogs's name?
Schema:
- Owners(email_address, first_name, last_name, state)
- Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight) | SELECT T1.first_name, T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id; |
Among the procedures that cost more than 1000, which were not specialized in by physician John Wen?
Schema:
- Procedures(Cost, Name)
- Physician(I, Name)
- Trained_In(...) | SELECT DISTINCT Name FROM Procedures WHERE Cost > 1000 AND Name NOT IN (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'); |
return me all the organizations in Databases area located in " North America " .?
Schema:
- domain_author(...)
- author(...)
- domain(...)
- organization(continent, homepage, name) | SELECT T2.name FROM domain_author AS T4 JOIN author AS T1 ON T4.aid = T1.aid JOIN domain AS T3 ON T3.did = T4.did JOIN organization AS T2 ON T2.oid = T1.oid WHERE T3.name = 'Databases' AND T2.continent = 'North America'; |
What are names of the movies that are either made after 2000 or reviewed by Brittany Harris?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year)
- Reviewer(Lew, name, rID) | SELECT DISTINCT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Brittany Harris' OR T2."year" > 2000; |
Show the flight number and distance of the flight with maximum price.?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT flno, distance FROM flight ORDER BY price DESC NULLS LAST LIMIT 1; |
Show the names of members and the location of the performances they attended.?
Schema:
- member_attendance(...)
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
- performance(Attendance, COUNT, Date, Location, T1) | SELECT T2.Name, T3.Location FROM member_attendance AS T1 JOIN member_ AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID; |
Tell me the employee id of the head of the department with the least employees.?
Schema:
- Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2) | SELECT Head FROM Department WHERE DepartmentID IS NOT NULL AND Head IS NOT NULL GROUP BY DepartmentID, Head ORDER BY COUNT(DepartmentID) ASC NULLS LAST LIMIT 1; |
What is the total and maximum duration of trips with bike id 636?
Schema:
- trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code) | SELECT SUM(duration) AS total_duration, MAX(duration) AS max_duration FROM trip WHERE bike_id = 636; |
What are the names of the directors who created a movie with a 5 star rating, and what was the name of those movies?
Schema:
- Movie(T1, director, title, year)
- Rating(Rat, mID, rID, stars) | SELECT T1.director, T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5; |
What is the average salary for each job title?
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))
- jobs(JOB_TITLE, diff) | SELECT JOB_TITLE, AVG(SALARY) AS avg_salary FROM employees AS T1 JOIN jobs AS T2 ON T1.JOB_ID = T2.JOB_ID GROUP BY T2.JOB_TITLE; |
What is the customer id, first and last name with most number of accounts.?
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 T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id, T2.customer_first_name, T2.customer_last_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show the names of phones and the districts of markets they are on.?
Schema:
- phone_market(...)
- market(Country, Number_cities)
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) | SELECT T3.Name, T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = CAST(T3.Phone_ID AS TEXT); |
Find the name of all customers.?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT customer_name FROM Customers; |
which state has the largest 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 MAX(density) FROM state); |
what are the states?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM state; |
Find the ids of the problems reported after 1978-06-26.?
Schema:
- Problems(date_problem_reported, problem_id) | SELECT problem_id FROM Problems WHERE date_problem_reported > DATE '1978-06-26'; |
What are the names and years of all races that had a driver with the last name Lewis?
Schema:
- results(...)
- races(date, name)
- drivers(forename, nationality, surname) | SELECT T2.name, T2."year" FROM results AS T1 JOIN races AS T2 ON T1.raceId = T2.raceId JOIN drivers AS T3 ON T1.driverId = T3.driverId WHERE T3.forename = 'Lewis'; |
Find the number of tips written in each month?
Schema:
- tip(month, text) | SELECT COUNT(DISTINCT "text") AS num_tips, "month" FROM tip GROUP BY "month"; |
return me the number of journals which have papers by " H. V. Jagadish " .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name)
- writes(...)
- author(...) | SELECT COUNT(DISTINCT T2.name) AS num_journals FROM publication AS T4 JOIN journal AS T2 ON T4.jid = T2.jid JOIN writes AS T3 ON T3.pid = T4.pid JOIN author AS T1 ON T3.aid = T1.aid WHERE T1.name = 'H. V. Jagadish'; |
What is the campus fee for San Jose State University in 1996?
Schema:
- Campuses(Campus, County, Franc, Location)
- csu_fees(CampusFee) | SELECT CampusFee FROM Campuses AS T1 JOIN csu_fees AS T2 ON T1.Id = T2.Campus WHERE T1.Campus = 'San Jose State University' AND T2."Year" = 1996; |
Eduardo Martins is a customer at which company?
Schema:
- customers(Mart, city, company, country, email, first_name, last_name, phone, state) | SELECT company FROM customers WHERE first_name = 'Eduardo' AND last_name = 'Martins'; |
List of papers by subhasis chaudhuri?
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 = 'subhasis chaudhuri'; |
What is the car model with the highest mpg ?
Schema:
- car_names(COUNT, Model)
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year) | SELECT T1.Model FROM car_names AS T1 JOIN cars_data AS T2 ON T1.MakeId = T2.Id ORDER BY T2.MPG DESC NULLS LAST LIMIT 1; |
When was the school with the largest enrollment founded?
Schema:
- university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School) | SELECT Founded FROM university ORDER BY Enrollment DESC NULLS LAST LIMIT 1; |
Find the number of students in one classroom.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName) | SELECT COUNT(*) AS num_students, Classroom FROM list GROUP BY Classroom; |
What is the year and semester with the most courses?
Schema:
- section(COUNT, JO, Spr, T1, course_id, semester, year) | SELECT semester, "year" FROM section GROUP BY semester, "year" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the first name and major of the students who are not allegry to soy.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Allergy(Allergy, COUNT, StuID) | SELECT Fname, Major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_Allergy WHERE Allergy = 'Soy'); |
Where us the club named "Tennis Club" located?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn) | SELECT ClubLocation FROM Club WHERE ClubName = 'Tennis Club'; |
Find the number of cartoons directed by each of the listed directors.?
Schema:
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by) | SELECT COUNT(*) AS num_cartoons, Directed_by FROM Cartoon GROUP BY Directed_by; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.