question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
What are the job ids for jobs done more than once for a period of more than 300 days?
Schema:
- job_history(EMPLOYEE_ID, END_DATE, JOB_ID) | SELECT JOB_ID FROM job_history WHERE DATEDIFF(DAY, START_DATE, END_DATE) > 300 AND JOB_ID IS NOT NULL GROUP BY JOB_ID HAVING COUNT(*) >= 2; |
What are the names of festivals held in year 2007?
Schema:
- festival_detail(Chair_Name, Festival_Name, Location, T1, Year) | SELECT Festival_Name FROM festival_detail WHERE "Year" = 2007; |
Give me the zip code where the average mean humidity is below 70 and at least 100 trips took place.?
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))
- trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code) | SELECT DISTINCT T1.zip_code FROM (SELECT zip_code FROM weather WHERE zip_code IS NOT NULL GROUP BY zip_code HAVING AVG(mean_humidity) < 70) T1, (SELECT zip_code FROM trip WHERE zip_code IS NOT NULL GROUP BY zip_code HAVING COUNT(*) >= 100) AS T2 WHERE T1.zip_code = T2.zip_code; |
Which grades have 4 or more high schoolers?
Schema:
- Highschooler(COUNT, ID, grade, name) | SELECT grade FROM Highschooler WHERE grade IS NOT NULL GROUP BY grade HAVING COUNT(*) >= 4; |
What are the different names of mountains ascended by climbers from the country of West Germany?
Schema:
- climber(Country, K, Name, Points)
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more)) | SELECT DISTINCT T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T1.Country = 'West Germany'; |
Return all the information for each election record.?
Schema:
- election(Committee, Date, Delegate, District, Vote_Percent, Votes) | SELECT * FROM election; |
List the duration, file size and format of songs whose genre is pop, ordered by title?
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 T1.duration, T1.file_size, T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.genre_is = 'pop' ORDER BY T2.song_name ASC NULLS LAST; |
What is the attribute data type of the attribute with name "Green"?
Schema:
- Attribute_Definitions(attribute_data_type, attribute_name) | SELECT attribute_data_type FROM Attribute_Definitions WHERE attribute_name = 'Green'; |
What are the names and location of the wrestlers?
Schema:
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT Name, Location FROM wrestler; |
What is the total number of games played?
Schema:
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID) | SELECT SUM(GamesPlayed) AS total_games_played FROM SportsInfo; |
Show the names of phones that have total number of stocks bigger than 2000, in descending order of the total number of stocks.?
Schema:
- phone_market(...)
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) | SELECT T2.Name FROM phone_market AS T1 JOIN phone AS T2 ON TRY_CAST(T1.Phone_ID AS INTEGER) = T2.Phone_ID GROUP BY T2.Name HAVING SUM(T1.Num_of_stock) >= 2000 ORDER BY SUM(T1.Num_of_stock) DESC NULLS LAST; |
How many employees are there all together?
Schema:
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) | SELECT COUNT(*) AS num_employees FROM EMPLOYEE; |
What is the average number of years spent working as a journalist?
Schema:
- journalist(Age, COUNT, Name, Nationality, T1, Years_working) | SELECT AVG(Years_working) AS avg_years_working FROM journalist; |
Return the name of the document that has the most sections.?
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_Sections(...) | SELECT T1.document_name FROM Documents AS T1 JOIN Document_Sections AS T2 ON T1.document_code = T2.document_code GROUP BY T1.document_code, T1.document_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
what are the highest points of states surrounding mississippi?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
- border_info(T1, border, state_name) | SELECT highest_point FROM highlow WHERE state_name IN (SELECT border FROM border_info WHERE state_name = 'mississippi'); |
What is the cell phone number of the student whose address has the lowest monthly rental?
Schema:
- Student_Addresses(monthly_rental)
- Students(cell_mobile_number, current_address_id, date_first_registered, date_left, date_of_latest_logon, email_address, family_name, first_name, last_name, login_name, middle_name, other_student_details, ... (1 more)) | SELECT T2.cell_mobile_number FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.monthly_rental ASC NULLS LAST LIMIT 1; |
How many colleges has more than 15000 students?
Schema:
- College(M, cName, enr, state) | SELECT COUNT(*) AS num_colleges FROM College WHERE enr > 15000; |
Find the number of students taught by the teacher KAWA GORDON.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
- teachers(Classroom, FirstName, LastName) | SELECT COUNT(*) AS num_students FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T2.FirstName = 'KAWA' AND T2.LastName = 'GORDON'; |
For each phone, show its names and total number of stocks.?
Schema:
- phone_market(...)
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) | SELECT T2.Name, SUM(T1.Num_of_stock) AS total_stocks FROM phone_market AS T1 JOIN phone AS T2 ON TRY_CAST(T1.Phone_ID AS INTEGER) = T2.Phone_ID GROUP BY T2.Name; |
machine networks for one shot learning?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT paperId FROM paper WHERE title = 'machine networks for one shot learning'; |
Show flight number, origin, destination of all flights in the alphabetical order of the departure cities.?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT flno, origin, destination FROM flight ORDER BY origin ASC NULLS LAST; |
Compute the average age of the members in the club "Tennis Club".?
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 AVG(T3.Age) AS avg_age 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 T1.ClubName = 'Tennis Club'; |
Find the average number of factories for the manufacturers that have more than 20 shops.?
Schema:
- manufacturer(Manufacturer_ID, Name, Open_Year) | SELECT AVG(Num_of_Factories) AS avg_num_factories FROM manufacturer WHERE Num_of_Shops > 20; |
Find the number of trains for each station, as well as the station network name and services.?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
- route(...) | SELECT COUNT(*) AS num_trains, T1.network_name, T1.services FROM station AS T1 JOIN route AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id, T1.network_name, T1.services; |
Count the total number of counties.?
Schema:
- county(County_name, Population, Zip_code) | SELECT COUNT(*) AS num_counties FROM county; |
Which location names contain the word "film"?
Schema:
- Locations(Address, Location_Name, Other_Details) | SELECT Location_Name FROM Locations WHERE Location_Name LIKE '%film%'; |
How many reviews has Niloofar written in 2015?
Schema:
- user_(name)
- review(i_id, rank, rating, text) | SELECT COUNT(DISTINCT T1."text") AS num_reviews FROM user_ AS T2 JOIN review AS T1 ON T2.user_id = T1.user_id WHERE T1."year" = 2015 AND T2.name = 'Niloofar'; |
return me the authors who have more than 10 papers containing keyword " Relational Database " .?
Schema:
- publication_keyword(...)
- keyword(keyword)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- writes(...)
- author(...) | SELECT T2.name FROM publication_keyword AS T5 JOIN keyword AS T1 ON T5.kid = T1.kid JOIN publication AS T3 ON T3.pid = T5.pid JOIN writes AS T4 ON T4.pid = T3.pid JOIN author AS T2 ON T4.aid = T2.aid WHERE T1.keyword = 'Relational Database' GROUP BY T2.name HAVING COUNT(DISTINCT T3.title) > 10; |
How many papers was published in nature communications in 2015?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(T1.paperId) AS num_papers FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T1."year" = 2015 AND T2.venueName = 'nature communications'; |
Find the names of the swimmers who have no record.?
Schema:
- swimmer(Name, Nationality, meter_100, meter_200, meter_300)
- record(...) | SELECT Name FROM swimmer WHERE ID NOT IN (SELECT Swimmer_ID FROM record); |
Find the personal names of students not enrolled in any course.?
Schema:
- Students(cell_mobile_number, current_address_id, date_first_registered, date_left, date_of_latest_logon, email_address, family_name, first_name, last_name, login_name, middle_name, other_student_details, ... (1 more))
- Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) | SELECT DISTINCT personal_name FROM Students WHERE personal_name NOT IN (SELECT T1.personal_name FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id = T2.student_id); |
Find all actors from Afghanistan?
Schema:
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT name FROM actor WHERE nationality = 'Afghanistan'; |
Find the name and gender of the staff who has been assigned the job of Sales Person but never Clerical Staff.?
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_name, 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 = 'Sales Person' AND NOT EXISTS (SELECT 1 FROM Staff_Department_Assignments AS T3 WHERE T1.staff_id = T3.staff_id AND T3.job_title_code = 'Clerical Staff'); |
Where is the club "Hopkins Student Enterprises" located?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn) | SELECT ClubLocation FROM Club WHERE ClubName = 'Hopkins Student Enterprises'; |
What are the names of actors who have been in the musical titled The Phantom of the Opera?
Schema:
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
- musical(Award, COUNT, Name, Nom, Nominee, Result, T1) | SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID WHERE T2.Name = 'The Phantom of the Opera'; |
Find the number of female students (with F sex) living in Smith Hall?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Lives_in(...)
- Dorm(dorm_name, gender, student_capacity) | SELECT COUNT(*) AS num_female_students FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' AND T1.Sex = 'F'; |
What is the series name and country of all TV channels that are playing cartoons directed by Ben Jones and cartoons directed by Michael Chang?
Schema:
- TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name)
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by) | SELECT T1.series_name, T1.Country FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T2.Directed_by IN ('Michael Chang', 'Ben Jones') GROUP BY T1.series_name, T1.Country HAVING COUNT(DISTINCT T2.Directed_by) = 2; |
how many denny are there in the bay area ?
Schema:
- restaurant(...)
- geographic(...) | SELECT COUNT(*) AS num_dennys FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name WHERE T2.region = 'bay area' AND T1.name = 'denny'; |
Find the number of followers for each user.?
Schema:
- follows(f1) | SELECT f1, COUNT(*) AS num_followers FROM follows GROUP BY f1; |
What are the first names of all employees that are professors ordered by date of birth?
Schema:
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) | SELECT EMP_FNAME FROM EMPLOYEE WHERE EMP_JOBCODE = 'PROF' ORDER BY EMP_DOB ASC NULLS LAST; |
For all directors who directed more than one movie, return the titles of all movies directed by them, along with the director name. Sort by director name, then movie title.?
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; |
Find the id of users who are followed by Mary or Susan.?
Schema:
- user_profiles(email, followers, name, partitionid)
- follows(f1) | SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = 'Mary' OR T1.name = 'Susan'; |
return me the keywords related to " H. V. Jagadish " .?
Schema:
- publication_keyword(...)
- keyword(keyword)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- writes(...)
- author(...) | SELECT T1.keyword FROM publication_keyword AS T5 JOIN keyword AS T1 ON T5.kid = T1.kid JOIN publication AS T3 ON T3.pid = T5.pid JOIN writes AS T4 ON T4.pid = T3.pid JOIN author AS T2 ON T4.aid = T2.aid WHERE T2.name = 'H. V. Jagadish'; |
What is the average credit score for customers who have taken a loan?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id)
- loan(...) | SELECT AVG(credit_score) AS avg_credit_score FROM customer WHERE cust_ID IN (SELECT cust_ID FROM loan); |
what rivers flow through the largest state?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT river_name FROM river WHERE traverse IN (SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state)); |
what are the biggest rivers in texas?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river WHERE traverse = 'texas') AND traverse = 'texas'; |
How many video game types exist?
Schema:
- Video_Games(COUNT, Dest, GName, GType, onl) | SELECT COUNT(DISTINCT GType) AS num_types FROM Video_Games; |
What are the minimum, average, and maximum quantities ordered? Check all the invoices.?
Schema:
- Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code) | SELECT MIN(TRY_CAST(Order_Quantity AS DOUBLE)) AS min_quantity, AVG(TRY_CAST(Order_Quantity AS DOUBLE)) AS avg_quantity, MAX(TRY_CAST(Order_Quantity AS DOUBLE)) AS max_quantity FROM Invoices; |
Which activity has the most faculty members participating in? Find the activity name.?
Schema:
- Activity(activity_name)
- Faculty_Participates_in(FacID) | SELECT T1.activity_name FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid, T1.activity_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the name, population and expected life length of asian country with the largest area?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT Name, Population, LifeExpectancy FROM country WHERE Continent = 'Asia' ORDER BY SurfaceArea DESC NULLS LAST LIMIT 1; |
Parsing papers using Jeopardy! Questions published at ACL 2014?
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'; |
Find the name of dorms which have TV Lounge but no Study Room as amenity.?
Schema:
- Dorm(dorm_name, gender, student_capacity)
- Has_amenity(dormid)
- Dorm_amenity(amenity_name) | SELECT T1.dorm_name FROM Dorm AS T1 JOIN Has_amenity AS T2 ON T1.dormid = T2.dormid JOIN Dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' AND T1.dorm_name NOT IN (SELECT T1.dorm_name FROM Dorm AS T1 JOIN Has_amenity AS T2 ON T1.dormid = T2.dormid JOIN Dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'Study Room'); |
how many capitals does rhode island have?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT COUNT(capital) AS num_capitals FROM state WHERE state_name = 'rhode island'; |
Show the nominees that have nominated musicals for both "Tony Award" and "Drama Desk Award".?
Schema:
- musical(Award, COUNT, Name, Nom, Nominee, Result, T1) | SELECT DISTINCT T1.Nominee FROM (SELECT Nominee FROM musical WHERE Award = 'Tony Award') AS T1, (SELECT Nominee FROM musical WHERE Award = 'Drama Desk Award') AS T2 WHERE T1.Nominee = T2.Nominee; |
How many products are there?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT COUNT(*) AS num_products FROM Products; |
what is the population density of wyoming?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT density FROM state WHERE state_name = 'wyoming'; |
what is the largest city in a state that borders california?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- border_info(T1, border, state_name) | SELECT city_name FROM city WHERE population = (SELECT MAX(population) FROM city WHERE state_name IN (SELECT border FROM border_info WHERE state_name = 'california')) AND state_name IN (SELECT border FROM border_info WHERE state_name = 'california'); |
what is the average rating given in Michelle reviews?
Schema:
- user_(name)
- review(i_id, rank, rating, text) | SELECT AVG(T1.rating) AS avg_rating FROM user_ AS T2 JOIN review AS T1 ON T2.user_id = T1.user_id WHERE T2.name = 'Michelle'; |
what are the genres of movies directed by " Asghar Farhadi "?
Schema:
- director(Afghan, name, nationality)
- directed_by(...)
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
- classification(...)
- genre(g_name, rating) | SELECT T3.genre FROM director AS T5 JOIN directed_by AS T2 ON T5.did = T2.did JOIN movie AS T4 ON T4.mid = T2.msid JOIN classification AS T1 ON T4.mid = T1.msid JOIN genre AS T3 ON T3.gid = T1.gid WHERE T5.name = 'Asghar Farhadi'; |
What are the different location codes for documents?
Schema:
- Document_Locations(COUNT, Date_in_Location_From, Date_in_Locaton_To, Location_Code) | SELECT DISTINCT Location_Code FROM Document_Locations; |
How many schools are there in the department?
Schema:
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT COUNT(DISTINCT SCHOOL_CODE) AS num_schools FROM DEPARTMENT; |
What are the names of students who have more than one advisor?
Schema:
- student(COUNT, H, dept_name, name, tot_cred)
- advisor(s_ID) | SELECT T1.name FROM student AS T1 JOIN advisor AS T2 ON T1.ID = T2.s_ID GROUP BY T2.s_ID, T1.name HAVING COUNT(*) > 1; |
What procedures cost less than 5000 and have John Wen as a trained physician?
Schema:
- Physician(I, Name)
- Trained_In(...)
- Procedures(Cost, Name) | SELECT DISTINCT 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' AND T3.Cost < 5000; |
Find the organisation ids and details of the organisations which are involved in?
Schema:
- Grants(grant_amount, organisation_id)
- Organisations(...) | SELECT T2.organisation_id, T2.organisation_details FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY T2.organisation_id, T2.organisation_details HAVING SUM(T1.grant_amount) > 6000; |
Find the name, type, and flag of the ship that is built in the most recent year.?
Schema:
- Ship(Built_Year, COUNT, Class, Flag, Name, Type) | SELECT Name, Type, Flag FROM Ship ORDER BY Built_Year DESC NULLS LAST LIMIT 1; |
What is the number of different different airports that are destinations for American Airlines?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- routes(...) | SELECT COUNT(DISTINCT dst_apid) AS num_airports FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid WHERE T1.name = 'American Airlines'; |
what are the capital cities of the states which border 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 T2.capital FROM state AS T2 JOIN border_info AS T1 ON T2.state_name = T1.border WHERE T1.state_name = 'texas'; |
Find id of candidates whose assessment code is "Pass"?
Schema:
- Candidate_Assessments(asessment_outcome_code, assessment_date, candidate_id) | SELECT candidate_id FROM Candidate_Assessments WHERE asessment_outcome_code = 'Pass'; |
Please list all album titles in alphabetical order.?
Schema:
- Album(Title) | SELECT Title FROM Album ORDER BY Title ASC NULLS LAST; |
What is the average earnings of poker players?
Schema:
- poker_player(Best_Finish, Earnings, Final_Table_Made, Money_Rank) | SELECT AVG(Earnings) AS avg_earnings FROM poker_player; |
which rivers flow through illinois?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE traverse = 'illinois'; |
Whah are the name of each industry and the number of companies in that industry?
Schema:
- Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name) | SELECT Industry, COUNT(*) AS num_companies FROM Companies GROUP BY Industry; |
Find the list of documents that are both in the most three popular type and have the most three popular structure.?
Schema:
- Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more)) | SELECT document_name FROM Documents WHERE document_type_code IN (SELECT document_type_code FROM Documents WHERE document_type_code IS NOT NULL GROUP BY document_type_code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 3) AND document_structure_code IN (SELECT document_structure_code FROM Documents WHERE document_structure_code IS NOT NULL GROUP BY document_structure_code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 3); |
What is all the information about courses, ordered by credits ascending?
Schema:
- Course(CName, Credits, Days) | SELECT * FROM Course ORDER BY Credits ASC NULLS LAST; |
Show all distinct region names ordered by their labels.?
Schema:
- region(Label, Region_code, Region_name) | SELECT Region_name FROM region WHERE Region_name IS NOT NULL AND Label IS NOT NULL GROUP BY Region_name, Label ORDER BY Label ASC NULLS LAST; |
What is name of the country that speaks the largest number of languages?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- countrylanguage(COUNT, CountryCode, Engl, Language) | SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the description for the budget type with code ORG?
Schema:
- Ref_Budget_Codes(Budget_Type_Code, Budget_Type_Description) | SELECT Budget_Type_Description FROM Ref_Budget_Codes WHERE Budget_Type_Code = 'ORG'; |
What is the average rating star for each reviewer?
Schema:
- Rating(Rat, mID, rID, stars)
- Reviewer(Lew, name, rID) | SELECT T2.name, AVG(T1.stars) AS avg_rating FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name; |
What nurses are on call with block floor 1 and block code 1? Tell me their names.?
Schema:
- On_Call(BlockCode, BlockFloor, Nurse) | SELECT Nurse FROM On_Call WHERE BlockFloor = 1 AND BlockCode = 1; |
What campuses opened between 1935 and 1939?
Schema:
- Campuses(Campus, County, Franc, Location) | SELECT Campus FROM Campuses WHERE "Year" >= 1935 AND "Year" <= 1939; |
Which abbreviation corresponds to Jetblue Airways?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name) | SELECT Abbreviation FROM airlines WHERE Airline = 'JetBlue Airways'; |
Show all document ids, names and the number of paragraphs in each document.?
Schema:
- Paragraphs(COUNT, Document_ID, Other_Details, Paragraph_Text, T1)
- 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_ID, T2.Document_Name, COUNT(*) AS num_paragraphs FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.Document_ID = T2.Document_ID GROUP BY T1.Document_ID, T2.Document_Name; |
Return the device carriers that do not have Android as their software platform.?
Schema:
- device(COUNT, Carrier, Software_Platform) | SELECT Carrier FROM device WHERE Software_Platform != 'Android'; |
find the id, name and age for visitors who visited some museums more than once.?
Schema:
- visitor(Age, Level_of_membership, Name)
- visit(...) | SELECT T1.ID, T1.Name, T1.Age FROM visitor AS T1 JOIN visit AS T2 ON T1.ID = T2.visitor_ID GROUP BY T1.ID, T1.Name, T1.Age HAVING COUNT(*) > 1; |
Return the name and gender of the staff who was assigned in 2016.?
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)
- LIKE(...) | SELECT T1.staff_name, T1.staff_gender FROM Staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.date_assigned_from LIKE '2016%'; |
What is the name of the museum that had no visitor yet?
Schema:
- museum(Name, Open_Year)
- visit(...) | SELECT Name FROM museum WHERE Museum_ID NOT IN (SELECT Museum_ID FROM visit); |
Find the first name and age of the students who are playing both Football and Lacrosse.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID) | SELECT Fname, Age FROM Student AS T1 WHERE EXISTS (SELECT 1 FROM SportsInfo AS T2 WHERE T2.StuID = T1.StuID AND T2.SportName = 'Football') AND EXISTS (SELECT 1 FROM SportsInfo AS T3 WHERE T3.StuID = T1.StuID AND T3.SportName = 'Lacrosse'); |
return me the number of the organizations in " North America " .?
Schema:
- organization(continent, homepage, name) | SELECT COUNT(DISTINCT name) AS num_organizations FROM organization WHERE continent = 'North America'; |
What are the details of the shops that can be accessed by walk?
Schema:
- Shops(...)
- Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more)) | SELECT T1.Shop_Details FROM Shops AS T1 JOIN Tourist_Attractions AS T2 ON T1.Shop_ID = T2.Tourist_Attraction_ID WHERE T2.How_to_Get_There = 'walk'; |
How many papers does David M. Blei have in AISTATS ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT COUNT(T3.paperId) AS num_papers 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 = 'David M. Blei' AND T4.venueName = 'AISTATS'; |
What is the category and typical buying price of the product with name "cumin"?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT product_category_code, typical_buying_price FROM Products WHERE product_name = 'cumin'; |
Return the first names and last names of all guests?
Schema:
- Guests(date_of_birth, gender_code, guest_first_name, guest_last_name) | SELECT guest_first_name, guest_last_name FROM Guests; |
What year was the movie " The Imitation Game " produced?
Schema:
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) | SELECT release_year FROM movie WHERE title = 'The Imitation Game'; |
which states border no other states?
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 state_name FROM state WHERE state_name NOT IN (SELECT state_name FROM border_info); |
Show the draft pick numbers and draft classes of players whose positions are defenders.?
Schema:
- match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team) | SELECT Draft_Pick_Number, Draft_Class FROM match_season WHERE "Position" = 'Defender'; |
List all the information about course authors and tutors in alphabetical order of the personal name.?
Schema:
- Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name) | SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name ASC NULLS LAST; |
How old is the average person for each job?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT AVG(age) AS avg_age, job FROM Person GROUP BY job; |
Show the statement id and the statement detail for the statement 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)
- Statements(Statement_Details, Statement_ID) | SELECT T1.Statement_ID, T2.Statement_Details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.Statement_ID = T2.Statement_ID GROUP BY T1.Statement_ID, T2.Statement_Details ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the venues of all the matches? Sort them in the descending order of match date.?
Schema:
- match_(Competition, Date, Match_ID, Venue) | SELECT Venue FROM match_ ORDER BY "Date" DESC NULLS LAST; |
What is the code of the category that the product with the name 'flax' belongs to?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT product_category_code FROM Products WHERE product_name = 'flax'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.