question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
What is the name of the activity with the most students?
Schema:
- Activity(activity_name)
- Participates_in(...) | SELECT T1.activity_name FROM Activity AS T1 JOIN Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid, T1.activity_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many distinct delegates are from counties with population larger than 50000?
Schema:
- county(County_name, Population, Zip_code)
- election(Committee, Date, Delegate, District, Vote_Percent, Votes) | SELECT COUNT(DISTINCT T2.Delegate) AS num_delegates FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District WHERE T1.Population > 50000; |
Which teachers teach in classroom 110? Give me their first names.?
Schema:
- teachers(Classroom, FirstName, LastName) | SELECT FirstName FROM teachers WHERE Classroom = 110; |
What are the distinct names and phone numbers for suppliers who have red jeans?
Schema:
- Suppliers(...)
- Product_Suppliers(COUNT, DOUBLE, TRY_CAST, product_id, supplier_id)
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT DISTINCT T1.supplier_name, T1.supplier_phone FROM Suppliers AS T1 JOIN Product_Suppliers AS T2 ON T1.supplier_id = T2.supplier_id JOIN Products AS T3 ON T2.product_id = T3.product_id WHERE T3.product_name = 'red jeans'; |
papers written by authors 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'; |
Which papers cite Daniel Jurafsky ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...)
- writes(...)
- author(...) | SELECT DISTINCT T3.paperId FROM paper AS T3 JOIN cite AS T4 ON T3.paperId = T4.citingPaperId JOIN writes AS T2 ON T2.paperId = T4.citedPaperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'Daniel Jurafsky'; |
What are the email addresses of teachers whose address has zip code "918"?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- Teachers(email_address, first_name, gender, last_name) | SELECT T2.email_address FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T1.zip_postcode = '918'; |
name all the rivers in illinois?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE traverse = 'illinois'; |
What are the names of companies whose headquarters are not "USA"?
Schema:
- Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name) | SELECT name FROM Companies WHERE Headquarters != 'USA'; |
Group by ships by flag, and return number of ships that have each flag.?
Schema:
- Ship(Built_Year, COUNT, Class, Flag, Name, Type) | SELECT COUNT(*) AS num_ships, Flag FROM Ship GROUP BY Flag; |
Return the total number of deaths and total damange in millions for storms that had a max speed greater than the average.?
Schema:
- storm(Damage_millions_USD, Dates_active, Name, Number_Deaths) | SELECT SUM(Number_Deaths) AS total_deaths, SUM(Damage_millions_USD) AS total_damage FROM storm WHERE Max_speed > (SELECT AVG(Max_speed) FROM storm); |
What is the type of allergy Cat?
Schema:
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT AllergyType FROM Allergy_Type WHERE Allergy = 'Cat'; |
Which airlines have a flight with destination airport AHD?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT T1.Airline FROM airlines AS T1 JOIN flights AS T2 ON T1.uid = T2.Airline WHERE T2.DestAirport = 'AHD'; |
Show id, first and last names for all customers with at least two cards.?
Schema:
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to)
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT T1.customer_id, T2.customer_first_name, T2.customer_last_name FROM Customers_Cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id, T2.customer_first_name, T2.customer_last_name HAVING COUNT(*) >= 2; |
List the names of all music genres.?
Schema:
- Genre(Name) | SELECT Name FROM Genre; |
Find all businesses in Texas with a rating below 2?
Schema:
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT name FROM business WHERE rating < 2 AND state = 'Texas'; |
Find the name of the airport in the city of Goroka.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT name FROM airports WHERE city = 'Goroka'; |
What are the names of different music genres?
Schema:
- Genre(Name) | SELECT Name FROM Genre; |
Find all movies by directors born in " Los Angeles "?
Schema:
- director(Afghan, name, nationality)
- directed_by(...)
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) | SELECT T3.title FROM director AS T2 JOIN directed_by AS T1 ON T2.did = T1.did JOIN movie AS T3 ON T3.mid = T1.msid WHERE T2.birth_city = 'Los Angeles'; |
What is the first and last name of all students who play Football or Lacrosse?
Schema:
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT T2.LName, T2.Fname FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.SportName = 'Football' OR T1.SportName = 'Lacrosse'; |
What are ids of the all distinct orders, sorted by placement date?
Schema:
- Orders(customer_id, date_order_placed, order_id) | SELECT order_id FROM Orders WHERE order_id IS NOT NULL AND date_order_placed IS NOT NULL GROUP BY order_id, date_order_placed ORDER BY date_order_placed ASC NULLS LAST; |
What is maximum, minimum and average amount of outstanding of customer?
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 MAX(amount_outstanding) AS max_amount_outstanding, MIN(amount_outstanding) AS min_amount_outstanding, AVG(amount_outstanding) AS avg_amount_outstanding FROM Customers; |
What is total amount claimed summed across all the claims?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled) | SELECT SUM(Amount_Claimed) AS total_amount_claimed FROM Claims; |
Show the role description and the id of the project staff involved in most number of project outcomes?
Schema:
- Staff_Roles(role_code, role_description)
- Project_Staff(COUNT, date_from, date_to, role_code)
- Project_Outcomes(outcome_code) | SELECT T1.role_description, T2.staff_id FROM Staff_Roles AS T1 JOIN Project_Staff AS T2 ON T1.role_code = T2.role_code JOIN Project_Outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T2.staff_id, T1.role_description ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Count the number of male students who had class senator votes in the fall 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 COUNT(*) AS num_male_students FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.Sex = 'M' AND T2.Election_Cycle = 'Fall'; |
Which countries do not have a stadium that was opened after 2006?
Schema:
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1) | SELECT DISTINCT Country FROM stadium WHERE Country NOT IN (SELECT Country FROM stadium WHERE Opening_year > 2006); |
Count the number of characteristics.?
Schema:
- Characteristics(characteristic_name) | SELECT COUNT(*) AS num_characteristics FROM Characteristics; |
What is the total number of customers across banks?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state) | SELECT SUM(no_of_customers) AS total_customers FROM bank; |
Find courses that ran in Fall 2009 and in Spring 2010.?
Schema:
- section(COUNT, JO, Spr, T1, course_id, semester, year) | SELECT DISTINCT T1.course_id FROM (SELECT course_id FROM section WHERE semester = 'Fall' AND "year" = 2009) AS T1 JOIN (SELECT course_id FROM section WHERE semester = 'Spring' AND "year" = 2010) AS T2 ON T1.course_id = T2.course_id; |
How many fault status codes are recorded in the fault log parts table?
Schema:
- Fault_Log_Parts(fault_status) | SELECT DISTINCT fault_status FROM Fault_Log_Parts; |
Show the names and total passengers for all train stations not in London.?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT Name, Total_Passengers FROM station WHERE Location != 'London'; |
Find the code of the document type "Paper".?
Schema:
- Ref_Document_Types(Document_Type_Code, Document_Type_Description, Document_Type_Name, document_type_code, document_type_description) | SELECT Document_Type_Code FROM Ref_Document_Types WHERE Document_Type_Name = 'Paper'; |
Show the countries that have both perpetrators with injures more than 50 and perpetrators with injures smaller than 20.?
Schema:
- perpetrator(Country, Date, Injured, Killed, Location, Year) | SELECT DISTINCT Country FROM perpetrator WHERE Injured > 50 OR Injured < 20; |
Find the year and semester when offers the largest number of courses.?
Schema:
- section(COUNT, JO, Spr, T1, course_id, semester, year) | SELECT semester, "year" FROM section GROUP BY semester, "year" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Give the full name and customer id of the customer with the fewest accounts.?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT T2.customer_first_name, T2.customer_last_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id, T2.customer_first_name, T2.customer_last_name ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
How many documents have expenses?
Schema:
- Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID) | SELECT COUNT(*) AS num_documents FROM Documents_with_Expenses; |
Find the team that attended the least number of home games in 1980.?
Schema:
- home_game(attendance, year)
- team(Name) | SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1."year" = 1980 ORDER BY T1.attendance ASC NULLS LAST LIMIT 1; |
Count the number of characteristics of the product named 'laurel'.?
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(*) 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 = 'laurel'; |
Find the number of professors with a Ph.D. degree in each department.?
Schema:
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) | SELECT COUNT(*) AS num_professors, DEPT_CODE FROM PROFESSOR WHERE PROF_HIGH_DEGREE = 'Ph.D.' GROUP BY DEPT_CODE; |
What are the names and dates for documents corresponding to project that has the details 'Graph Database project'?
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))
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT Document_Name, Document_Date FROM Documents AS T1 JOIN Projects AS T2 ON T1.Project_ID = T2.Project_ID WHERE T2.Project_Details = 'Graph Database project'; |
What are the names and phone numbers for all suppliers, sorted in alphabetical order of their addressed?
Schema:
- Suppliers(...)
- Supplier_Addresses(...)
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT T1.supplier_name, T1.supplier_phone FROM Suppliers AS T1 JOIN Supplier_Addresses AS T2 ON T1.supplier_id = T2.supplier_id JOIN Addresses AS T3 ON T2.address_id = T3.address_id ORDER BY T3.address_details ASC NULLS LAST; |
List the name of ships whose nationality is not "United States".?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT Name FROM ship WHERE Nationality != 'United States'; |
Show the denomination shared by schools founded before 1890 and schools founded after 1900?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type) | SELECT DISTINCT T1.Denomination FROM school AS T1 WHERE EXISTS (SELECT 1 FROM school AS T2 WHERE T1.Denomination = T2.Denomination AND T2.Founded < 1890) AND EXISTS (SELECT 1 FROM school AS T3 WHERE T1.Denomination = T3.Denomination AND T3.Founded > 1900); |
Find the number of trains starting from each origin.?
Schema:
- train(Name, Service, Time, destination, name, origin, time, train_number) | SELECT origin, COUNT(*) AS num_trains FROM train GROUP BY origin; |
Which cities are in European countries where English is not the official language?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- countrylanguage(COUNT, CountryCode, Engl, Language) | SELECT DISTINCT T2.Name FROM country AS T1 JOIN city AS T2 ON T2.CountryCode = T1.Code WHERE T1.Continent = 'Europe' AND T1.Name NOT IN (SELECT T3.Name FROM country AS T3 JOIN countrylanguage AS T4 ON T3.Code = T4.CountryCode WHERE T4.IsOfficial = 'T' AND T4."Language" = 'English'); |
Find the names of all person sorted in the descending order using age.?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT name FROM Person ORDER BY age DESC NULLS LAST; |
which rivers do not run through tennessee?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE river_name NOT IN (SELECT river_name FROM river WHERE traverse = 'tennessee'); |
return me the papers on VLDB conference after 2000 .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- conference(homepage, name) | SELECT T2.title FROM publication AS T2 JOIN conference AS T1 ON T2.cid = CAST(T1.cid AS TEXT) WHERE T1.name = 'VLDB' AND T2."year" > 2000; |
What is the count and code of the job with the most employee?
Schema:
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) | SELECT EMP_JOBCODE, COUNT(*) AS num_employees FROM EMPLOYEE WHERE EMP_JOBCODE IS NOT NULL GROUP BY EMP_JOBCODE ORDER BY num_employees DESC NULLS LAST LIMIT 1; |
What is the type of the organization with the most research staff?
Schema:
- Organisations(...)
- Research_Staff(staff_details) | SELECT T1.organisation_type FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_type ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the names of all instructors who have taught a course, as well as the corresponding course id?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary)
- teaches(ID, Spr, semester) | SELECT name, course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID; |
Find the name and salary of the instructors who are advisors of any student from History department?
Schema:
- advisor(s_ID)
- instructor(AVG, M, So, Stat, dept_name, name, salary)
- student(COUNT, H, dept_name, name, tot_cred) | SELECT T2.name, T2.salary FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_ID = T2.ID JOIN student AS T3 ON T1.s_ID = T3.ID WHERE T3.dept_name = 'History'; |
What are the names of the clubs that have "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'; |
What are the types of vocals that the musician with the first name "Solveig" played in the song "A Bar in Amsterdam"?
Schema:
- Vocals(COUNT, Type)
- Songs(Title)
- Band(...) | SELECT Type FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId JOIN Band AS T3 ON T1.Bandmate = T3.Id WHERE T3.Firstname = 'Solveig' AND T2.Title = 'A Bar In Amsterdam'; |
Show the names and details of all the staff members.?
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) | SELECT Name, Other_Details FROM Staff; |
List roles that have more than one employee. List the role description and number of employees.?
Schema:
- Roles(Role_Code, Role_Description, Role_Name, role_code, role_description)
- Employees(COUNT, Date_of_Birth, Employee_ID, Employee_Name, Role_Code, employee_id, employee_name, role_code) | SELECT Roles.role_description, COUNT(Employees.employee_id) AS num_employees FROM Roles JOIN Employees ON Employees.role_code = Roles.role_code GROUP BY Employees.role_code, Roles.role_description HAVING COUNT(Employees.employee_id) > 1; |
What are the different transaction types, and how many transactions of each have taken place?
Schema:
- Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type) | SELECT transaction_type, COUNT(*) AS num_transactions FROM Financial_Transactions GROUP BY transaction_type; |
What are the first name and last name of the players who were paid salary by team Washington Nationals in both 2005 and 2007?
Schema:
- salary(salary)
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
- team(Name) | SELECT T2.name_first, T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T3.name = 'Washington Nationals' AND T1."year" IN (2005, 2007) GROUP BY T2.name_first, T2.name_last HAVING COUNT(DISTINCT T1."year") = 2; |
Return the names of cities that have a population between 160000 and 900000 .?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT Name FROM city WHERE Population BETWEEN 160000 AND 900000; |
Can you return all detailed info of jobs which was done by any of the employees who is presently earning a salary on and above 12000?
Schema:
- job_history(EMPLOYEE_ID, END_DATE, JOB_ID)
- employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) | SELECT * FROM job_history AS T1 JOIN employees AS T2 ON T1.EMPLOYEE_ID = T2.EMPLOYEE_ID WHERE T2.SALARY >= 12000; |
Show names for all employees who do not have certificate of Boeing 737-800.?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
- certificate(eid)
- aircraft(Description, aid, d, distance, name) | SELECT name FROM employee WHERE name NOT IN (SELECT T1.name FROM employee AS T1 JOIN certificate AS T2 ON T1.eid = T2.eid JOIN aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Boeing 737-800'); |
What is the denomination of the school the most players belong to?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type) | SELECT T2.Denomination FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID, T2.Denomination ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the name of the person who has the oldest average age for their friends, and what is that average age?
Schema:
- Person(M, age, city, eng, gender, job, name)
- PersonFriend(M, friend, name) | SELECT T2.name, AVG(T1.age) AS avg_age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend GROUP BY T2.name ORDER BY avg_age DESC NULLS LAST LIMIT 1; |
Show all flight number from Los Angeles.?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT flno FROM flight WHERE origin = 'Los Angeles'; |
What is the average pages per minute color?
Schema:
- product(COUNT, pages_per_minute_color, product) | SELECT AVG(pages_per_minute_color) AS avg_pages_per_minute_color FROM product; |
Show names of actors that have appeared in musical with name "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'; |
Return the average horizontal bar points across all gymnasts.?
Schema:
- gymnast(Floor_Exercise_Points, Horizontal_Bar_Points) | SELECT AVG(Horizontal_Bar_Points) AS avg_horizontal_bar_points FROM gymnast; |
How many students are age 18?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_students FROM Student WHERE Age = 18; |
How many journalists are there?
Schema:
- journalist(Age, COUNT, Name, Nationality, T1, Years_working) | SELECT COUNT(*) AS num_journalists FROM journalist; |
recent deep learning papers?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId, T3."year" 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 = 'deep learning' ORDER BY T3."year" DESC NULLS LAST; |
For each building, show the name of the building and the number of institutions in it.?
Schema:
- building(Floors, Height_feet, Name, build)
- Institution(COUNT, Enrollment, Founded, Type) | SELECT T1.Name, COUNT(*) AS num_institutions FROM building AS T1 JOIN Institution AS T2 ON T1.building_id = T2.building_id GROUP BY T1.building_id, T1.Name; |
return me the keywords, which have been contained by more than 10 papers of " 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' GROUP BY T1.keyword HAVING COUNT(DISTINCT T3.title) > 10; |
Find the number of distinct products Rodrick Heaney has bought so far.?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Customer_Orders(customer_id, order_date, order_id, order_shipping_charges)
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) | SELECT COUNT(DISTINCT T3.product_id) AS num_products FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_Items AS T3 ON T2.order_id = T3.order_id WHERE T1.customer_name = 'Rodrick Heaney'; |
List the area and county of all appelations.?
Schema:
- appellations(Area, County) | SELECT Area, County FROM appellations; |
What is the program id and the summary of the degree that has the most students enrolled?
Schema:
- Degree_Programs(degree_summary_name, department_id)
- Student_Enrolment(...) | SELECT T1.degree_program_id, T1.degree_summary_name FROM Degree_Programs AS T1 JOIN Student_Enrolment AS T2 ON T1.degree_program_id = T2.degree_program_id GROUP BY T1.degree_program_id, T1.degree_summary_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How much does the car accelerate that makes amc hornet sportabout (sw)?
Schema:
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
- car_names(COUNT, Model) | SELECT T1.Accelerate FROM cars_data AS T1 JOIN car_names AS T2 ON T1.Id = T2.MakeId WHERE T2.Make = 'amc hornet sportabout (sw)'; |
What are the names and capitals of each country?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT Country_name, Capital FROM country; |
Show the prices of publications whose publisher is either "Pearson" or "Wiley"?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT Price FROM publication WHERE Publisher = 'Person' OR Publisher = 'Wiley'; |
How many papers were written on question answering in 2011 through 2016 ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(T3.paperId) AS num_papers 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' AND T3."year" >= 2011; |
Which major has between 2 and 30 number of students? List major and the number of students.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Major, COUNT(*) AS num_students FROM Student WHERE Major IS NOT NULL GROUP BY Major HAVING COUNT(Major) BETWEEN 2 AND 30; |
Return all the distinct payment methods used by 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 DISTINCT payment_method FROM Customers; |
What is the name of the race held most recently?
Schema:
- races(date, name) | SELECT name FROM races ORDER BY "date" DESC NULLS LAST LIMIT 1; |
What is the average grade of students who have friends?
Schema:
- Highschooler(COUNT, ID, grade, name)
- Friend(student_id) | SELECT AVG(grade) AS avg_grade FROM Highschooler WHERE ID IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID); |
How many airlines do we have?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name) | SELECT COUNT(*) AS num_airlines FROM airlines; |
how high is the highest point in delaware?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT highest_elevation FROM highlow WHERE state_name = 'delaware'; |
Find all the customer information in state NY.?
Schema:
- Customer(Email, FirstName, LastName, State, lu) | SELECT * FROM Customer WHERE State = 'NY'; |
Find the number of members of club "Pen and Paper Gaming".?
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 COUNT(*) AS num_members 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 = 'Pen and Paper Gaming'; |
Show the names of members and the locations of colleges they go to in ascending alphabetical order of member names.?
Schema:
- college(College_Location, Leader_Name)
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) | SELECT T2.Name, T1.College_Location FROM college AS T1 JOIN member_ AS T2 ON T1.College_ID = T2.College_ID ORDER BY T2.Name ASC NULLS LAST; |
What is the description of document type 'Paper'?
Schema:
- Ref_Document_Types(Document_Type_Code, Document_Type_Description, Document_Type_Name, document_type_code, document_type_description) | SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code = 'Paper'; |
Who is the oldest person whose job is student?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT name FROM Person WHERE job = 'student' AND age = (SELECT MAX(age) FROM Person WHERE job = 'student'); |
Papers on WebKB?
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'; |
Show all account ids and account details.?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT Account_ID, Account_Details FROM Accounts; |
What are the last names of staff with email addressed containing the substring "wrau"?
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) | SELECT last_name FROM Staff WHERE email_address LIKE '%wrau%'; |
Which campus was opened between 1935 and 1939?
Schema:
- Campuses(Campus, County, Franc, Location) | SELECT Campus FROM Campuses WHERE "Year" >= 1935 AND "Year" <= 1939; |
What is the status code, phone number, and email address of the customer whose last name is Kohler or whose first name is Marina?
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_status_code, cell_mobile_phone_number, email_address FROM Customers WHERE first_name = 'Marina' OR last_name = 'Kohler'; |
Find the author who achieved the highest score in a submission.?
Schema:
- submission(Author, COUNT, College, Scores) | SELECT Author FROM submission ORDER BY Scores DESC NULLS LAST LIMIT 1; |
What are the names of stations that have latitude lower than 37.5?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT name FROM station WHERE lat < 37.5; |
What are the average price and score of wines grouped by appelation?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT AVG(Price) AS avg_price, AVG(Score) AS avg_score, Appelation FROM wine GROUP BY Appelation; |
give me a good place in mountain view for arabic food ?
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 = 'mountain view' AND T1.food_type = 'arabic' AND T1.rating > 2.5; |
Find the title and star rating of the movie that got the least rating star for each reviewer.?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year) | SELECT T2.title, T1.rID, T1.stars, MIN(T1.stars) AS min_stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.rID, T2.title, T1.stars; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.