question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
how many jamerican cuisine are there in santa cruz county ?
Schema:
- restaurant(...)
- geographic(...) | SELECT COUNT(*) AS num_restaurants FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name WHERE T2.county = 'santa cruz county' AND T1.name = 'jamerican cuisine'; |
Find the state, account type, and credit score of the customer whose number of loan is 0.?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) | SELECT state, acc_type, credit_score FROM customer WHERE no_of_loans = 0; |
List the distinct ranges of the mountains with the top 3 prominence.?
Schema:
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more)) | SELECT "Range" FROM mountain GROUP BY "Range" ORDER BY AVG(Prominence) DESC NULLS LAST LIMIT 3; |
What are the names of the technicians by ascending order of age?
Schema:
- technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name) | SELECT name FROM technician ORDER BY Age ASC NULLS LAST; |
Please list the location and the winning aircraft name.?
Schema:
- aircraft(Description, aid, d, distance, name)
- match_(Competition, Date, Match_ID, Venue) | SELECT T2.Location, T1.Aircraft FROM aircraft AS T1 JOIN match_ AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft; |
Give me the description of the service type that offers not only the photo product but also the film product.?
Schema:
- Ref_Service_Types(...)
- Services(Service_Type_Code, Service_name) | SELECT DISTINCT T1.Service_Type_Description FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Name = 'photo' AND T1.Service_Type_Code IN (SELECT Service_Type_Code FROM Services WHERE Product_Name = 'film'); |
What are the issue dates of volumes associated with the artist aged 23 or younger?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
- volume(Artist_ID, Issue_Date, Song, Weeks_on_Top) | SELECT Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Age <= 23; |
papers by brian curless in convolution topic?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T1.authorId, T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T5 ON T2.keyphraseId = T5.keyphraseId JOIN paper AS T3 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 = 'brian curless' AND T5.keyphraseName = 'convolution'; |
What are the full name, hire date, salary, and department id for employees without the letter M in their first name?
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 FIRST_NAME, LAST_NAME, HIRE_DATE, SALARY, DEPARTMENT_ID FROM employees WHERE FIRST_NAME NOT LIKE '%M%'; |
What are the names of the technicians that are assigned to repair machines with more point values than 70?
Schema:
- repair_assignment(...)
- machine(...)
- technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name) | SELECT T3.name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.Machine_ID = T2.Machine_ID JOIN technician AS T3 ON T1.technician_id = T3.technician_id WHERE T2.value_points > 70; |
With which kind of payment method were the least number of payments processed?
Schema:
- Payments(Amount_Payment, COUNT, Date_Payment_Made, Payment_ID, Payment_Method_Code, V, amount_due, amount_paid, payment_date, payment_type_code) | SELECT Payment_Method_Code FROM Payments WHERE Payment_Method_Code IS NOT NULL GROUP BY Payment_Method_Code ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
What is the name of the customer who has greatest total loan amount?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id)
- loan(...) | SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_ID = T2.cust_ID GROUP BY T1.cust_name ORDER BY SUM(T2.amount) DESC NULLS LAST LIMIT 1; |
What are the names of the tourist attractions Vincent and Marcelle visit?
Schema:
- Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more))
- Visitors(Tourist_Details)
- Visits(Visit_Date) | SELECT T1.Name FROM Tourist_Attractions AS T1 WHERE EXISTS (SELECT 1 FROM Visitors AS T2 JOIN Visits AS T3 ON T2.Tourist_ID = T3.Tourist_ID WHERE T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_Details = 'Vincent') AND EXISTS (SELECT 1 FROM Visitors AS T2 JOIN Visits AS T3 ON T2.Tourist_ID = T3.Tourist_ID WHERE T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_Details = 'Marcelle'); |
How many products are not made by Sony?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT COUNT(DISTINCT Name) AS num_products FROM Products WHERE Name NOT IN (SELECT T1.Name FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code WHERE T2.Name = 'Sony'); |
What are the titles of courses without prerequisites?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- prereq(...) | SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq); |
Parsing papers from ACL 2014 using 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 roles did staff members play between '2003-04-19 15:06:20' and '2016-03-15 00:33:18'?
Schema:
- Project_Staff(COUNT, date_from, date_to, role_code) | SELECT role_code FROM Project_Staff WHERE date_from >= '2003-04-19 15:06:20' AND date_to <= '2016-03-15 00:33:18'; |
Give the code of the airport with the least flights.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT T1.AirportCode FROM airports AS T1 JOIN flights AS T2 ON T1.AirportCode = T2.DestAirport OR T1.AirportCode = T2.SourceAirport GROUP BY T1.AirportCode ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
Return the name, location and district of all shops in descending order of number of products.?
Schema:
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT Name, Location, District FROM shop ORDER BY Number_products DESC NULLS LAST; |
How many distinct nationalities are there?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT COUNT(DISTINCT Nationality) AS num_nationalities FROM people; |
List the most common type of artworks.?
Schema:
- artwork(COUNT, Name, Type) | SELECT Type FROM artwork WHERE Type IS NOT NULL GROUP BY Type ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
List the names of editors that are not on any journal committee.?
Schema:
- editor(Age, COUNT, Name)
- journal_committee(...) | SELECT Name FROM editor WHERE Editor_ID NOT IN (SELECT Editor_ID FROM journal_committee); |
How many dog pets are raised by female students?
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 COUNT(*) AS num_dogs FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID JOIN Pets AS T3 ON T2.PetID = T3.PetID WHERE T1.Sex = 'F' AND T3.PetType = 'dog'; |
Which manufacturer has the most number of shops? List its name and year of opening.?
Schema:
- manufacturer(Manufacturer_ID, Name, Open_Year) | SELECT Open_Year, Name FROM manufacturer ORDER BY Num_of_Shops DESC NULLS LAST LIMIT 1; |
How many tracks belong to rock genre?
Schema:
- Genre(Name)
- Track(Milliseconds, Name, UnitPrice) | SELECT COUNT(*) AS num_tracks FROM Genre AS T1 JOIN Track AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Rock'; |
Show all the ranks and the number of male and female faculty for each rank.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT "Rank", Sex, COUNT(*) AS num_faculty FROM Faculty GROUP BY "Rank", Sex; |
best paper in TACL 2014 ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...)
- venue(venueId, venueName) | SELECT DISTINCT COUNT(DISTINCT T3.citingPaperId) AS num_citations, T1.paperId FROM paper AS T1 JOIN cite AS T3 ON T1.paperId = T3.citedPaperId JOIN venue AS T2 ON T2.venueId = T1.venueId WHERE T1."year" = 2014 AND T2.venueName = 'TACL' GROUP BY T1.paperId ORDER BY num_citations DESC NULLS LAST; |
Count the number of distinct names associated with the photos.?
Schema:
- Photos(Name) | SELECT COUNT(DISTINCT Name) AS num_names FROM Photos; |
What are the names of airports in Aberdeen?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT AirportName FROM airports WHERE City = 'Aberdeen'; |
Who owns the youngest dog? Give me his or her last 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.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T2.age = (SELECT MIN(age) FROM Dogs); |
What is the description of the most popular role among 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); |
Show the album names, ids and the number of tracks for each album.?
Schema:
- Album(Title)
- Track(Milliseconds, Name, UnitPrice) | SELECT T1.Title, T2.AlbumId, COUNT(*) AS num_tracks FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T1.Title, T2.AlbumId; |
What is the average price of wines produced in appelations in Sonoma County?
Schema:
- appellations(Area, County)
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT AVG(T2.Price) AS avg_price FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Sonoma'; |
What are the names of wines that are more expensive then all wines made in the year 2006?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT Name FROM wine WHERE Price > (SELECT MAX(Price) FROM wine WHERE "Year" = 2006); |
How many documents correspond with each project id?
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, COUNT(*) AS num_documents FROM Documents GROUP BY Project_ID; |
What are the last names of employees who serve at most 20 customers?
Schema:
- Customer(Email, FirstName, LastName, State, lu)
- Employee(BirthDate, City, FirstName, LastName, Phone) | SELECT T1.LastName FROM Customer AS T1 JOIN Employee AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId, T1.LastName HAVING COUNT(*) <= 20; |
How many accounts does the customer with first name Art and last name Turcotte have?
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 COUNT(*) AS num_accounts FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Art' AND T2.customer_last_name = 'Turcotte'; |
Find the titles of all movies not reviewed by Chris Jackson.?
Schema:
- Movie(T1, director, title, year)
- Rating(Rat, mID, rID, stars)
- Reviewer(Lew, name, rID) | SELECT DISTINCT title FROM Movie WHERE title NOT IN (SELECT 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 = 'Chris Jackson'); |
What are the names of artists that have not had any exhibitions?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
- exhibition(Theme, Ticket_Price, Year) | SELECT Name FROM artist WHERE Artist_ID NOT IN (SELECT Artist_ID FROM exhibition); |
Return the titles and directors of films that were never in the market of China.?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
- film_market_estimation(High_Estimate, Low_Estimate, Type)
- market(Country, Number_cities) | SELECT Title, Director FROM film WHERE Film_ID NOT IN (SELECT Film_ID FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID WHERE Country = 'China'); |
For each company, return the company name and the name of the building its office is located in.?
Schema:
- Office_locations(...)
- buildings(Height, Status, Stories, name)
- Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name) | SELECT T3.name, T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id; |
Show the name and the release year of the song by the youngest singer.?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT Song_Name, Song_release_year FROM singer ORDER BY Age ASC NULLS LAST LIMIT 1; |
What is the document type name and the document type description and creation date for all the documents?
Schema:
- Ref_Document_Types(Document_Type_Code, Document_Type_Description, Document_Type_Name, document_type_code, document_type_description)
- 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 T1.Document_Type_Name, T1.Document_Type_Description, T2.Document_Date FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code; |
Find the number of different cities which banks are located at.?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state) | SELECT COUNT(DISTINCT city) AS num_cities FROM bank; |
What are the highest cost, lowest cost and average cost of procedures?
Schema:
- Procedures(Cost, Name) | SELECT MAX(Cost) AS max_cost, MIN(Cost) AS min_cost, AVG(Cost) AS avg_cost FROM Procedures; |
How many friends does Dan have?
Schema:
- Person(M, age, city, eng, gender, job, name)
- PersonFriend(M, friend, name) | SELECT COUNT(T2.friend) AS num_friends FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan'; |
give me names of all compatible browsers and accelerators in the descending order of compatible year?
Schema:
- accelerator_compatible_browser(...)
- browser(id, market_share, name)
- Web_client_accelerator(Client, Operating_system) | SELECT T2.name, T3.name FROM accelerator_compatible_browser AS T1 JOIN browser AS T2 ON T1.browser_id = T2.id JOIN Web_client_accelerator AS T3 ON T1.accelerator_id = T3.id ORDER BY T1.compatible_since_year DESC NULLS LAST; |
how many states have a city named springfield?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT COUNT(state_name) AS num_states FROM city WHERE city_name = 'springfield'; |
What are the movie titles and average rating of the movies with the lowest average rating?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year) | SELECT T2.title, AVG(T1.stars) AS avg_rating FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID, T2.title ORDER BY avg_rating ASC NULLS LAST LIMIT 1; |
Return all distinct detention type codes.?
Schema:
- Detention(detention_summary, detention_type_code) | SELECT DISTINCT detention_type_code FROM Detention; |
give me the lakes in california?
Schema:
- lake(lake_name, state_name) | SELECT lake_name FROM lake WHERE state_name = 'california'; |
How many students who are female are allergic to milk or eggs?
Schema:
- Has_Allergy(Allergy, COUNT, StuID)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_students FROM Has_Allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Sex = 'F' AND T1.Allergy = 'Milk' OR T1.Allergy = 'Eggs'; |
In what years did a movie receive a 4 or 5 star rating, and list the years from oldest to most recently?
Schema:
- Movie(T1, director, title, year)
- Rating(Rat, mID, rID, stars) | SELECT DISTINCT "year" FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1."year" ASC NULLS LAST; |
which state has the highest point?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT state_name FROM highlow WHERE highest_elevation = (SELECT MAX(highest_elevation) FROM highlow); |
List the first name of all the professionals along with the description of the treatment they have done.?
Schema:
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street)
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id)
- Treatment_Types(...) | SELECT DISTINCT T1.first_name, T3.treatment_type_description FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id JOIN Treatment_Types AS T3 ON T2.treatment_type_code = T3.treatment_type_code; |
Find the names of the companies whose headquarters are not located in "USA".?
Schema:
- Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name) | SELECT name FROM Companies WHERE Headquarters != 'USA'; |
Find the number of professors in accounting department.?
Schema:
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT COUNT(*) AS num_professors FROM PROFESSOR AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE WHERE DEPT_NAME = 'Accounting'; |
What are the investors that have invested in at least two entrepreneurs?
Schema:
- entrepreneur(COUNT, Company, Investor, Money_Requested) | SELECT Investor FROM entrepreneur WHERE Investor IS NOT NULL GROUP BY Investor HAVING COUNT(*) >= 2; |
List of authors in acl 2016?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT T1.authorId FROM venue AS T3 JOIN paper AS T2 ON T3.venueId = T2.venueId JOIN writes AS T1 ON T1.paperId = T2.paperId WHERE T2."year" = 2016 AND T3.venueName = 'acl'; |
Find the name and age of the person who is a friend of both Dan and Alice.?
Schema:
- Person(M, age, city, eng, gender, job, name)
- PersonFriend(M, friend, name) | SELECT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' AND T1.name IN (SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice'); |
through which states does the ohio flow?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT traverse FROM river WHERE river_name = 'ohio'; |
What is the aircraft name for the flight with number 99?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more))
- aircraft(Description, aid, d, distance, name) | SELECT T2.name FROM flight AS T1 JOIN aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99; |
List all different genre types.?
Schema:
- genres(name) | SELECT DISTINCT name FROM genres; |
What are project ids of projects that have 2 or more 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 HAVING COUNT(*) >= 2; |
Find the name and capacity of the dorm with least number of amenities.?
Schema:
- Dorm(dorm_name, gender, student_capacity)
- Has_amenity(dormid)
- Dorm_amenity(amenity_name) | SELECT T1.dorm_name, T1.student_capacity FROM Dorm AS T1 JOIN Has_amenity AS T2 ON T1.dormid = T2.dormid JOIN Dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid, T1.dorm_name, T1.student_capacity ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
Show all region code and region name sorted by the codes.?
Schema:
- region(Label, Region_code, Region_name) | SELECT Region_code, Region_name FROM region ORDER BY Region_code ASC NULLS LAST; |
What are the distinct id and type of the thing that has the status 'Close' or has a status record before the date '2017-06-19 02:59:21'?
Schema:
- Timed_Status_of_Things(Status_of_Thing_Code)
- Things(...) | SELECT DISTINCT T2.thing_id, T2.Type_of_Thing_Code FROM Timed_Status_of_Things AS T1 JOIN Things AS T2 ON T1.thing_id = T2.thing_id WHERE T1.Status_of_Thing_Code = 'Close' OR T1.Date_and_Date < '2017-06-19 02:59:21'; |
What are the names of instructors who have taught C Programming courses?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary)
- teaches(ID, Spr, semester)
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) | SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.title = 'C Programming'; |
What are all the distinct participant ids who attended any events?
Schema:
- Participants_in_Events(COUNT, Event_ID, Participant_ID) | SELECT COUNT(DISTINCT Participant_ID) AS num_participants FROM Participants_in_Events; |
What are the name of the countries where there is not a single car maker?
Schema:
- countries(...)
- car_makers(...) | SELECT CountryName FROM countries WHERE CountryName NOT IN (SELECT T1.CountryName FROM countries AS T1 JOIN car_makers AS T2 ON T1.CountryId = T2.CountryId); |
What is the average number of gold medals for clubs?
Schema:
- club_rank(Gold, Silver, Total) | SELECT AVG(Gold) AS avg_gold_medals FROM club_rank; |
papers with at least 5 citations?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...) | SELECT DISTINCT T2.citingPaperId FROM paper AS T1 JOIN cite AS T2 ON T1.paperId = T2.citedPaperId GROUP BY T2.citingPaperId HAVING COUNT(DISTINCT T2.citedPaperId) >= 5; |
What is the first and last name of the faculty participating in the most activities?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
- Faculty_Participates_in(FacID) | SELECT T1.Fname, T1.Lname FROM Faculty AS T1 JOIN Faculty_Participates_in AS T2 ON T1.FacID = T2.FacID GROUP BY T1.FacID, T1.Fname, T1.Lname ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Return the names of countries that have players that play the Forward position, as well as players who play the Defender position.?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team) | SELECT DISTINCT T1.Country_name FROM (SELECT T1.Country_name, T1.Country_id FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2."Position" = 'Forward') AS T1 JOIN (SELECT T1.Country_name, T1.Country_id FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2."Position" = 'Defender') AS T2 ON T1.Country_name = T2.Country_name AND T1.Country_id = T2.Country_id; |
Show the names of festivals that have nominated artworks of type "Program Talent Show".?
Schema:
- nomination(...)
- artwork(COUNT, Name, Type)
- festival_detail(Chair_Name, Festival_Name, Location, T1, Year) | SELECT T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID WHERE T2.Type = 'Program Talent Show'; |
Show the order ids and the number of items in each order.?
Schema:
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) | SELECT order_id, COUNT(*) AS num_items FROM Order_Items GROUP BY order_id; |
What are the maximum scores the team Boston Red Stockings got when the team won in postseason?
Schema:
- postseason(ties)
- team(Name) | SELECT MAX(T1.wins) AS max_wins FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings'; |
How many papers were published in nature communications 2015 conference ?
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 are the names and salaries of instructors who advises students in the History department?
Schema:
- advisor(s_ID)
- instructor(AVG, M, So, Stat, dept_name, name, salary)
- student(COUNT, H, dept_name, name, tot_cred) | SELECT T2.name, T2.salary 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 = 'History'; |
Show budget type codes and the number of documents in each budget type.?
Schema:
- Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID) | SELECT Budget_Type_Code, COUNT(*) AS num_documents FROM Documents_with_Expenses GROUP BY Budget_Type_Code; |
What are the names of the scientists, and how many projects are each of them working on?
Schema:
- Scientists(Name)
- AssignedTo(Scientist) | SELECT COUNT(*) AS num_projects, T1.Name FROM Scientists AS T1 JOIN AssignedTo AS T2 ON T1.SSN = T2.Scientist GROUP BY T1.Name; |
Show the authors of submissions and the acceptance results of their submissions.?
Schema:
- Acceptance(...)
- submission(Author, COUNT, College, Scores) | SELECT T2.Author, T1."Result" FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID; |
What is the total number of hours for all projects?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT SUM(Hours) AS total_hours FROM Projects; |
How many employees who are IT staff are from each city?
Schema:
- employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) | SELECT COUNT(*) AS num_employees, city FROM employees WHERE title = 'IT Staff' GROUP BY city; |
What are the maximum duration and resolution of all songs, for each language, ordered alphabetically by language?
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 MAX(TRY_CAST(T1.duration AS DOUBLE)) AS max_duration, MAX(T2.resolution) AS max_resolution, T2.languages FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.languages ORDER BY T2.languages ASC NULLS LAST; |
Give the country id and corresponding count of cities in each country.?
Schema:
- locations(COUNTRY_ID) | SELECT COUNTRY_ID, COUNT(*) AS num_cities FROM locations GROUP BY COUNTRY_ID; |
List official names of cities in descending order of population.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT Official_Name FROM city ORDER BY Population DESC NULLS LAST; |
Show the names of members in ascending order of their rank in rounds.?
Schema:
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
- round(...) | SELECT T1.Name FROM member_ AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID ORDER BY Rank_in_Round ASC NULLS LAST; |
How many poker players are there?
Schema:
- poker_player(Best_Finish, Earnings, Final_Table_Made, Money_Rank) | SELECT COUNT(*) AS num_players FROM poker_player; |
Who is the nominee who has been nominated for the most musicals?
Schema:
- musical(Award, COUNT, Name, Nom, Nominee, Result, T1) | SELECT Nominee FROM musical WHERE Nominee IS NOT NULL GROUP BY Nominee ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many car models were produced by the maker with full name American Motor Company?
Schema:
- car_makers(...)
- model_list(Maker, Model) | SELECT COUNT(*) AS num_models FROM car_makers AS T1 JOIN model_list AS T2 ON T1.Id = T2.Maker WHERE T1.FullName = 'American Motor Company'; |
Return the names of musicals who have the nominee Bob Fosse.?
Schema:
- musical(Award, COUNT, Name, Nom, Nominee, Result, T1) | SELECT Name FROM musical WHERE Nominee = 'Bob Fosse'; |
List the project details of the projects which did not hire any staff for a researcher role.?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
- Project_Staff(COUNT, date_from, date_to, role_code) | SELECT project_details FROM Projects WHERE project_id NOT IN (SELECT project_id FROM Project_Staff WHERE role_code = 'researcher'); |
Find the cities corresponding to employees who help customers with the postal code 70174.?
Schema:
- Customer(Email, FirstName, LastName, State, lu)
- Employee(BirthDate, City, FirstName, LastName, Phone) | SELECT T2.City FROM Customer AS T1 JOIN Employee AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = '70174'; |
Show the most frequently used carrier of the phones.?
Schema:
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) | SELECT Carrier FROM phone WHERE Carrier IS NOT NULL GROUP BY Carrier ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are different nationalities of people and the corresponding number of people from each nation?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT Nationality, COUNT(*) AS num_people FROM people GROUP BY Nationality; |
What is the number of students playing as a goalie?
Schema:
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT COUNT(*) AS num_students FROM Tryout WHERE pPos = 'goalie'; |
What are the dates in which the mean sea level pressure was between 30.3 and 31?
Schema:
- weather(AVG, COUNT, M, Ra, cloud_cover, date, diff, events, mean_humidity, mean_sea_level_pressure_inches, mean_temperature_f, mean_visibility_miles, ... (1 more)) | SELECT "date" FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31; |
What are the distinct first names and cities of the students who have allergy either to milk or to cat?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Allergy(Allergy, COUNT, StuID) | SELECT DISTINCT T1.Fname, T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.StuID = T2.StuID WHERE T2.Allergy = 'Milk' OR T2.Allergy = 'Cat'; |
What is the last name of the youngest student?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT LName FROM Student WHERE Age = (SELECT MIN(Age) FROM Student); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.