question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
How many customers are there?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state) | SELECT SUM(no_of_customers) AS total_customers FROM bank; |
Show the average amount of transactions for different investors.?
Schema:
- Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code) | SELECT investor_id, AVG(amount_of_transaction) AS avg_amount_of_transaction FROM Transactions GROUP BY investor_id; |
which state is springfield in?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT state_name FROM city WHERE city_name = 'springfield'; |
how many cities does the usa have?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT COUNT(city_name) AS num_cities FROM city WHERE country_name = 'united states'; |
Find the employee id for all employees who earn more than the average salary.?
Schema:
- employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) | SELECT EMPLOYEE_ID FROM employees WHERE SALARY > (SELECT AVG(SALARY) FROM employees); |
What are the names of banks in the state of New York?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state) | SELECT bname FROM bank WHERE state = 'New York'; |
List the first name middle name and last name of all staff.?
Schema:
- Staff(COUNT, Name, Other_Details, date_joined_staff, date_left_staff, date_of_birth, email_address, first_name, gender, last_name, middle_name, nickname) | SELECT first_name, middle_name, last_name FROM Staff; |
List the names of all distinct medications, ordered in an alphabetical order.?
Schema:
- Medication(Name) | SELECT DISTINCT Name FROM Medication ORDER BY Name ASC NULLS LAST; |
what is the capital of states that have cities named durham?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT T2.capital FROM state AS T2 JOIN city AS T1 ON T2.state_name = T1.state_name WHERE T1.city_name = 'durham'; |
Find the ids of all the order items whose product id is 11.?
Schema:
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) | SELECT order_item_id FROM Order_Items WHERE product_id = 11; |
How many states that have some college students playing in the mid position but not in the goalie position.?
Schema:
- College(M, cName, enr, state)
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT COUNT(*) AS num_states FROM (SELECT DISTINCT T1.state FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'mid' AND T1.state NOT IN (SELECT T1.state FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'goalie')); |
What are the names and ids of every course with less than 2 sections?
Schema:
- Courses(course_description, course_name)
- Sections(section_description, section_name) | SELECT T1.course_name, T1.course_id FROM Courses AS T1 JOIN Sections AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id, T1.course_name HAVING COUNT(*) < 2; |
What are the id of all the files in mp3 format?
Schema:
- files(COUNT, duration, f_id, formats) | SELECT f_id FROM files WHERE formats = 'mp3'; |
find the name of driver who is driving the school bus with the longest working history.?
Schema:
- driver(Age, Home_city, Name, Party)
- school_bus(Years_Working) | SELECT T1.Name FROM driver AS T1 JOIN school_bus AS T2 ON T1.Driver_ID = T2.Driver_ID ORDER BY Years_Working DESC NULLS LAST LIMIT 1; |
Find the first name and age of students who have a dog but do not have a cat as a pet.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Pet(...)
- Pets(PetID, PetType, pet_age, weight) | SELECT T1.Fname, T1.Age FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID JOIN Pets AS T3 ON T3.PetID = T2.PetID WHERE T3.PetType = 'dog' AND T1.StuID NOT IN (SELECT T1.StuID FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID JOIN Pets AS T3 ON T3.PetID = T2.PetID WHERE T3.PetType = 'cat'); |
How many rooms cost more than 120, for each different decor?
Schema:
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT decor, COUNT(*) AS num_rooms FROM Rooms WHERE basePrice > 120 GROUP BY decor; |
return me the number of papers in VLDB conference containing keyword " Information Retrieval " .?
Schema:
- publication_keyword(...)
- keyword(keyword)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- conference(homepage, name) | SELECT COUNT(DISTINCT T4.title) AS num_papers FROM publication_keyword AS T3 JOIN keyword AS T1 ON T3.kid = T1.kid JOIN publication AS T4 ON T4.pid = T3.pid JOIN conference AS T2 ON T4.cid = CAST(T2.cid AS TEXT) WHERE T2.name = 'VLDB' AND T1.keyword = 'Information Retrieval'; |
Find the total ranking points for each player and their first name.?
Schema:
- players(COUNT, birth_date, country_code, first_name, hand, last_name)
- rankings(ranking_date, tours) | SELECT T1.first_name, SUM(T2.ranking_points) AS total_ranking_points FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id, T1.first_name; |
Find the club which has the largest number of members majoring in "600".?
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.Major = '600' GROUP BY T1.ClubName ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find all types of store and number of them.?
Schema:
- store(Type) | SELECT Type, COUNT(*) AS num_stores FROM store GROUP BY Type; |
Please give me a list of cities whose regional population is over 10000000.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT City FROM city WHERE Regional_Population > 10000000; |
What is the average age for all students who do not own any pets ?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Pet(...) | SELECT AVG(Age) AS avg_age FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_Pet); |
List all the Seafood restaurant in " Los Angeles "?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT T1.name FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN category AS T3 ON T3.business_id = T1.business_id WHERE T1.city = 'Los Angeles' AND T2.category_name = 'Seafood' AND T3.category_name = 'restaurant'; |
What year was " Benedict Cumberbatch " born ?
Schema:
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT birth_year FROM actor WHERE name = 'Benedict Cumberbatch'; |
Give the maximum price and score for wines produced in the appelation St. Helena.?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT MAX(Price) AS max_price, MAX(Score) AS max_score FROM wine WHERE Appelation = 'St. Helena'; |
Show different locations of railways along with the corresponding number of railways at each location.?
Schema:
- railway(Builder, COUNT, Location) | SELECT Location, COUNT(*) AS num_railways FROM railway GROUP BY Location; |
List all the reviews by Michelle for Italian restaurant?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state)
- review(i_id, rank, rating, text)
- user_(name) | SELECT T4."text" FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN category AS T3 ON T3.business_id = T1.business_id JOIN review AS T4 ON T4.business_id = T1.business_id JOIN user_ AS T5 ON T5.user_id = T4.user_id WHERE T2.category_name = 'Italian' AND T3.category_name = 'category_category_name1' AND T5.name = 'Michelle'; |
Show the names and ids of tourist attractions that are visited at least two times.?
Schema:
- Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more))
- Visits(Visit_Date) | SELECT T1.Name, T2.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN Visits AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID, T1.Name HAVING COUNT(*) >= 2; |
What are the different names of all songs without back vocals?
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 = 'back'); |
What is the type with the fewest games?
Schema:
- Video_Games(COUNT, Dest, GName, GType, onl) | SELECT GType FROM Video_Games WHERE GType IS NOT NULL GROUP BY GType ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
Find the states where both owners and professionals live.?
Schema:
- Owners(email_address, first_name, last_name, state)
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street) | SELECT DISTINCT T1.state FROM Owners AS T1 JOIN Professionals AS T2 ON T1.state = T2.state; |
How many people have membership in the 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_people 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'; |
What is the weight of the shortest person?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT Weight FROM people ORDER BY Height ASC NULLS LAST LIMIT 1; |
noah a smith citation count?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...)
- writes(...)
- author(...) | SELECT DISTINCT COUNT(T4.citedPaperId) AS num_citations FROM paper AS T3 JOIN cite AS T4 ON T3.paperId = T4.citedPaperId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'noah a smith'; |
Find the total number of students and total number of instructors for each department.?
Schema:
- department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name)
- student(COUNT, H, dept_name, name, tot_cred)
- instructor(AVG, M, So, Stat, dept_name, name, salary) | SELECT COUNT(DISTINCT T2.ID) AS num_students, COUNT(DISTINCT T3.ID) AS num_instructors, T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name; |
Find the last name of the author with first name "Amal".?
Schema:
- Authors(fname, lname) | SELECT lname FROM Authors WHERE fname = 'Amal'; |
Find the number of users called Michelle?
Schema:
- user_(name) | SELECT COUNT(DISTINCT name) AS num_users FROM user_ WHERE name = 'Michelle'; |
Find the id of the appointment with the most recent start date?
Schema:
- Appointment(AppointmentID, Start) | SELECT AppointmentID FROM Appointment ORDER BY "Start" DESC NULLS LAST LIMIT 1; |
display the average salary of employees for each department who gets a commission percentage.?
Schema:
- employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) | SELECT DEPARTMENT_ID, AVG(SALARY) AS avg_salary FROM employees WHERE COMMISSION_PCT IS NOT NULL GROUP BY DEPARTMENT_ID; |
Count the number of characteristics of the 'flax' product.?
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 = 'flax'; |
How many courses that do not have prerequisite?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- prereq(...) | SELECT COUNT(*) AS num_courses FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq); |
What are the different countries with singers above age 20?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT DISTINCT Country FROM singer WHERE Age > 20; |
what are the rivers of illinois?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE traverse = 'illinois'; |
what states have a capital that is the highest point in the state?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT T1.state_name FROM state AS T1 JOIN highlow AS T2 ON T1.capital = T2.highest_point; |
For each party, return the name of the party and the number of delegates from that 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 T2.Party, COUNT(*) AS num_delegates FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party, T2.Party; |
Select all the data from the products and each product's manufacturer.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT * FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code; |
return me the paper after 2000 in PVLDB with the most citations .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name) | SELECT T2.title FROM publication AS T2 JOIN journal AS T1 ON T2.jid = T1.jid WHERE T1.name = 'PVLDB' AND T2."year" > 2000 ORDER BY T2.citation_num DESC NULLS LAST LIMIT 1; |
Find the name and college of students whose decisions are yes in the tryout.?
Schema:
- Player(HS, pName, weight, yCard)
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT T1.pName, T2.cName FROM Player AS T1 JOIN Tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'; |
How many people are older than every engineer?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT COUNT(*) AS num_people FROM Person WHERE age > (SELECT MAX(age) FROM Person WHERE job = 'engineer'); |
What are the ids of all students who played video games and sports?
Schema:
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
- Plays_Games(GameID, Hours_Played, StuID) | SELECT DISTINCT T1.StuID FROM SportsInfo AS T1 JOIN Plays_Games AS T2 ON T1.StuID = T2.StuID; |
How many students have had at least one "B" grade?
Schema:
- Enrolled_in(Fname, Grade, LName, StuID, T2, T3, gradepoint) | SELECT COUNT(DISTINCT StuID) AS num_students FROM Enrolled_in WHERE Grade = 'B'; |
Which country has both stadiums with capacity greater than 60000 and stadiums with capacity less than 50000?
Schema:
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1) | SELECT DISTINCT T1.Country FROM stadium AS T1 JOIN stadium AS T2 ON T1.Country = T2.Country WHERE T1.Capacity > 60000 AND T2.Capacity < 50000; |
Count the number of different hometowns of these people.?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT COUNT(DISTINCT Hometown) AS num_hometowns FROM people; |
What is the highest salary among each team? List the team name, id and maximum salary.?
Schema:
- team(Name)
- salary(salary) | SELECT T1.name, T1.team_id, MAX(T2.salary) AS max_salary FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.name, T1.team_id; |
How many counties are there in total?
Schema:
- county(County_name, Population, Zip_code) | SELECT COUNT(*) AS num_counties FROM county; |
How many appointments are there?
Schema:
- Appointment(AppointmentID, Start) | SELECT COUNT(*) AS num_appointments FROM Appointment; |
Find the delegates who are from counties with population below 100000.?
Schema:
- county(County_name, Population, Zip_code)
- election(Committee, Date, Delegate, District, Vote_Percent, Votes) | SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District WHERE T1.Population < 100000; |
Show the pilot positions that have both pilots joining after year 2005 and pilots joining before 2000.?
Schema:
- pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team) | SELECT "Position" FROM pilot WHERE Join_Year > 2005 GROUP BY "Position" HAVING COUNT(*) = 2; |
What is the maker of the carr produced in the earliest year and what year was it?
Schema:
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
- car_names(COUNT, Model) | SELECT T2.Make, T1."Year" FROM cars_data AS T1 JOIN car_names AS T2 ON T1.Id = T2.MakeId WHERE T1."Year" = (SELECT MIN("Year") FROM cars_data); |
Find the name of scientists who are not assigned to any project.?
Schema:
- Scientists(Name)
- AssignedTo(Scientist) | SELECT Name FROM Scientists WHERE SSN NOT IN (SELECT Scientist FROM AssignedTo); |
Show headquarters with at least two companies in the banking industry.?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Headquarters FROM company WHERE Main_Industry = 'Banking' AND Headquarters IS NOT NULL GROUP BY Headquarters HAVING COUNT(*) >= 2; |
List the locations of schools in descending order of founded year.?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type) | SELECT Location FROM school ORDER BY Founded DESC NULLS LAST; |
For each payment method, how many payments were made?
Schema:
- Customer_Payments(payment_method_code) | SELECT payment_method_code, COUNT(*) AS num_payments FROM Customer_Payments GROUP BY payment_method_code; |
Find the saving balance of the account with the highest checking balance.?
Schema:
- ACCOUNTS(name)
- CHECKING(balance)
- SAVINGS(SAV, balance) | SELECT T3.balance 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 DESC NULLS LAST LIMIT 1; |
what is the name of every pilot who is at least 25 years old?
Schema:
- pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team) | SELECT Name FROM pilot WHERE Age >= 25; |
Find the top 3 artists who have the largest number of songs works whose language is Bangla.?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more)) | SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'bangla' GROUP BY T2.artist_name, T1.artist_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 3; |
What are the names and opening hours of the tourist attractions that can be accessed by bus or walk?
Schema:
- Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more)) | SELECT Name, Opening_Hours FROM Tourist_Attractions WHERE How_to_Get_There = 'bus' OR How_to_Get_There = 'walk'; |
Find the name of the instructors who taught C Programming course before.?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary)
- teaches(ID, Spr, semester)
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) | SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.title = 'C Programming'; |
What are the name and id of the team offering the lowest average salary?
Schema:
- team(Name)
- salary(salary) | SELECT T1.name, T1.team_id FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.name, T1.team_id ORDER BY AVG(T2.salary) ASC NULLS LAST LIMIT 1; |
return me the papers after 2000 .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT title FROM publication WHERE "year" > 2000; |
Find the number of records of each policy type and its type code.?
Schema:
- Policies(COUNT, Policy_Type_Code) | SELECT Policy_Type_Code, COUNT(*) AS num_policies FROM Policies GROUP BY Policy_Type_Code; |
What are the name and active date of the customers whose contact channel code is email?
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_Contact_Channels(DATEDIFF, DAY, active_from_date, active_to_date, channel_code, contact_number, diff) | SELECT T1.customer_name, T2.active_from_date FROM Customers AS T1 JOIN Customer_Contact_Channels AS T2 ON T1.customer_id = T2.customer_id WHERE T2.channel_code = 'Email'; |
Find the tourist attractions that have parking or shopping as their feature details. What are the names of the attractions?
Schema:
- Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more))
- Tourist_Attraction_Features(...)
- Features(...) | SELECT DISTINCT Name FROM (SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Tourist_Attraction_Features AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID JOIN Features AS T3 ON T2.Feature_ID = T3.Feature_ID WHERE T3.Feature_Details = 'park' UNION ALL SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Tourist_Attraction_Features AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID JOIN Features AS T3 ON T2.Feature_ID = T3.Feature_ID WHERE T3.Feature_Details = 'shopping'); |
What is the average snatch score of body builders?
Schema:
- body_builder(Clean_Jerk, Snatch, Total) | SELECT AVG(Snatch) AS avg_snatch_score FROM body_builder; |
give me a good restaurant in the yosemite and mono lake area for french food ?
Schema:
- restaurant(...)
- geographic(...)
- location(...) | SELECT T3.house_number, T1.name FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name JOIN location AS T3 ON T1.id = T3.restaurant_id WHERE T2.region = 'yosemite and mono lake area' AND T1.food_type = 'french' AND T1.rating > 2.5; |
How many drivers are from Hartford city or younger than 40?
Schema:
- driver(Age, Home_city, Name, Party) | SELECT COUNT(*) AS num_drivers FROM driver WHERE Home_city = 'Hartford' OR Age < 40; |
What is the document name and template id for document with description with the letter 'w' in it?
Schema:
- Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more)) | SELECT Document_Name, Template_ID FROM Documents WHERE Document_Description ILIKE '%w%'; |
What are the login names and family names of course author and tutors?
Schema:
- Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name) | SELECT login_name, family_name FROM Course_Authors_and_Tutors; |
Find the name of the ships that have more than one captain.?
Schema:
- Ship(Built_Year, COUNT, Class, Flag, Name, Type)
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT T1.Name FROM Ship AS T1 JOIN captain AS T2 ON T1.Ship_ID = T2.Ship_ID GROUP BY T2.Ship_ID, T1.Name HAVING COUNT(*) > 1; |
What are the names of the artists who sang the shortest song?
Schema:
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
- files(COUNT, duration, f_id, formats) | SELECT T1.artist_name FROM song AS T1 JOIN files AS T2 ON T1.f_id = T2.f_id ORDER BY T2.duration ASC NULLS LAST LIMIT 1; |
What city is the headquarter of the store Blackville?
Schema:
- store(Type)
- store_district(...)
- district(City_Area, City_Population, District_name, d) | SELECT T3.Headquartered_City FROM store AS T1 JOIN store_district AS T2 ON T1.Store_ID = T2.Store_ID JOIN district AS T3 ON T2.District_ID = T3.District_ID WHERE T1.Store_Name = 'Blackville'; |
What are the send dates for all documents that have a grant amount of more than 5000 and are involved in research?
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))
- Grants(grant_amount, organisation_id)
- Organisations(...)
- Organisation_Types(...) | SELECT T1.sent_date FROM Documents AS T1 JOIN Grants AS T2 ON T1.grant_id = T2.grant_id JOIN Organisations AS T3 ON T2.organisation_id = T3.organisation_id JOIN Organisation_Types AS T4 ON T3.organisation_type = T4.organisation_type WHERE T2.grant_amount > 5000 AND T4.organisation_type_description = 'Research'; |
Which employee manage most number of peoples? List employee's first and last name, and number of people report to that employee.?
Schema:
- employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) | SELECT T2.first_name, T2.last_name, COUNT(T1.reports_to) AS num_reports FROM employees AS T1 JOIN employees AS T2 ON T1.reports_to = T2.id GROUP BY T1.reports_to, T2.first_name, T2.last_name ORDER BY num_reports DESC NULLS LAST LIMIT 1; |
What instruments does the the song "Le Pop" use?
Schema:
- Instruments(COUNT, Instrument)
- Songs(Title) | SELECT Instrument FROM Instruments AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Title = 'Le Pop'; |
Take the average of the school enrollment.?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type) | SELECT AVG(Enrollment) AS avg_enrollment FROM school; |
What is the description of the restaurant type Sandwich?
Schema:
- Restaurant_Type(ResTypeDescription, ResTypeID, ResTypeName) | SELECT ResTypeDescription FROM Restaurant_Type WHERE ResTypeName = 'Sandwich'; |
Find all the songs performed by artist with last name "Heilo"?
Schema:
- Performance(...)
- Band(...)
- Songs(Title) | SELECT T3.Title FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T2.Lastname = 'Heilo'; |
Find the total number of instructors who teach a course in the Spring 2010 semester.?
Schema:
- teaches(ID, Spr, semester) | SELECT COUNT(DISTINCT ID) AS num_instructors FROM teaches WHERE semester = 'Spring' AND "year" = 2010; |
What is the total population of Gelderland district?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT SUM(Population) AS total_population FROM city WHERE District = 'Gelderland'; |
what rivers run through the state with the lowest point in the usa?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT river_name FROM river WHERE traverse IN (SELECT state_name FROM highlow WHERE lowest_elevation = (SELECT MIN(lowest_elevation) FROM highlow)); |
What are the names of all of Bob's friends?
Schema:
- Person(M, age, city, eng, gender, job, name)
- PersonFriend(M, friend, name) | SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Bob'; |
how many people live in boulder?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT population FROM city WHERE city_name = 'boulder'; |
what is the total population of 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 SUM(T2.population) AS total_population FROM state AS T2 JOIN border_info AS T1 ON T2.state_name = T1.border WHERE T1.state_name = 'texas'; |
What are the names of students who took a course in the Fall of 2003?
Schema:
- student(COUNT, H, dept_name, name, tot_cred)
- takes(COUNT, semester, year) | SELECT name FROM student WHERE ID IN (SELECT ID FROM takes WHERE semester = 'Fall' AND "year" = 2003); |
What are the average ages for male and female students?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT AVG(Age) AS avg_age, Sex FROM Student GROUP BY Sex; |
Find the grade taught in classroom 103.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName) | SELECT DISTINCT Grade FROM list WHERE Classroom = 103; |
What is the maximum page size for everything that has more than 3 products listed?
Schema:
- product(COUNT, pages_per_minute_color, product) | SELECT max_page_size FROM product WHERE max_page_size IS NOT NULL GROUP BY max_page_size HAVING COUNT(*) > 3; |
What are the names, locations, and years of opening for tracks with seating higher than average?
Schema:
- track(Location, Name, Seat, Seating, T1, Year_Opened) | SELECT Name, Location, Year_Opened FROM track WHERE Seating > (SELECT AVG(Seating) FROM track); |
What is the least common media type in all tracks?
Schema:
- MediaType(...)
- Track(Milliseconds, Name, UnitPrice) | SELECT T1.Name FROM MediaType AS T1 JOIN Track AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId, T1.Name ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
return me all the papers in PVLDB after 2000 in " University of Michigan " .?
Schema:
- organization(continent, homepage, name)
- author(...)
- writes(...)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name) | SELECT T5.title FROM organization AS T2 JOIN author AS T1 ON T2.oid = T1.oid JOIN writes AS T4 ON T4.aid = T1.aid JOIN publication AS T5 ON T4.pid = T5.pid JOIN journal AS T3 ON T5.jid = T3.jid WHERE T3.name = 'PVLDB' AND T2.name = 'University of Michigan' AND T5."year" > 2000; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.