question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
Find the average age of female (sex is F) students who have secretary votes in the spring election cycle.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT AVG(T1.Age) AS avg_age FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = Secretary_Vote WHERE T1.Sex = 'F' AND T2.Election_Cycle = 'Spring'; |
How many instruments does the song "Le Pop" use?
Schema:
- Instruments(COUNT, Instrument)
- Songs(Title) | SELECT COUNT(DISTINCT Instrument) AS num_instruments FROM Instruments AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Title = 'Le Pop'; |
What are the titles of all movies that James Cameron directed after 2000?
Schema:
- Movie(T1, director, title, year) | SELECT title FROM Movie WHERE director = 'James Cameron' AND "year" > 2000; |
give me the cities in texas?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT city_name FROM city WHERE state_name = 'texas'; |
List the Episode of all TV series sorted by rating.?
Schema:
- TV_series(Air_Date, Episode, Rating, Share, Weekly_Rank) | SELECT Episode FROM TV_series ORDER BY Rating ASC NULLS LAST; |
return me the paper with more than 200 citations .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT title FROM publication WHERE citation_num > 200; |
Which policy type appears most frequently in the available policies?
Schema:
- Available_Policies(COUNT, Customer_Phone, Life, policy_type_code) | SELECT policy_type_code FROM Available_Policies WHERE policy_type_code IS NOT NULL GROUP BY policy_type_code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show all product names without an order.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) | SELECT product_name FROM Products LEFT JOIN Order_Items ON Products.product_id = Order_Items.product_id WHERE Order_Items.product_id IS NULL; |
Show ids of students who don't play video game.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Plays_Games(GameID, Hours_Played, StuID) | SELECT StuID FROM Student WHERE StuID NOT IN (SELECT StuID FROM Plays_Games); |
What is the maximum length in meters for the bridges and what are the architects' names?
Schema:
- bridge(Ra, length_feet, location, name)
- architect(gender, id, name, nationality) | SELECT MAX(T1.length_meters) AS max_length_meters, T2.name FROM bridge AS T1 JOIN architect AS T2 ON CAST(T1.architect_id AS TEXT) = T2.id GROUP BY T2.name ORDER BY max_length_meters DESC NULLS LAST LIMIT 1; |
Find the subject ID, name of subject and the corresponding number of courses for each subject, and sort by the course count in ascending order.?
Schema:
- Courses(course_description, course_name)
- Subjects(subject_name) | SELECT T1.subject_id, T2.subject_name, COUNT(*) AS num_courses FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id, T2.subject_name ORDER BY num_courses ASC NULLS LAST; |
Which country has at most 3 stadiums listed?
Schema:
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1) | SELECT Country FROM stadium WHERE Country IS NOT NULL GROUP BY Country HAVING COUNT(*) <= 3; |
What are the ids of all male students who do not play football?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID) | SELECT StuID FROM Student WHERE Sex = 'M' AND StuID NOT IN (SELECT StuID FROM SportsInfo WHERE SportName = 'Football'); |
What are the three most costly procedures?
Schema:
- Procedures(Cost, Name) | SELECT Name FROM Procedures ORDER BY Cost ASC NULLS LAST LIMIT 3; |
What is the number of states that has some colleges whose enrollment is smaller than the average enrollment?
Schema:
- College(M, cName, enr, state) | SELECT COUNT(DISTINCT state) AS num_states FROM College WHERE enr < (SELECT AVG(enr) FROM College); |
Find the titles of albums that contain tracks of both the Reggae and Rock genres.?
Schema:
- Album(Title)
- Track(Milliseconds, Name, UnitPrice)
- Genre(Name) | SELECT DISTINCT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreId = T3.GenreId WHERE T3.Name = 'Reggae' AND EXISTS (SELECT 1 FROM Track AS T2_sub JOIN Genre AS T3_sub ON T2_sub.GenreId = T3_sub.GenreId WHERE T3_sub.Name = 'Rock' AND T1.AlbumId = T2_sub.AlbumId); |
Show names of teachers and the courses they are arranged to teach.?
Schema:
- course_arrange(...)
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- teacher(Age, COUNT, D, Hometown, Name) | SELECT T3.Name, T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID; |
What is the money rank of the tallest poker player?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- poker_player(Best_Finish, Earnings, Final_Table_Made, Money_Rank) | SELECT T2.Money_Rank FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Height DESC NULLS LAST LIMIT 1; |
How many documents are with document type code BK for each product 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 COUNT(*) AS num_documents, Project_ID FROM Documents WHERE Document_Type_Code = 'BK' GROUP BY Project_ID; |
Find the product type whose average price is higher than the average price of all products.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT product_type_code FROM Products WHERE product_type_code IS NOT NULL GROUP BY product_type_code HAVING AVG(product_price) > (SELECT AVG(product_price) FROM Products WHERE product_type_code IS NOT NULL); |
How many citations does Dan Makumbi 's Genetic Identity paper have ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- writes(...)
- cite(...)
- author(...) | SELECT DISTINCT COUNT(T5.citingPaperId) AS num_citations FROM paperKeyphrase AS T2 JOIN keyphrase AS T3 ON T2.keyphraseId = T3.keyphraseId JOIN writes AS T4 ON T4.paperId = T2.paperId JOIN cite AS T5 ON T4.paperId = T5.citedPaperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T1.authorName = 'Dan Makumbi' AND T3.keyphraseName = 'Genetic Identity'; |
How many 'United Airlines' flights depart from Airport 'AHD'?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT COUNT(*) AS num_flights FROM airlines AS T1 JOIN flights AS T2 ON T2.Airline = T1.uid WHERE T1.Airline = 'United Airlines' AND T2.SourceAirport = 'AHD'; |
What is the nationality of the journalist with the largest number of years working?
Schema:
- journalist(Age, COUNT, Name, Nationality, T1, Years_working) | SELECT Nationality FROM journalist ORDER BY Years_working DESC NULLS LAST LIMIT 1; |
What is the title of the album that was released by the artist whose name has the phrase 'Led'?
Schema:
- artists(...)
- albums(I, title) | SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'; |
What are the first names of all history professors who do not teach?
Schema:
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME)
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) | SELECT T1.EMP_FNAME FROM EMPLOYEE AS T1 JOIN PROFESSOR AS T2 ON T1.EMP_NUM = T2.EMP_NUM JOIN DEPARTMENT AS T3 ON T2.DEPT_CODE = T3.DEPT_CODE WHERE T3.DEPT_NAME = 'History' AND T1.EMP_FNAME NOT IN (SELECT T4.EMP_FNAME FROM EMPLOYEE AS T4 JOIN CLASS AS T5 ON T4.EMP_NUM = T5.PROF_NUM); |
Find the name and position of physicians who prescribe some medication whose brand is X?
Schema:
- Physician(I, Name)
- Prescribes(...)
- Medication(Name) | SELECT DISTINCT T1.Name, T1."Position" FROM Physician AS T1 JOIN Prescribes AS T2 ON T1.EmployeeID = T2.Physician JOIN Medication AS T3 ON T3.Code = T2.Medication WHERE T3.Brand = 'X'; |
Show the most common apartment type code.?
Schema:
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count) | SELECT apt_type_code FROM Apartments WHERE apt_type_code IS NOT NULL GROUP BY apt_type_code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Which catalog publishers have substring "Murray" in their names?
Schema:
- Catalogs(COUNT, catalog_publisher, date_of_latest_revision) | SELECT DISTINCT catalog_publisher FROM Catalogs WHERE catalog_publisher LIKE '%Murray%'; |
what is the total length of all rivers in the usa?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT SUM(LENGTH) AS total_length FROM river WHERE country_name = 'united states'; |
What is the phone number of the customer who has filed the most recent complaint?
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))
- Complaints(complaint_status_code, complaint_type_code) | SELECT T1.phone_number FROM Customers AS T1 JOIN Complaints AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.date_complaint_raised DESC NULLS LAST LIMIT 1; |
Who served as an advisor for students who have treasurer votes in the spring election cycle?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT T1.Advisor FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = 'Spring'; |
List the clubs having "Davis Steven" as a member.?
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.Fname = 'Davis' AND T3.LName = 'Steven'; |
Find the number of students who have the word "son" in their personal names.?
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)) | SELECT COUNT(*) AS num_students FROM Students WHERE personal_name LIKE '%son%'; |
number of papers published in ACL 2015?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(DISTINCT 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 = 'ACL'; |
For each nationality, how many different constructors are there?
Schema:
- constructors(nationality) | SELECT COUNT(*) AS num_constructors, nationality FROM constructors GROUP BY nationality; |
Find all cities which has a " Taj Mahal " .?
Schema:
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT city FROM business WHERE name = 'Taj Mahal'; |
What is the area of the appelation that produces the highest number of wines before the year of 2010?
Schema:
- appellations(Area, County)
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT T1.Area FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation, T2."Year", T1.Area HAVING T2."Year" < 2010 ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many stadiums are there?
Schema:
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1) | SELECT COUNT(*) AS num_stadiums FROM stadium; |
How long is the people’s average life expectancy in Central Africa?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT AVG(LifeExpectancy) AS avg_life_expectancy FROM country WHERE Region = 'Central Africa'; |
return me the total citations of papers in the VLDB conference in each year .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- conference(homepage, name) | SELECT T2."year", SUM(T2.citation_num) AS total_citations FROM publication AS T2 JOIN conference AS T1 ON T2.cid = CAST(T1.cid AS TEXT) WHERE T1.name = 'VLDB' GROUP BY T2."year"; |
Find the name of the products that have the color description "red" and have the characteristic name "fast".?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Product_Characteristics(...)
- Characteristics(characteristic_name)
- Ref_Colors(color_description) | SELECT product_name FROM Products AS T1 JOIN Product_Characteristics AS T2 ON T1.product_id = T2.product_id JOIN Characteristics AS T3 ON T2.characteristic_id = T3.characteristic_id JOIN Ref_Colors AS T4 ON T1.color_code = T4.color_code WHERE T4.color_description = 'red' AND T3.characteristic_name = 'fast'; |
How many students are there in each major?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_students, Major FROM Student GROUP BY Major; |
What are the ids of the students who registered for course 301 most recently?
Schema:
- Student_Course_Attendance(course_id, date_of_attendance, student_id) | SELECT student_id FROM Student_Course_Attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC NULLS LAST LIMIT 1; |
Which building has most faculty members?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT Building FROM Faculty WHERE Building IS NOT NULL GROUP BY Building ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Which city is the most frequent source airport?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT T1.City FROM airports AS T1 JOIN flights AS T2 ON T1.AirportCode = T2.SourceAirport GROUP BY T1.City ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
list 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; |
what state has the greatest population density?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM state WHERE density = (SELECT MAX(density) FROM state); |
What is the mail date of the document with id 7?
Schema:
- Documents_Mailed(document_id, mailing_date) | SELECT mailing_date FROM Documents_Mailed WHERE document_id = 7; |
What are the payment dates for any payments that have an amount greater than 10 or were handled by a staff member with the first name Elsa?
Schema:
- payment(amount, payment_date)
- staff(...) | SELECT DISTINCT payment_date FROM (SELECT payment_date FROM payment WHERE amount > 10 UNION ALL SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa'); |
what is the total area of the usa?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT SUM(area) AS total_area FROM state; |
Find the founded year of the newest non public school.?
Schema:
- university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School) | SELECT Founded FROM university WHERE Affiliation != 'Public' ORDER BY Founded DESC NULLS LAST LIMIT 1; |
Find the name of projects that require between 100 and 300 hours of work.?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT Name FROM Projects WHERE Hours BETWEEN 100 AND 300; |
How many students, on average, does each college have enrolled?
Schema:
- College(M, cName, enr, state) | SELECT AVG(enr) AS avg_enr FROM College; |
Give the phone and postal code corresponding to the address '1031 Daugavpils Parkway'.?
Schema:
- address(address, district, phone, postal_code) | SELECT phone, postal_code FROM address WHERE address = '1031 Daugavpils Parkway'; |
where is jamerican cuisine 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 T1.name = 'jamerican cuisine'; |
What is the highest, lowest, and average student GPA for every department?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE) | SELECT MAX(STU_GPA) AS max_gpa, AVG(STU_GPA) AS avg_gpa, MIN(STU_GPA) AS min_gpa, DEPT_CODE FROM STUDENT GROUP BY DEPT_CODE; |
How many games are played for all football games by students on scholarship?
Schema:
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID) | SELECT SUM(GamesPlayed) AS num_games FROM SportsInfo WHERE SportName = 'Football' AND OnScholarship = 'Y'; |
return me the papers by " H. V. Jagadish " on PVLDB .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name)
- writes(...)
- author(...) | SELECT T4.title 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' AND T2.name = 'PVLDB'; |
What are the names of wines, sorted by price ascending?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT Name FROM wine WHERE Name IS NOT NULL AND Price IS NOT NULL GROUP BY Name, Price ORDER BY Price ASC NULLS LAST; |
give me a restaurant in the bay area ?
Schema:
- location(...)
- restaurant(...)
- geographic(...) | SELECT T2.house_number, T1.name FROM location AS T2 JOIN restaurant AS T1 ON T1.id = T2.restaurant_id WHERE T1.city_name IN (SELECT city_name FROM geographic WHERE region = 'bay area'); |
List title of albums have the number of tracks greater than 10.?
Schema:
- albums(I, title)
- tracks(composer, milliseconds, name, unit_price) | SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.album_id GROUP BY T1.id, T1.title HAVING COUNT(T1.id) > 10; |
what are the major cities in the smallest state in the us?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT city_name FROM city WHERE population > 150000 AND state_name = (SELECT state_name FROM state WHERE area = (SELECT MIN(area) FROM state)); |
How many problems are there for product voluptatem?
Schema:
- Product(product_id, product_name)
- Problems(date_problem_reported, problem_id) | SELECT COUNT(*) AS num_problems FROM Product AS T1 JOIN Problems AS T2 ON T1.product_id = T2.product_id WHERE T1.product_name = 'voluptatem'; |
papers coauthored by Peter Mertens and Dina Barbian?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT T3.paperId FROM writes AS T3 JOIN author AS T2 ON T3.authorId = T2.authorId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T2.authorName = 'Peter Mertens' AND T1.authorName = 'Dina Barbian'; |
What is the name of the singer who is worth the most?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT Name FROM singer ORDER BY Net_Worth_Millions DESC NULLS LAST LIMIT 1; |
What are the first names and country codes for players who won both the WTA Championships and the Australian Open?
Schema:
- players(COUNT, birth_date, country_code, first_name, hand, last_name)
- matches_(COUNT, T1, loser_age, loser_name, minutes, tourney_name, winner_age, winner_hand, winner_name, winner_rank, winner_rank_points, year) | SELECT DISTINCT T1.country_code, T1.first_name FROM players AS T1 JOIN matches_ AS T2 ON T1.player_id = T2.winner_id JOIN players AS T3 ON T1.player_id = T3.player_id JOIN matches_ AS T4 ON T3.player_id = T4.winner_id WHERE T2.tourney_name = 'WTA Championships' AND T4.tourney_name = 'Australian Open'; |
Papers that use the WebKB dataset?
Schema:
- paperDataset(...)
- dataset(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId FROM paperDataset AS T2 JOIN dataset AS T1 ON T2.datasetId = T1.datasetId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.datasetName = 'WebKB'; |
Find the distinct majors of students who have treasurer votes.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT T1.Major FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.Treasurer_Vote; |
Find each target user's name and average trust score.?
Schema:
- useracct(...)
- trust(...) | SELECT T1.name, AVG(trust) AS avg_trust FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id GROUP BY T2.target_u_id, T1.name; |
what is the density of the 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'; |
Show the ids of all employees who don't destroy any document.?
Schema:
- Employees(COUNT, Date_of_Birth, Employee_ID, Employee_Name, Role_Code, employee_id, employee_name, role_code)
- Documents_to_be_Destroyed(Destroyed_by_Employee_ID, Destruction_Authorised_by_Employee_ID) | SELECT Employee_ID FROM Employees WHERE Employee_ID NOT IN (SELECT Destroyed_by_Employee_ID FROM Documents_to_be_Destroyed); |
What are the support, consider, and oppose rates of each candidate, ordered ascending by their unsure rate?
Schema:
- candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_rate) | SELECT Support_rate, Consider_rate, Oppose_rate FROM candidate ORDER BY Unsure_rate ASC NULLS LAST; |
How many TV Channels use the English language?
Schema:
- TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name) | SELECT COUNT(*) AS num_channels FROM TV_Channel WHERE "Language" = 'English'; |
Show different builders of railways, along with the corresponding number of railways using each builder.?
Schema:
- railway(Builder, COUNT, Location) | SELECT Builder, COUNT(*) AS num_railways FROM railway GROUP BY Builder; |
What is the average number of votes of representatives from party "Republican"?
Schema:
- election(Committee, Date, Delegate, District, Vote_Percent, Votes)
- representative(JO, Lifespan, Name, Party, State, T1) | SELECT AVG(T1.Votes) AS avg_votes FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE T2.Party = 'Republican'; |
parsing papers that have the most citations?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...) | SELECT DISTINCT T4.citedPaperId, COUNT(T4.citedPaperId) AS num_citations FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN cite AS T4 ON T3.paperId = T4.citedPaperId WHERE T1.keyphraseName = 'parsing' GROUP BY T4.citedPaperId ORDER BY num_citations DESC NULLS LAST; |
How many different nationalities do conductors have?
Schema:
- conductor(Age, Name, Nationality, Year_of_Work) | SELECT COUNT(DISTINCT Nationality) AS num_nationalities FROM conductor; |
How many colors are never used by any product?
Schema:
- Ref_Colors(color_description)
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT COUNT(*) AS num_colors FROM Ref_Colors WHERE color_code NOT IN (SELECT color_code FROM Products); |
List all users who reviewed businesses that are restaurant .?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state)
- review(i_id, rank, rating, text)
- user_(name) | SELECT T4.name FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN review AS T3 ON T3.business_id = T1.business_id JOIN user_ AS T4 ON T4.user_id = T3.user_id WHERE T2.category_name = 'restaurant'; |
What are the names of the dogs for which the owner has not spend more than 1000 for treatment ?
Schema:
- Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT name FROM Dogs WHERE dog_id NOT IN (SELECT dog_id FROM Treatments WHERE dog_id IS NOT NULL GROUP BY dog_id having SUM(cost_of_treatment) > 1000); |
Who are the members of the club named "Bootup Baltimore"? Give me their last names.?
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 T3.LName 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 = 'Bootup Baltimore'; |
which states does the longest river run through?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT traverse FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river); |
List all the services in the alphabetical order.?
Schema:
- Services(Service_Type_Code, Service_name) | SELECT Service_name FROM Services ORDER BY Service_name ASC NULLS LAST; |
Who are the top 3 players in terms of overall rating?
Schema:
- Player(HS, pName, weight, yCard)
- Player_Attributes(overall_rating, preferred_foot) | SELECT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id GROUP BY T1.player_name ORDER BY AVG(T2.overall_rating) DESC NULLS LAST LIMIT 3; |
Which locations contains both shops that opened after the year 2012 and shops that opened before 2008?
Schema:
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT Location FROM shop WHERE Open_Year > 2012 AND Location IN (SELECT Location FROM shop WHERE Open_Year < 2008); |
What is the average account balance of customers with credit score below 50 for the different account types?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) | SELECT AVG(acc_bal) AS avg_balance, acc_type FROM customer WHERE credit_score < 50 GROUP BY acc_type; |
How many times at most can a course enrollment result show in different transcripts? Also show the course enrollment id.?
Schema:
- Transcript_Contents(student_course_id) | SELECT COUNT(*) AS num_enrollments, student_course_id FROM Transcript_Contents WHERE student_course_id IS NOT NULL GROUP BY student_course_id ORDER BY num_enrollments DESC NULLS LAST LIMIT 1; |
how many cars were produced in 1980?
Schema:
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year) | SELECT COUNT(*) AS num_cars FROM cars_data WHERE "Year" = 1980; |
what is the height of mount mckinley?
Schema:
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more)) | SELECT mountain_altitude FROM mountain WHERE mountain_name = 'mckinley'; |
What are the nationalities and ages of journalists?
Schema:
- journalist(Age, COUNT, Name, Nationality, T1, Years_working) | SELECT Nationality, Age FROM journalist; |
Find the total credits of courses provided by different department.?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) | SELECT SUM(credits) AS total_credits, dept_name FROM course GROUP BY dept_name; |
What are the types of competition and number of competitions for that type?
Schema:
- competition(COUNT, Competition_type, Country, T1, Year) | SELECT Competition_type, COUNT(*) AS num_competitions FROM competition GROUP BY Competition_type; |
List all the cities in a decreasing order of each city's stations' highest latitude.?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT city FROM station WHERE city IS NOT NULL GROUP BY city ORDER BY MAX(lat) DESC NULLS LAST; |
What are the names of projects that have taken longer than the average number of hours for all projects?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT Name FROM Projects WHERE Hours > (SELECT AVG(Hours) FROM Projects); |
Find the total revenue of companies whose revenue is larger than the revenue of some companies based in Austin.?
Schema:
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT SUM(Revenue) AS total_revenue FROM Manufacturers WHERE Revenue > (SELECT MIN(Revenue) FROM Manufacturers WHERE Headquarter = 'Austin'); |
What is the name of each dorm that has a TV Lounge but no study rooms?
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 different players trained for more than 1000 hours?
Schema:
- Player(HS, pName, weight, yCard) | SELECT COUNT(*) AS num_players FROM Player WHERE HS > 1000; |
What are the total number of students who are living in a male dorm?
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_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.gender = 'M'; |
What is the name of the project that requires the fewest number of hours, and the names of the scientists assigned to it?
Schema:
- AssignedTo(Scientist)
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
- Scientists(Name) | SELECT T2.Name, 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 MIN(Hours) FROM Projects); |
how many states does the missouri river flow through?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT COUNT(traverse) AS num_states FROM river WHERE river_name = 'missouri'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.