question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
List the first names of all the students in room 107.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName) | SELECT DISTINCT FirstName FROM list WHERE Classroom = 107; |
List the official name and status of the city with the largest population.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT Official_Name, Status FROM city ORDER BY Population DESC NULLS LAST LIMIT 1; |
which year had the most NIPS papers ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(T1.paperId) AS num_papers, T1."year" FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T2.venueName = 'NIPS' GROUP BY T1."year" ORDER BY num_papers DESC NULLS LAST; |
what is a good restaurant on bethel island rd in bethel island ?
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 = 'bethel island' AND T2.street_name = 'bethel island rd' AND T1.rating > 2.5; |
Find the number of teachers who teach the student called CHRISSY NABOZNY.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
- teachers(Classroom, FirstName, LastName) | SELECT COUNT(*) AS num_teachers FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T1.FirstName = 'CHRISSY' AND T1.LastName = 'NABOZNY'; |
Show all countries and the number of singers in each country.?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT Country, COUNT(*) AS num_singers FROM singer GROUP BY Country; |
How many distinct characteristic names does the product "cumin" have?
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) | SELECT COUNT(DISTINCT T3.characteristic_name) AS num_characteristics 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 WHERE T1.product_name = 'sesame'; |
Find the names of goods that receive a rating of 10.?
Schema:
- item(title)
- review(i_id, rank, rating, text) | SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating = 10; |
Which committees have delegates from both democratic party and liberal party?
Schema:
- election(Committee, Date, Delegate, District, Vote_Percent, Votes)
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more)) | SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party IN ('Democratic', 'Liberal') GROUP BY T1.Committee HAVING COUNT(DISTINCT T2.Party) = 2; |
What is the average fastest lap speed for races held after 2004, for each race, ordered by year?
Schema:
- races(date, name)
- results(...) | SELECT AVG(TRY_CAST(T2.fastestLapSpeed AS DOUBLE)) AS avg_speed, T1.name, T1."year" FROM races AS T1 JOIN results AS T2 ON T1.raceId = T2.raceId WHERE T1."year" > 2014 GROUP BY T1.name, T1."year" ORDER BY T1."year" ASC NULLS LAST; |
Show each author and the number of workshops they submitted to.?
Schema:
- Acceptance(...)
- submission(Author, COUNT, College, Scores) | SELECT T2.Author, COUNT(DISTINCT T1.Workshop_ID) AS num_workshops FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author; |
Which continent is Anguilla in?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT Continent FROM country WHERE Name = 'Anguilla'; |
List the addresses of all the course authors or tutors.?
Schema:
- Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name) | SELECT address_line_1 FROM Course_Authors_and_Tutors; |
What are the claim dates and settlement dates of all the settlements?
Schema:
- Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount) | SELECT Date_Claim_Made, Date_Claim_Settled FROM Settlements; |
return me the journal, which has the most number of 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)
- journal(Theme, homepage, name) | SELECT T3.name FROM publication_keyword AS T4 JOIN keyword AS T1 ON T4.kid = T1.kid JOIN publication AS T2 ON T2.pid = T4.pid JOIN journal AS T3 ON T2.jid = T3.jid WHERE T1.keyword = 'Relational Database' GROUP BY T3.name ORDER BY COUNT(DISTINCT T2.title) DESC NULLS LAST LIMIT 1; |
How many singers do we have?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT COUNT(*) AS num_singers FROM singer; |
How many captains with younger than 50 are in each rank?
Schema:
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT COUNT(*) AS num_captains, "Rank" FROM captain WHERE TRY_CAST(age AS INT) < 50 GROUP BY "Rank"; |
What are 3 most highly rated episodes in the TV series table and what were those ratings?
Schema:
- TV_series(Air_Date, Episode, Rating, Share, Weekly_Rank) | SELECT Episode, Rating FROM TV_series ORDER BY Rating DESC NULLS LAST LIMIT 3; |
How many courses are there in total?
Schema:
- Courses(course_description, course_name) | SELECT COUNT(*) AS num_courses FROM Courses; |
Who are the authors with the most published papers in syntactic parsing ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT COUNT(T4.paperId) AS num_papers, T3.authorId FROM paperKeyphrase AS T1 JOIN keyphrase AS T2 ON T1.keyphraseId = T2.keyphraseId JOIN paper AS T4 ON T4.paperId = T1.paperId JOIN writes AS T3 ON T3.paperId = T4.paperId WHERE T2.keyphraseName = 'syntactic parsing' GROUP BY T3.authorId ORDER BY num_papers DESC NULLS LAST; |
How many sections does course ACCT-211 has?
Schema:
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) | SELECT COUNT(DISTINCT CLASS_SECTION) AS num_sections FROM CLASS WHERE CRS_CODE = 'ACCT-211'; |
which capitals are in the states that 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'; |
Who cites Daniel A Reed most ?
Schema:
- writes(...)
- author(...)
- cite(...) | SELECT DISTINCT COUNT(T4.citingPaperId) AS num_cites, T3.authorId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN cite AS T4 ON T2.paperId = T4.citedPaperId JOIN writes AS T3 ON T3.paperId = T4.citingPaperId WHERE T1.authorName = 'Daniel A Reed' GROUP BY T3.authorId ORDER BY num_cites DESC NULLS LAST; |
Find the names of all physicians and their primary affiliated departments' names.?
Schema:
- Physician(I, Name)
- Affiliated_With(Department, Physician, PrimaryAffiliation)
- Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2) | SELECT T1.Name, T3.Name FROM Physician AS T1 JOIN Affiliated_With AS T2 ON T1.EmployeeID = T2.Physician JOIN Department AS T3 ON T2.Department = T3.DepartmentID WHERE T2.PrimaryAffiliation = 1; |
What is the total money requested by entrepreneurs with height more than 1.85?
Schema:
- entrepreneur(COUNT, Company, Investor, Money_Requested)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT SUM(T1.Money_Requested) AS total_money_requested FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 1.85; |
Which template type code is used by most number of documents?
Schema:
- Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number)
- 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.Template_Type_Code FROM Templates AS T1 JOIN Documents AS T2 ON T1.Template_ID = T2.Template_ID GROUP BY T1.Template_Type_Code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the lowest salary in departments with average salary greater than the overall average.?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary) | SELECT MIN(salary) AS min_salary, dept_name FROM instructor WHERE dept_name IS NOT NULL GROUP BY dept_name HAVING AVG(salary) > (SELECT AVG(salary) FROM instructor WHERE dept_name IS NOT NULL); |
Show the card type codes and the number of transactions.?
Schema:
- Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type)
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to) | SELECT T2.card_type_code, COUNT(*) AS num_transactions FROM Financial_Transactions AS T1 JOIN Customers_Cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code; |
Find the name of the club that has the most female students.?
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 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.Sex = 'F' GROUP BY T1.ClubName ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the ids of students who both have friends and are liked?
Schema:
- Friend(student_id)
- Likes(student_id) | SELECT DISTINCT T1.student_id FROM Friend AS T1 JOIN Likes AS T2 ON T1.student_id = T2.liked_id; |
What is the number of airports per country, ordered from most to least?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT COUNT(*) AS num_airports, country FROM airports WHERE country IS NOT NULL GROUP BY country ORDER BY num_airports DESC NULLS LAST; |
What is the location of the bridge named 'Kolob Arch' or 'Rainbow Bridge'?
Schema:
- bridge(Ra, length_feet, location, name) | SELECT location FROM bridge WHERE name = 'Kolob Arch' OR name = 'Rainbow Bridge'; |
Give me the claim date, settlement date for all the claims whose claimed amount is larger than the average.?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled) | SELECT Date_Claim_Made, Date_Claim_Settled FROM Claims WHERE Amount_Claimed > (SELECT AVG(Amount_Claimed) FROM Claims); |
return me the total citations of all the papers in PVLDB .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name) | SELECT SUM(T2.citation_num) AS total_citations FROM publication AS T2 JOIN journal AS T1 ON T2.jid = T1.jid WHERE T1.name = 'PVLDB'; |
List papers that has a keyword Question Answering?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.keyphraseName = 'Question Answering'; |
What are the dates when customers with ids between 10 and 20 became customers?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT date_became_customer FROM Customers WHERE customer_id BETWEEN 10 AND 20; |
What are the names and ids of all countries with at least one car maker?
Schema:
- countries(...)
- car_makers(...) | SELECT T1.CountryName, T1.CountryId FROM countries AS T1 JOIN car_makers AS T2 ON T1.CountryId = T2.CountryId GROUP BY T1.CountryId, T1.CountryName HAVING COUNT(*) >= 1; |
Give the full name and phone of the customer who has the account name 162.?
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 T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = '162'; |
Show the names of all high schoolers in grade 10.?
Schema:
- Highschooler(COUNT, ID, grade, name) | SELECT name FROM Highschooler WHERE grade = 10; |
What are the visit date and details of the visitor whose detail is 'Vincent'?
Schema:
- Visitors(Tourist_Details)
- Visits(Visit_Date) | SELECT T2.Visit_Date, T2.Visit_Details FROM Visitors AS T1 JOIN Visits AS T2 ON T1.Tourist_ID = T2.Tourist_ID WHERE T1.Tourist_Details = 'Vincent'; |
Find the claims that led to more than two settlements or have the maximum claim value. For each of them, return the date the claim was made and the id of the claim.?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled)
- Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount) | SELECT Date_Claim_Made, Claim_ID FROM (SELECT T1.Date_Claim_Made, T1.Claim_ID FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID GROUP BY T1.Date_Claim_Made, T1.Claim_ID HAVING COUNT(*) > 2 UNION ALL SELECT T1.Date_Claim_Made, T1.Claim_ID FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID WHERE T1.Amount_Claimed = (SELECT MAX(Amount_Claimed) FROM Claims)) GROUP BY Date_Claim_Made, Claim_ID; |
Find the name, checking balance and savings balance of all accounts in the bank sorted by their total checking and savings balance in descending order.?
Schema:
- ACCOUNTS(name)
- CHECKING(balance)
- SAVINGS(SAV, balance) | SELECT T2.balance AS checking_balance, T3.balance AS savings_balance, T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid ORDER BY T2.balance + T3.balance DESC NULLS LAST; |
How many papers related to deep learning cited the dataset ImageNet ?
Schema:
- paperDataset(...)
- dataset(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- paperKeyphrase(...)
- keyphrase(...) | SELECT DISTINCT COUNT(T4.paperId) AS num_papers FROM paperDataset AS T3 JOIN dataset AS T2 ON T3.datasetId = T2.datasetId JOIN paper AS T4 ON T4.paperId = T3.paperId JOIN paperKeyphrase AS T1 ON T4.paperId = T1.paperId JOIN keyphrase AS T5 ON T1.keyphraseId = T5.keyphraseId WHERE T2.datasetName = 'ImageNet' AND T5.keyphraseName = 'deep learning'; |
Return the grade that has the greatest number of high schoolers.?
Schema:
- Highschooler(COUNT, ID, grade, name) | SELECT grade FROM Highschooler WHERE grade IS NOT NULL GROUP BY grade ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the name of airports which do not have any flight in and out.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT AirportName FROM airports WHERE AirportCode NOT IN (SELECT SourceAirport FROM flights UNION ALL SELECT DestAirport FROM flights); |
What are the last names of female students, ordered by age descending?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT LName FROM Student WHERE Sex = 'F' ORDER BY Age DESC NULLS LAST; |
Find the name of the airports located in Cuba or Argentina.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT name FROM airports WHERE country = 'Cuba' OR country = 'Argentina'; |
What is the shipping agent code of shipping agent UPS?
Schema:
- Ref_Shipping_Agents(shipping_agent_code, shipping_agent_name) | SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_name = 'UPS'; |
give me the largest state?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state); |
Show the average, minimum, and maximum ticket prices for exhibitions for all years before 2009.?
Schema:
- exhibition(Theme, Ticket_Price, Year) | SELECT AVG(Ticket_Price) AS avg_ticket_price, MIN(Ticket_Price) AS min_ticket_price, MAX(Ticket_Price) AS max_ticket_price FROM exhibition WHERE "Year" < 2009; |
What are all role codes?
Schema:
- Roles(Role_Code, Role_Description, Role_Name, role_code, role_description) | SELECT role_code FROM Roles; |
What is "the date in location from" and "the date in location to" for the document with name "Robin CV"?
Schema:
- Document_Locations(COUNT, Date_in_Location_From, Date_in_Locaton_To, Location_Code)
- All_Documents(Date_Stored, Document_Name, Document_Type_Code) | SELECT T1.Date_in_Location_From, T1.Date_in_Locaton_To FROM Document_Locations AS T1 JOIN All_Documents AS T2 ON T1.Document_ID = T2.Document_ID WHERE T2.Document_Name = 'Robin CV'; |
What are the names of projects that require between 100 and 300 hours?
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 customers have opened an account?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT COUNT(DISTINCT customer_id) AS num_customers FROM Accounts; |
What are the different types of video games?
Schema:
- Video_Games(COUNT, Dest, GName, GType, onl) | SELECT DISTINCT GType FROM Video_Games; |
Find the first names of students who took exactly one class.?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
- ENROLL(...) | SELECT T1.STU_FNAME FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM GROUP BY T2.STU_NUM, T1.STU_FNAME HAVING COUNT(*) = 1; |
Which professionals have done at least two types of treatments? List the professional id and cell phone.?
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) | SELECT T1.professional_id, T1.cell_number FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id, T1.cell_number HAVING COUNT(*) >= 2; |
Show the id and name of the aircraft with the maximum distance.?
Schema:
- aircraft(Description, aid, d, distance, name) | SELECT aid, name FROM aircraft ORDER BY distance DESC NULLS LAST LIMIT 1; |
What is the last name of the musician that has been at the back position the most?
Schema:
- Performance(...)
- Band(...) | SELECT T2.Lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id WHERE StagePosition = 'back' AND Lastname IS NOT NULL GROUP BY Lastname ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the building, room number, semester and year of all courses offered by Psychology department sorted by course titles.?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- section(COUNT, JO, Spr, T1, course_id, semester, year) | SELECT T2.building, T2.room_number, T2.semester, T2."year" FROM course AS T1 JOIN section AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title ASC NULLS LAST; |
Return the birth date of the poker player with the lowest earnings.?
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 T1.Birth_Date FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Earnings ASC NULLS LAST LIMIT 1; |
How many unique classes are offered?
Schema:
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) | SELECT COUNT(DISTINCT CLASS_CODE) AS num_classes FROM CLASS; |
Give me the papers written by Su-In Lee before 2012 .?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'Su-In Lee' AND T3."year" < 2012; |
Which status code is the most common of all the bookings?
Schema:
- Bookings(Actual_Delivery_Date, COUNT, Order_Date, Planned_Delivery_Date, Status_Code) | SELECT Status_Code FROM Bookings WHERE Status_Code IS NOT NULL GROUP BY Status_Code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
what state that borders california is the largest?
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 area = (SELECT MAX(area) FROM state 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 total point count of the youngest gymnast?
Schema:
- gymnast(Floor_Exercise_Points, Horizontal_Bar_Points)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T1.Total_Points FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Age ASC NULLS LAST LIMIT 1; |
what is the shortest river in the usa?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE LENGTH = (SELECT MIN(LENGTH) FROM river); |
what is the longest river that flows through 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'; |
What are the ages of the gymnasts, ordered descending by their total points?
Schema:
- gymnast(Floor_Exercise_Points, Horizontal_Bar_Points)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T2.Age FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T1.Total_Points DESC NULLS LAST; |
Show the start dates and end dates of all the apartment bookings.?
Schema:
- Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code) | SELECT booking_start_date, booking_end_date FROM Apartment_Bookings; |
How many different teams have had eliminated wrestlers?
Schema:
- Elimination(Benjam, Eliminated_By, Elimination_Move, T1, Team, Time) | SELECT COUNT(DISTINCT Team) AS num_teams FROM Elimination; |
Show the most common nationality of hosts.?
Schema:
- host(Age, COUNT, Name, Nationality) | SELECT Nationality FROM host WHERE Nationality IS NOT NULL GROUP BY Nationality ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the first names and date of birth of professors teaching course ACCT-211?
Schema:
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME)
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) | SELECT DISTINCT T1.EMP_FNAME, T1.EMP_DOB FROM EMPLOYEE AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE CRS_CODE = 'ACCT-211'; |
Show all headquarters with both a company in banking industry and a company in Oil and gas.?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT DISTINCT T1.Headquarters FROM company AS T1 JOIN company AS T2 ON T1.Headquarters = T2.Headquarters WHERE T1.Main_Industry = 'Banking' AND T2.Main_Industry = 'Oil and gas'; |
What are the main indstries and total market value for each industry?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Main_Industry, SUM(Market_Value) AS total_market_value FROM company GROUP BY Main_Industry; |
Papers from Liwen Xiong in 2015?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'Liwen Xiong' AND T3."year" = 2015; |
Find the name and position of the head of the department with the least employees.?
Schema:
- Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2)
- Physician(I, Name) | SELECT T2.Name, T2."Position" FROM Department AS T1 JOIN Physician AS T2 ON T1.Head = T2.EmployeeID GROUP BY T2.Name, T2."Position", DepartmentID ORDER BY COUNT(DepartmentID) ASC NULLS LAST LIMIT 1; |
For each singer name, what is the total sales for their songs?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more)) | SELECT T1.Name, SUM(T2.Sales) AS total_sales FROM singer AS T1 JOIN song AS T2 ON T1.Singer_ID = T2.Singer_ID GROUP BY T1.Name; |
What is the first name of students enrolled in class ACCT-211 and got grade C?
Schema:
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
- ENROLL(...)
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE) | SELECT T3.STU_FNAME FROM CLASS AS T1 JOIN ENROLL AS T2 ON T1.CLASS_CODE = T2.CLASS_CODE JOIN STUDENT AS T3 ON T2.STU_NUM = T3.STU_NUM WHERE T1.CRS_CODE = 'ACCT-211' AND T2.ENROLL_GRADE = 'C'; |
What are the names of everybody sorted by age in descending order?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT name FROM Person ORDER BY age DESC NULLS LAST; |
What are the names and ids of customers whose address contains TN?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT customer_name, customer_id FROM Customers WHERE customer_address LIKE '%TN%'; |
How many Annual Meeting events happened in the United Kingdom region?
Schema:
- region(Label, Region_code, Region_name)
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
- party_events(Event_Name) | SELECT COUNT(*) AS num_events FROM region AS T1 JOIN party AS T2 ON T1.Region_ID = T2.Region_ID JOIN party_events AS T3 ON T2.Party_ID = T3.Party_ID WHERE T1.Region_name = 'United Kingdom' AND T3.Event_Name = 'Annaual Meeting'; |
What are the names of the songs without a lead vocal?
Schema:
- Vocals(COUNT, Type)
- Songs(Title) | SELECT DISTINCT Title FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Title NOT IN (SELECT T2.Title FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Type = 'lead'); |
What is the origin and destination for all flights whose price is higher than 300?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT origin, destination FROM flight WHERE price > 300; |
What are the names of parties that do not have delegates in election?
Schema:
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
- election(Committee, Date, Delegate, District, Vote_Percent, Votes) | SELECT Party FROM party WHERE Party_ID NOT IN (SELECT Party FROM election); |
Which city lives most of staffs? List the city name and number of staffs.?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- Staff(COUNT, Name, Other_Details, date_joined_staff, date_left_staff, date_of_birth, email_address, first_name, gender, last_name, middle_name, nickname) | SELECT T1.city, COUNT(*) AS num_staffs FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.city ORDER BY num_staffs DESC NULLS LAST LIMIT 1; |
Which payment method is used by most customers?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT payment_method FROM Customers WHERE payment_method IS NOT NULL GROUP BY payment_method ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
For each classroom, report the classroom number and the number of grades using it.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName) | SELECT Classroom, COUNT(DISTINCT Grade) AS num_grades FROM list GROUP BY Classroom; |
What is the description of the color for most products?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Ref_Colors(color_description) | SELECT T2.color_description FROM Products AS T1 JOIN Ref_Colors AS T2 ON T1.color_code = T2.color_code GROUP BY T2.color_description ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
are there any syntactic parsing papers not written by chris dyer ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T1.authorName, 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 != 'chris dyer' AND T5.keyphraseName = 'syntactic parsing'; |
Who is the earliest graduate of the school? List the first name, middle name and last name.?
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 first_name, middle_name, last_name FROM Students ORDER BY date_left ASC NULLS LAST LIMIT 1; |
Which problems are reported by the staff with first name "Christop"? Show the descriptions of the problems.?
Schema:
- Problems(date_problem_reported, problem_id)
- Staff(COUNT, Name, Other_Details, date_joined_staff, date_left_staff, date_of_birth, email_address, first_name, gender, last_name, middle_name, nickname) | SELECT T1.problem_description FROM Problems AS T1 JOIN Staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = 'Christop'; |
How many faculty members do we have for each faculty rank?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT "Rank", COUNT(*) AS num_faculty FROM Faculty GROUP BY "Rank"; |
Show the types of schools that have two schools.?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type) | SELECT Type FROM school WHERE Type IS NOT NULL GROUP BY Type HAVING COUNT(*) = 2; |
Which customer made the largest amount of claim in a single claim? Return the customer details.?
Schema:
- Claim_Headers(Amount_Piad)
- Policies(COUNT, Policy_Type_Code)
- 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 T3.Customer_Details FROM Claim_Headers AS T1 JOIN Policies AS T2 ON T1.Policy_ID = T2.Policy_ID JOIN Customers AS T3 ON T2.Customer_ID = T3.Customer_ID WHERE T1.Amount_Claimed = (SELECT MAX(Amount_Claimed) FROM Claim_Headers); |
Latest paper by oren etzioni?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT T2.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'oren etzioni' GROUP BY T2.paperId, T3."year" ORDER BY T3."year" DESC NULLS LAST; |
List the names and buildings of all departments sorted by the budget from large to small.?
Schema:
- department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name) | SELECT dept_name, building FROM department ORDER BY budget DESC NULLS LAST; |
What is the average and total capacity for all dorms who are of gender X?
Schema:
- Dorm(dorm_name, gender, student_capacity) | SELECT AVG(student_capacity) AS avg_capacity, SUM(student_capacity) AS total_capacity FROM Dorm WHERE gender = 'X'; |
the names of models that launched between 2002 and 2004.?
Schema:
- chip_model(Launch_year, Model_name, RAM_MiB, WiFi) | SELECT Model_name FROM chip_model WHERE Launch_year BETWEEN 2002 AND 2004; |
What are the room name and base price of the room with the lowest base price?
Schema:
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT roomName, basePrice FROM Rooms ORDER BY basePrice ASC NULLS LAST LIMIT 1; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.