question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
Find the booking start date and end date for the apartments that have more than two bedrooms.?
Schema:
- Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code)
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count) | SELECT T1.booking_start_date, T1.booking_end_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2; |
Find products with max page size as "A4" or pages per minute color smaller than 5.?
Schema:
- product(COUNT, pages_per_minute_color, product) | SELECT product FROM product WHERE max_page_size = 'A4' OR pages_per_minute_color < 5; |
How many sports do we have?
Schema:
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID) | SELECT COUNT(DISTINCT SportName) AS num_sports FROM SportsInfo; |
What are the result description of the project whose detail is 'sint'?
Schema:
- Research_Outcomes(...)
- Project_Outcomes(outcome_code)
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT T1.outcome_description FROM Research_Outcomes AS T1 JOIN Project_Outcomes AS T2 ON T1.outcome_code = T2.outcome_code JOIN Projects AS T3 ON T2.project_id = T3.project_id WHERE T3.project_details = 'sint'; |
how many schools exist in total?
Schema:
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT COUNT(DISTINCT SCHOOL_CODE) AS num_schools FROM DEPARTMENT; |
Find the names of users who have more than one tweet.?
Schema:
- user_profiles(email, followers, name, partitionid)
- tweets(I, tweet_text, uid) | SELECT T1.name FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid, T1.name HAVING COUNT(*) > 1; |
Find the average elevation of all airports for each country.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT AVG(elevation) AS avg_elevation, country FROM airports GROUP BY country; |
Where is store 1 located?
Schema:
- store(Type)
- address(address, district, phone, postal_code) | SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE store_id = 1; |
Find the origins from which more than 1 train starts.?
Schema:
- train(Name, Service, Time, destination, name, origin, time, train_number) | SELECT origin FROM train WHERE origin IS NOT NULL GROUP BY origin HAVING COUNT(*) > 1; |
Show the tourist attractions visited by the tourist whose detail is 'Vincent'.?
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)
- Visitors(Tourist_Details) | SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Visits AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID JOIN Visitors AS T3 ON T2.Tourist_ID = T3.Tourist_ID WHERE T3.Tourist_Details = 'Vincent'; |
how many papers use ImageNet ?
Schema:
- paperDataset(...)
- dataset(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(DISTINCT T3.paperId) AS num_papers 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 LIKE 'ImageNet'; |
What is the average and minimum age of all artists from United States.?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT AVG(Age) AS avg_age, MIN(Age) AS min_age FROM artist WHERE Country = 'United States'; |
How many phones are there?
Schema:
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) | SELECT COUNT(*) AS num_phones FROM phone; |
Please list support, consider, and oppose rates for each candidate in ascending order by unsure rate.?
Schema:
- candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_rate) | SELECT Support_rate, Consider_rate, Oppose_rate FROM candidate ORDER BY Unsure_rate ASC NULLS LAST; |
How many animal type allergies exist?
Schema:
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT COUNT(*) AS num_allergies FROM Allergy_Type WHERE AllergyType = 'animal'; |
how many states have cities or towns named springfield?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT COUNT(state_name) AS num_states FROM city WHERE city_name = 'springfield'; |
What is the last date that a staff member left a project?
Schema:
- Project_Staff(COUNT, date_from, date_to, role_code) | SELECT date_to FROM Project_Staff ORDER BY date_to DESC NULLS LAST LIMIT 1; |
parsing top papers?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...) | SELECT DISTINCT T4.citedPaperId, COUNT(T4.citedPaperId) AS num_cites FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN cite AS T4 ON T3.paperId = T4.citedPaperId WHERE T1.keyphraseName = 'parsing' GROUP BY T4.citedPaperId ORDER BY num_cites DESC NULLS LAST; |
What are the ids of all employees that don't have certificates?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
- certificate(eid) | SELECT eid FROM employee WHERE eid NOT IN (SELECT eid FROM certificate); |
What are the names and ids of the tourist attractions that are visited at most once?
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, T1.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, T1.Tourist_Attraction_ID HAVING COUNT(*) <= 1; |
Show the distinct themes of journals.?
Schema:
- journal(Theme, homepage, name) | SELECT DISTINCT Theme FROM journal; |
Find the first names of all instructors who have taught some course and the course code.?
Schema:
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) | SELECT T2.EMP_FNAME, T1.CRS_CODE FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM; |
Find the name of branches where have some members whose hometown is in Louisville, Kentucky and some in Hiram, Georgia.?
Schema:
- membership_register_branch(...)
- branch(Address_road, City, Name, Open_year, membership_amount)
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) | SELECT T2.Name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.Branch_ID = T2.Branch_ID JOIN member_ AS T3 ON T1.Member_ID = T3.Member_ID WHERE T3.Hometown IN ('Louisville, Kentucky', 'Hiram, Georgia') GROUP BY T2.Name HAVING COUNT(DISTINCT T3.Hometown) = 2; |
Find the name of the first 5 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 customer_name FROM Customers ORDER BY date_became_customer ASC NULLS LAST LIMIT 5; |
List all the event names by year from the most recent to the oldest.?
Schema:
- event(Date, Event_Attendance, Name, Venue, Year) | SELECT Name FROM event ORDER BY "Year" DESC NULLS LAST; |
What are the titles, years, and directors of all movies, ordered by budget in millions?
Schema:
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) | SELECT Title, "Year", Director FROM movie ORDER BY Budget_million ASC NULLS LAST; |
Find the total student enrollment for different affiliation type schools.?
Schema:
- university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School) | SELECT SUM(Enrollment) AS total_enrollment, Affiliation FROM university GROUP BY Affiliation; |
What are the roles with three or more employees? Give me the role codes.?
Schema:
- Employees(COUNT, Date_of_Birth, Employee_ID, Employee_Name, Role_Code, employee_id, employee_name, role_code) | SELECT Role_Code FROM Employees WHERE Role_Code IS NOT NULL GROUP BY Role_Code HAVING COUNT(*) >= 3; |
What are the names of candidates who have a lower support rate than oppose rate?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_rate) | SELECT T1.Name FROM people AS T1 JOIN candidate AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Support_rate < T2.Oppose_rate; |
who published the most papers in CVPR 2007?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT COUNT(T2.paperId) AS num_papers, T1.authorId FROM venue AS T3 JOIN paper AS T2 ON T3.venueId = T2.venueId JOIN writes AS T1 ON T1.paperId = T2.paperId WHERE T2."year" = 2007 AND T3.venueName = 'CVPR' GROUP BY T1.authorId ORDER BY num_papers DESC NULLS LAST; |
How many papers in ACL 2015 ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(DISTINCT T1.paperId) AS num_papers FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T1."year" = 2015 AND T2.venueName = 'ACL'; |
Find the settlement amount of the claim with the largest claim amount. Show both the settlement amount and claim amount.?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled) | SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC NULLS LAST LIMIT 1; |
who does Noah A Smith work with ?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT T1.authorId 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 = 'Noah A Smith'; |
Count the number of financial transactions that the account with the name 337 has.?
Schema:
- Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type)
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT COUNT(*) AS num_transactions FROM Financial_Transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = '337'; |
Show all template type codes with less than three templates.?
Schema:
- Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number) | SELECT Template_Type_Code FROM Templates WHERE Template_Type_Code IS NOT NULL GROUP BY Template_Type_Code HAVING COUNT(*) < 3; |
What are the drivers' last names and id who had 11 pit stops and participated in more than 5 race results?
Schema:
- drivers(forename, nationality, surname)
- pitStops(driverId, raceId, stop)
- results(...) | SELECT DISTINCT T1.surname, T1.driverId FROM (SELECT T1.surname, T1.driverId FROM drivers AS T1 JOIN pitStops AS T2 ON T1.driverId = T2.driverId GROUP BY T1.surname, T1.driverId HAVING COUNT(*) = 11) AS T1 JOIN (SELECT T1.surname, T1.driverId FROM drivers AS T1 JOIN results AS T2 ON T1.driverId = T2.driverId GROUP BY T1.surname, T1.driverId HAVING COUNT(*) > 5) AS T3 ON T1.driverId = T3.driverId; |
What is the version number and template type code for the template with version number later than 5?
Schema:
- Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number) | SELECT Version_Number, Template_Type_Code FROM Templates WHERE Version_Number > 5; |
What are the distinct first names of the students who have class president votes?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT T1.Fname FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.Class_Senator_Vote; |
Show the ids of all employees who have authorized destruction.?
Schema:
- Documents_to_be_Destroyed(Destroyed_by_Employee_ID, Destruction_Authorised_by_Employee_ID) | SELECT DISTINCT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_Destroyed; |
Show the name, location, open year for all tracks with a seating higher than the average.?
Schema:
- track(Location, Name, Seat, Seating, T1, Year_Opened) | SELECT Name, Location, Year_Opened FROM track WHERE Seating > (SELECT AVG(Seating) FROM track); |
How many entrepreneurs correspond to each investor?
Schema:
- entrepreneur(COUNT, Company, Investor, Money_Requested) | SELECT Investor, COUNT(*) AS num_entrepreneurs FROM entrepreneur GROUP BY Investor; |
Show the name and population of the country that has the highest roller coaster.?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- roller_coaster(DOUBLE, Height, LENGTH, Park, Speed, Status, TRY_CAST) | SELECT T1.Name, T1.Population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID ORDER BY T2.Height DESC NULLS LAST LIMIT 1; |
Find the first name of students not enrolled in any course.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Enrolled_in(Fname, Grade, LName, StuID, T2, T3, gradepoint) | SELECT Fname FROM Student WHERE StuID NOT IN (SELECT StuID FROM Enrolled_in); |
How many albums are there?
Schema:
- Album(Title) | SELECT COUNT(*) AS num_albums FROM Album; |
What is the first and last name of the students who are not in the largest major?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Fname, LName FROM Student WHERE Major != (SELECT Major FROM Student WHERE Major IS NOT NULL GROUP BY Major ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1); |
Count the number of films whose title contains the word 'Dummy'.?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) | SELECT COUNT(*) AS num_films FROM film WHERE Title LIKE '%Dummy%'; |
What is the maximum and mininum number of stars a rating can receive?
Schema:
- Rating(Rat, mID, rID, stars) | SELECT MAX(stars) AS max_stars, MIN(stars) AS min_stars FROM Rating; |
Find the distinct last names of the students who have class president votes.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT T1.LName FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.Class_President_Vote; |
Show the names of high schoolers who have likes, and numbers of likes for each.?
Schema:
- Likes(student_id)
- Highschooler(COUNT, ID, grade, name) | SELECT T2.name, COUNT(*) AS num_likes FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID GROUP BY T1.student_id, T2.name; |
What are the amenities in alphabetical order that Anonymous Donor Hall has?
Schema:
- Dorm_amenity(amenity_name)
- Has_amenity(dormid)
- Dorm(dorm_name, gender, student_capacity) | SELECT T1.amenity_name FROM Dorm_amenity AS T1 JOIN Has_amenity AS T2 ON T2.amenid = T1.amenid JOIN Dorm AS T3 ON T2.dormid = T3.dormid WHERE T3.dorm_name = 'Anonymous Donor Hall' ORDER BY T1.amenity_name ASC NULLS LAST; |
What are the names of all people, ordered by their date of birth?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT Name FROM people ORDER BY Date_of_Birth ASC NULLS LAST; |
For each player, what are their name, season, and country that they belong to?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team) | SELECT T2.Season, T2.Player, T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country; |
who wrote the most papers for CVPR 2007?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT COUNT(T2.paperId) AS num_papers, T1.authorId FROM venue AS T3 JOIN paper AS T2 ON T3.venueId = T2.venueId JOIN writes AS T1 ON T1.paperId = T2.paperId WHERE T2."year" = 2007 AND T3.venueName = 'CVPR' GROUP BY T1.authorId ORDER BY num_papers DESC NULLS LAST; |
Count the total number of clubs.?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn) | SELECT COUNT(*) AS num_clubs FROM Club; |
Find the business which has the most number of categories?
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 GROUP BY T1.name ORDER BY COUNT(DISTINCT T2.category_name) DESC NULLS LAST LIMIT 1; |
Show the fleet series of the aircrafts flied by pilots younger than 34?
Schema:
- pilot_record(...)
- aircraft(Description, aid, d, distance, name)
- pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team) | SELECT T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID WHERE T3.Age < 34; |
What is the first name of the staff who did not give any lesson?
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)
- Lessons(lesson_status_code) | SELECT first_name FROM Staff WHERE first_name NOT IN (SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id); |
What is the first and second line for all addresses?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT line_1, line_2 FROM Addresses; |
Which rank has the smallest number of faculty members?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT "Rank" FROM Faculty GROUP BY "Rank" ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
what paper has Richard Ladner published in chi ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T3.paperId FROM venue AS T4 JOIN paper AS T3 ON T4.venueId = T3.venueId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'Richard Ladner' AND T4.venueName = 'chi'; |
How many different cities do people originate from?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT COUNT(DISTINCT city) AS num_cities FROM Person; |
What are the ids and names of the companies that operated more than one flight?
Schema:
- operate_company(Group_Equity_Shareholding, Type)
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT T1.id, T1.name FROM operate_company AS T1 JOIN flight AS T2 ON T1.id = T2.company_id GROUP BY T1.id, T1.name HAVING COUNT(*) > 1; |
How many schools do not participate in the basketball match?
Schema:
- university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School)
- basketball_match(ACC_Percent, All_Home, School_ID, Team_Name) | SELECT COUNT(*) AS num_schools FROM university WHERE School_ID NOT IN (SELECT School_ID FROM basketball_match); |
Tell me the number of orders with "Second time" as order detail.?
Schema:
- Customer_Orders(customer_id, order_date, order_id, order_shipping_charges) | SELECT COUNT(*) AS num_orders FROM Customer_Orders WHERE order_details = 'Second time'; |
What papers were 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'; |
How many different colleges are there?
Schema:
- College(M, cName, enr, state) | SELECT COUNT(*) AS num_colleges FROM College; |
Find the names and average salaries of all departments whose average salary is greater than 42000.?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary) | SELECT dept_name, AVG(salary) AS avg_salary FROM instructor WHERE dept_name IS NOT NULL GROUP BY dept_name HAVING AVG(salary) > 42000; |
How many students are in each department?
Schema:
- student(COUNT, H, dept_name, name, tot_cred) | SELECT COUNT(*) AS num_students, dept_name FROM student GROUP BY dept_name; |
Find the names of the students who are in the position of striker and got a yes tryout decision.?
Schema:
- Player(HS, pName, weight, yCard)
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT T1.pName FROM Player AS T1 JOIN Tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes' AND T2.pPos = 'striker'; |
How many credit cards does customer Blanche Huels have?
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 COUNT(*) AS num_cards FROM Customers_Cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Blanche' AND T2.customer_last_name = 'Huels' AND T1.card_type_code = 'Credit'; |
what states border states that border states that border florida?
Schema:
- border_info(T1, border, state_name) | SELECT border FROM border_info WHERE state_name IN (SELECT border FROM border_info WHERE state_name IN (SELECT border FROM border_info WHERE state_name = 'florida')); |
Show the rank, first name, and last name for all the faculty.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT "Rank", Fname, Lname FROM Faculty; |
Find the average credit score of the customers who do not have any loan.?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id)
- loan(...) | SELECT AVG(credit_score) AS avg_credit_score FROM customer WHERE cust_ID NOT IN (SELECT cust_ID FROM loan); |
Report all majors that have less than 3 students.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Major FROM Student WHERE Major IS NOT NULL GROUP BY Major HAVING COUNT(*) < 3; |
list the names of the companies with more than 200 sales in the descending order of sales and profits.?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Name FROM company WHERE Sales_in_Billion > 200 ORDER BY Sales_in_Billion, Profits_in_Billion DESC NULLS LAST; |
How many students got accepted after the tryout?
Schema:
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT COUNT(*) AS num_students FROM Tryout WHERE decision = 'yes'; |
Find the names of the regions which were affected by the storm that killed the greatest number of people.?
Schema:
- affected_region(Region_id)
- region(Label, Region_code, Region_name)
- storm(Damage_millions_USD, Dates_active, Name, Number_Deaths) | SELECT T2.Region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.Region_id = T2.Region_id JOIN storm AS T3 ON T1.Storm_ID = T3.Storm_ID ORDER BY T3.Number_Deaths DESC NULLS LAST LIMIT 1; |
Find the name and membership level of the visitors whose membership level is higher than 4, and sort by their age from old to young.?
Schema:
- visitor(Age, Level_of_membership, Name) | SELECT Name, Level_of_membership FROM visitor WHERE Level_of_membership > 4 ORDER BY Age DESC NULLS LAST; |
How many apartments do not have any facility?
Schema:
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
- Apartment_Facilities(...) | SELECT COUNT(*) AS num_apartments FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities); |
What is the names of movies whose created year is after all movies directed by Steven Spielberg?
Schema:
- Movie(T1, director, title, year) | SELECT title FROM Movie WHERE "year" > (SELECT MAX("year") FROM Movie WHERE director = 'Steven Spielberg'); |
Show all the planned delivery dates and actual delivery dates of bookings.?
Schema:
- Bookings(Actual_Delivery_Date, COUNT, Order_Date, Planned_Delivery_Date, Status_Code) | SELECT Planned_Delivery_Date, Actual_Delivery_Date FROM Bookings; |
List the name of musicals that do not have actors.?
Schema:
- musical(Award, COUNT, Name, Nom, Nominee, Result, T1)
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT Name FROM musical WHERE Musical_ID NOT IN (SELECT Musical_ID FROM actor); |
What are the names of all male British artists?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT artist_name FROM artist WHERE country = 'UK' AND gender = 'Male'; |
Which song has the most vocals?
Schema:
- Vocals(COUNT, Type)
- Songs(Title) | SELECT Title FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId GROUP BY T1.SongId, Title ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Which marketing region has the most drama workshop groups? Give me the region code.?
Schema:
- Drama_Workshop_Groups(COUNT, Currency_Code, Marketing_Region_Code, Store_Name) | SELECT Marketing_Region_Code FROM Drama_Workshop_Groups WHERE Marketing_Region_Code IS NOT NULL GROUP BY Marketing_Region_Code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the total number of Domestic Passengers of airports that contain the word "London".?
Schema:
- airport(Airport_Name, City, Country, Domestic_Passengers, International_Passengers, Transit_Passengers, id, name) | SELECT SUM(Domestic_Passengers) AS total_domestic_passengers FROM airport WHERE Airport_Name LIKE '%London%'; |
Give the maximum and minimum weeks on top across all volumes.?
Schema:
- volume(Artist_ID, Issue_Date, Song, Weeks_on_Top) | SELECT MAX(Weeks_on_Top) AS max_weeks_on_top, MIN(Weeks_on_Top) AS min_weeks_on_top FROM volume; |
Which city does student Linda Smith live in?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT city_code FROM Student WHERE Fname = 'Linda' AND LName = 'Smith'; |
find the full name of employees who report to Nancy Edwards?
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 FROM employees AS T1 JOIN employees AS T2 ON T1.id = T2.reports_to WHERE T1.first_name = 'Nancy' AND T1.last_name = 'Edwards'; |
Which schools do not have any player? Give me the school locations.?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type)
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT Location FROM school WHERE School_ID NOT IN (SELECT School_ID FROM player); |
Show the names of countries that have more than one roller coaster.?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- roller_coaster(DOUBLE, Height, LENGTH, Park, Speed, Status, TRY_CAST) | SELECT T1.Name, AVG(TRY_CAST(T2.Speed AS DOUBLE)) AS avg_speed FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID GROUP BY T1.Name; |
what is the population of the largest state?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT population FROM state WHERE area = (SELECT MAX(area) FROM state); |
what city has the most people?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT city_name FROM city WHERE population = (SELECT MAX(population) FROM city); |
Which students are advised by Michael Goodrich? Give me their first and last names.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT T2.Fname, T2.Lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor WHERE T1.Fname = 'Michael' AND T1.Lname = 'Goodrich'; |
Show the manager name with most number of gas stations opened after 2000.?
Schema:
- gas_station(COUNT, Location, Manager_Name, Open_Year, Station_ID) | SELECT Manager_Name FROM gas_station WHERE Open_Year > 2000 AND Manager_Name IS NOT NULL GROUP BY Manager_Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the number of distinct continents where Chinese is spoken?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- countrylanguage(COUNT, CountryCode, Engl, Language) | SELECT COUNT(DISTINCT Continent) AS num_continents FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" = 'Chinese'; |
Show all customer ids and the number of accounts for each customer.?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT customer_id, COUNT(*) AS num_accounts FROM Accounts GROUP BY customer_id; |
Give me a list of descriptions of the problems that are reported by the staff whose first name is Christop.?
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'; |
Find the total number of matches.?
Schema:
- matches_(COUNT, T1, loser_age, loser_name, minutes, tourney_name, winner_age, winner_hand, winner_name, winner_rank, winner_rank_points, year) | SELECT COUNT(*) AS num_matches FROM matches_; |
How many papers are about deep learning ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(DISTINCT 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 = 'deep learning'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.