question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
which state has the ohio river?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT traverse FROM river WHERE river_name = 'ohio'; |
Find the GDP of the city with the largest regional population.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT GDP FROM city ORDER BY Regional_Population DESC NULLS LAST LIMIT 1; |
Eric C. Kerrigan 's Liquid Automatica paper?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- writes(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- author(...)
- venue(venueId, venueName) | SELECT DISTINCT T2.paperId FROM paperKeyphrase AS T5 JOIN keyphrase AS T3 ON T5.keyphraseId = T3.keyphraseId JOIN writes AS T4 ON T4.paperId = T5.paperId JOIN paper AS T2 ON T4.paperId = T2.paperId JOIN author AS T1 ON T4.authorId = T1.authorId JOIN venue AS T6 ON T6.venueId = T2.venueId WHERE T1.authorName = 'Eric C. Kerrigan' AND T3.keyphraseName = 'Liquid' AND T6.venueName = 'Automatica'; |
How many female Professors do we have?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT COUNT(*) AS num_female_professors FROM Faculty WHERE Sex = 'F' AND "Rank" = 'Professor'; |
What are the distinct first names of the students who have vice president votes and reside in a city whose city code is not PIT?
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.Vice_President_Vote WHERE T1.Fname NOT IN (SELECT DISTINCT Fname FROM Student WHERE city_code = 'PIT'); |
For each user, find their name and the number of reviews written by them.?
Schema:
- useracct(...)
- review(i_id, rank, rating, text) | SELECT T1.name, COUNT(*) AS num_reviews FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id, T1.name; |
What is the most common major among female (sex is F) students?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Major FROM Student WHERE Sex = 'F' AND Major IS NOT NULL GROUP BY Major ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the total revenue of companies with revenue greater than the lowest revenue of any manufacturer in Austin?
Schema:
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT SUM(Revenue) AS total_revenue FROM Manufacturers WHERE Revenue > (SELECT MIN(Revenue) FROM Manufacturers WHERE Headquarter = 'Austin'); |
Find the name of department has the highest amount of students?
Schema:
- student(COUNT, H, dept_name, name, tot_cred) | SELECT dept_name FROM student WHERE dept_name IS NOT NULL GROUP BY dept_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the name of the wrestler with the fewest days held?
Schema:
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT Name FROM wrestler ORDER BY Days_held ASC NULLS LAST LIMIT 1; |
What are the names and sum of checking and savings balances for accounts with savings balances higher than the average savings balance?
Schema:
- ACCOUNTS(name)
- CHECKING(balance)
- SAVINGS(SAV, balance) | SELECT T1.name, T2.balance + T3.balance AS total_balance FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid WHERE T3.balance > (SELECT AVG(balance) FROM SAVINGS); |
Tell me the highest, lowest, and average cost of procedures.?
Schema:
- Procedures(Cost, Name) | SELECT MAX(Cost) AS max_cost, MIN(Cost) AS min_cost, AVG(Cost) AS avg_cost FROM Procedures; |
Find courses that ran in Fall 2009 or in Spring 2010.?
Schema:
- section(COUNT, JO, Spr, T1, course_id, semester, year) | SELECT course_id FROM section WHERE (semester = 'Fall' AND "year" = 2009) OR (semester = 'Spring' AND "year" = 2010); |
What are all the instruments used by the musician with the last name "Heilo"?
Schema:
- Instruments(COUNT, Instrument)
- Band(...) | SELECT Instrument FROM Instruments AS T1 JOIN Band AS T2 ON T1.BandmateId = T2.Id WHERE T2.Lastname = 'Heilo'; |
Give the years and official names of the cities of each competition.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- farm_competition(Hosts, Theme, Year) | SELECT T2."Year", T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID; |
What are the names and location of the shops in ascending alphabetical order of name.?
Schema:
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT Shop_Name, Location FROM shop ORDER BY Shop_Name ASC NULLS LAST; |
What are the dates for the documents with both 'GV' type and 'SF' type expenses?
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))
- Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID) | SELECT T1.Document_Date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.Document_ID = T2.Document_ID WHERE T2.Budget_Type_Code = 'GV' AND T1.Document_Date IN (SELECT T1.Document_Date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.Document_ID = T2.Document_ID WHERE T2.Budget_Type_Code = 'SF'); |
What are the different allergy types?
Schema:
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT DISTINCT AllergyType FROM Allergy_Type; |
What are the names of students who have 2 or more likes?
Schema:
- Likes(student_id)
- Highschooler(COUNT, ID, grade, name) | SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID GROUP BY T1.student_id, T2.name HAVING COUNT(*) >= 2; |
How many campuses are there in Los Angeles county?
Schema:
- Campuses(Campus, County, Franc, Location) | SELECT COUNT(*) AS num_campuses FROM Campuses WHERE County = 'Los Angeles'; |
Find the average age of losers and winners of all 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 AVG(loser_age) AS avg_loser_age, AVG(winner_age) AS avg_winner_age FROM matches_; |
What are the first name and last name of the players who have weight above 220 or height below 75?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT name_first, name_last FROM player WHERE weight > 220 OR height < 75; |
What is the last name of the contact individual from the Labour party organization who was contacted most recently?
Schema:
- Organizations(date_formed, organization_name)
- Organization_Contact_Individuals(...)
- Individuals(...) | SELECT T3.individual_last_name FROM Organizations AS T1 JOIN Organization_Contact_Individuals AS T2 ON T1.organization_id = T2.organization_id JOIN Individuals AS T3 ON T2.individual_id = T3.individual_id WHERE T1.organization_name = 'Labour Party' ORDER BY T2.date_contact_to DESC NULLS LAST LIMIT 1; |
what is the longest river in texas?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river WHERE traverse = 'texas') AND traverse = 'texas'; |
How many bands are there?
Schema:
- Band(...) | SELECT COUNT(*) AS num_bands FROM Band; |
what has Liwen Xiong done in the past year?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'Liwen Xiong' AND T3."year" = 2015; |
what is the address of history department?
Schema:
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT DEPT_ADDRESS FROM DEPARTMENT WHERE DEPT_NAME = 'History'; |
what is the population density in the state with capital austin?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT density FROM state WHERE capital = 'austin'; |
How many games are free of injury accidents?
Schema:
- game(Date, Home_team, Season)
- injury_accident(Source) | SELECT COUNT(*) AS num_games FROM game WHERE id NOT IN (SELECT game_id FROM injury_accident); |
What are the airline names and abbreviations for airlines in the USA?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name) | SELECT Airline, Abbreviation FROM airlines WHERE Country = 'USA'; |
Find the female friends of Alice.?
Schema:
- Person(M, age, city, eng, gender, job, name)
- PersonFriend(M, friend, name) | SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'female'; |
Return all information about employees with salaries between 8000 and 12000 for which commission is not null or where their department id is not 40.?
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 * FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT IS NOT NULL OR DEPARTMENT_ID != 40; |
How many events have each participants attended? List the participant id, type and the number.?
Schema:
- Participants(Participant_Details, Participant_ID, Participant_Type_Code)
- Participants_in_Events(COUNT, Event_ID, Participant_ID) | SELECT T1.Participant_ID, T1.Participant_Type_Code, COUNT(*) AS num_events FROM Participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID GROUP BY T1.Participant_ID, T1.Participant_Type_Code; |
What is the highest elevation of an airport in the country of Iceland?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT MAX(elevation) AS max_elevation FROM airports WHERE country = 'Iceland'; |
Find the name of rooms whose base price is between 120 and 150.?
Schema:
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT roomName FROM Rooms WHERE basePrice BETWEEN 120 AND 150; |
Show the types of ships that have both ships with tonnage larger than 6000 and ships with tonnage smaller than 4000.?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT DISTINCT T1.Type FROM (SELECT DISTINCT Type FROM ship WHERE Tonnage > 6000) AS T1 JOIN (SELECT DISTINCT Type FROM ship WHERE Tonnage < 4000) AS T2 ON T1.Type = T2.Type; |
Show names of companies and that of employees in descending order of number of years working for that employee.?
Schema:
- employment(...)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT T3.Name, T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID ORDER BY T1.Year_working ASC NULLS LAST; |
Show the theme for exhibitions with both records of an attendance below 100 and above 500.?
Schema:
- exhibition_record(...)
- exhibition(Theme, Ticket_Price, Year) | SELECT DISTINCT T2.Theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.Exhibition_ID = T2.Exhibition_ID JOIN exhibition_record AS T3 ON T1.Exhibition_ID = T3.Exhibition_ID WHERE T1.Attendance < 100 AND T3.Attendance > 500; |
What is the name and city of the airport from most of the routes start?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
- routes(...) | SELECT T1.name, T1.city, T2.src_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid GROUP BY T1.name, T1.city, T2.src_apid ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the number of cities in each district whose population is greater than the average population of cities?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT COUNT(*) AS num_cities, District FROM city WHERE Population > (SELECT AVG(Population) FROM city) GROUP BY District; |
return me the homepage of PVLDB .?
Schema:
- journal(Theme, homepage, name) | SELECT homepage FROM journal WHERE name = 'PVLDB'; |
What are the names of the stadiums without any concerts?
Schema:
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
- concert(COUNT, Year) | SELECT Name FROM stadium WHERE Stadium_ID NOT IN (SELECT Stadium_ID FROM concert); |
What are the phone numbers of all customers and all staff members?
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))
- 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 DISTINCT phone_number FROM (SELECT phone_number FROM Customers UNION ALL SELECT phone_number FROM Staff); |
What datasets have jitendra malik used?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- paperDataset(...)
- writes(...)
- author(...) | SELECT DISTINCT T2.datasetId FROM paper AS T3 JOIN paperDataset AS T2 ON T3.paperId = T2.paperId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T1.authorName = 'jitendra malik'; |
Who is the founders of companies whose first letter is S?
Schema:
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT Founder FROM Manufacturers WHERE Name ILIKE 'S%'; |
List the name and count of each product in all orders.?
Schema:
- Orders(customer_id, date_order_placed, order_id)
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT T3.product_name, COUNT(*) AS num_orders FROM Orders AS T1 JOIN Order_Items AS T2 ON T1.order_id = T2.order_id JOIN Products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id, T3.product_name; |
Find the highest rank of all reviews.?
Schema:
- review(i_id, rank, rating, text) | SELECT MIN("rank") AS min_rank FROM review; |
return me all the papers 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) | SELECT T4.title FROM organization AS T2 JOIN author AS T1 ON T2.oid = T1.oid JOIN writes AS T3 ON T3.aid = T1.aid JOIN publication AS T4 ON T3.pid = T4.pid WHERE T2.name = 'University of Michigan' AND T4."year" > 2000; |
give me the best restaurant in bay area for american 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 = 'bay area' AND T1.food_type = 'american' AND T1.rating = (SELECT MAX(T1.rating) FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name WHERE T2.region = 'bay area' AND T1.food_type = 'american'); |
How many parks are there in the state of NY?
Schema:
- park(city, state) | SELECT COUNT(*) AS num_parks FROM park WHERE state = 'NY'; |
What is the average and largest salary of all employees?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) | SELECT AVG(salary) AS avg_salary, MAX(salary) AS max_salary FROM employee; |
what state has the largest area?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state); |
What is the id and trade name of the medicines can interact with at least 3 enzymes?
Schema:
- medicine(FDA_approved, Trade_Name, name)
- medicine_enzyme_interaction(interaction_type) | SELECT T1.id, T1.Trade_Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id, T1.Trade_Name HAVING COUNT(*) >= 3; |
What is the total number of hours per work and number of games played by David Shieber?
Schema:
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT SUM(HoursPerWeek) AS total_hours_per_week, SUM(GamesPlayed) AS total_games_played FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Fname = 'David' AND T2.LName = 'Shieber'; |
Show all the distinct president votes made on 08/30/2015.?
Schema:
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT President_Vote FROM Voting_record WHERE Registration_Date = '08/30/2015'; |
Show the id and star rating of each hotel, ordered by its price from low to high.?
Schema:
- Hotels(hotel_id, other_hotel_details, pets_allowed_yn, price_range, star_rating_code) | SELECT hotel_id, star_rating_code FROM Hotels ORDER BY price_range ASC NULLS LAST; |
What are the denominations used by both 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); |
Which industries have both companies with headquarter in "USA" and companies with headquarter in "China"?
Schema:
- Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name) | SELECT DISTINCT T1.Industry FROM Companies AS T1 JOIN Companies AS T2 ON T1.Industry = T2.Industry WHERE T1.Headquarters = 'USA' AND T2.Headquarters = 'China'; |
What is the latitude, longitude, and city of the station from which the trip with smallest duration started?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
- trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code) | SELECT T1.lat, T1.long, T1.city FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id ORDER BY T2.duration ASC NULLS LAST LIMIT 1; |
What are the nicknames of schools whose division is not 1?
Schema:
- school_details(Div, Division, Nickname) | SELECT Nickname FROM school_details WHERE Division != 'Division 1'; |
Find the number of people whose age is greater than all engineers.?
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 names and birth dates of people, ordered by their names in alphabetical order?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT Name, Birth_Date FROM people ORDER BY Name ASC NULLS LAST; |
How many countries exist?
Schema:
- countries(...) | SELECT COUNT(*) AS num_countries FROM countries; |
Return the id of the customer who has the most cards, as well as the number of cards.?
Schema:
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to) | SELECT customer_id, COUNT(*) AS num_cards FROM Customers_Cards WHERE customer_id IS NOT NULL GROUP BY customer_id ORDER BY num_cards DESC NULLS LAST LIMIT 1; |
Show the details of the top 3 most expensive hotels.?
Schema:
- Hotels(hotel_id, other_hotel_details, pets_allowed_yn, price_range, star_rating_code) | SELECT other_hotel_details FROM Hotels ORDER BY price_range DESC NULLS LAST LIMIT 3; |
show the name of all bridges that was designed by american archtect, and sort the result by the bridge feet length.?
Schema:
- bridge(Ra, length_feet, location, name)
- architect(gender, id, name, nationality) | SELECT T1.name FROM bridge AS T1 JOIN architect AS T2 ON CAST(T1.architect_id AS TEXT) = T2.id WHERE T2.nationality = 'American' ORDER BY T1.length_feet ASC NULLS LAST; |
Give the color of the grape whose wine products have the highest average price?
Schema:
- grapes(...)
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT T1.Color FROM grapes AS T1 JOIN wine AS T2 ON T1.Grape = T2.Grape GROUP BY T2.Grape, T1.Color ORDER BY AVG(Price) DESC NULLS LAST LIMIT 1; |
What are the types of vocals that the musician with the last name "Heilo" played in "Der Kapitan"?
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.Lastname = 'Heilo' AND T2.Title = 'Der Kapitan'; |
How many departments are in each school?
Schema:
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT COUNT(DISTINCT DEPT_NAME) AS num_departments, SCHOOL_CODE FROM DEPARTMENT GROUP BY SCHOOL_CODE; |
What are the id and name of the museum visited most times?
Schema:
- museum(Name, Open_Year)
- visit(...) | SELECT T2.Museum_ID, T1.Name FROM museum AS T1 JOIN visit AS T2 ON T1.Museum_ID = T2.Museum_ID GROUP BY T2.Museum_ID, T1.Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the name of the person who has friends with age above 40 and under age 30?
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 IN (SELECT name FROM Person WHERE age > 40) AND T1.name IN (SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30)); |
papers that used 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 the ids of the students who don't participate in any activity.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Participates_in(...) | SELECT StuID FROM Student WHERE StuID NOT IN (SELECT StuID FROM Participates_in); |
What are the destinations and number of flights to each one?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT destination, COUNT(*) AS num_flights FROM flight GROUP BY destination; |
What are the hosts of competitions whose theme is not "Aliens"?
Schema:
- farm_competition(Hosts, Theme, Year) | SELECT Hosts FROM farm_competition WHERE Theme != 'Aliens'; |
Count the number of universities that do not participate in the baketball 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_universities FROM university WHERE School_ID NOT IN (SELECT School_ID FROM basketball_match); |
what papers have fewer than 5 citations by ACL papers ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...)
- venue(venueId, venueName) | SELECT DISTINCT T3.citingPaperId FROM paper AS T1 JOIN cite AS T3 ON T1.paperId = T3.citedPaperId JOIN venue AS T2 ON T2.venueId = T1.venueId WHERE T2.venueName = 'ACL' GROUP BY T3.citingPaperId HAVING COUNT(DISTINCT T3.citedPaperId) < 5; |
What are the names of all the players who received a yes during tryouts, and also what are the names of their colleges?
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'; |
Find the name of the candidates whose oppose percentage is the lowest for each sex.?
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, T1.Sex, MIN(Oppose_rate) AS min_oppose_rate FROM people AS T1 JOIN candidate AS T2 ON T1.People_ID = T2.People_ID GROUP BY T1.Name, T1.Sex; |
What are the names of cities, as well as the names of the counties they correspond to?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- county_public_safety(COUNT, Case_burden, Crime_rate, Location, Name, Police_force, Police_officers, Population, T1) | SELECT T1.Name, T2.Name FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID; |
return me the number of authors who have papers in PVLDB .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name)
- writes(...)
- author(...) | SELECT COUNT(DISTINCT T1.name) AS num_authors FROM publication AS T4 JOIN journal AS T2 ON T4.jid = T2.jid JOIN writes AS T3 ON T3.pid = T4.pid JOIN author AS T1 ON T3.aid = T1.aid WHERE T2.name = 'PVLDB'; |
Count the number of candidates.?
Schema:
- candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_rate) | SELECT COUNT(*) AS num_candidates FROM candidate; |
where is 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; |
Please show the different statuses of cities and the average population of cities with each status.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT Status, AVG(Population) AS avg_population FROM city GROUP BY Status; |
How many times has the student Linda Smith visited Subway?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Visits_Restaurant(ResID, StuID)
- Restaurant(Address, Rating, ResID, ResName) | SELECT COUNT(*) AS num_visits FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = 'Linda' AND Student.LName = 'Smith' AND Restaurant.ResName = 'Subway'; |
Show the description of the transaction type that occurs most frequently.?
Schema:
- Ref_Transaction_Types(transaction_type_code, transaction_type_description)
- Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code) | SELECT T1.transaction_type_description FROM Ref_Transaction_Types AS T1 JOIN Transactions AS T2 ON T1.transaction_type_code = T2.transaction_type_code GROUP BY T1.transaction_type_code, T1.transaction_type_description ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
what are the name of players who get more than the average points.?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT name FROM player WHERE Points > (SELECT AVG(Points) FROM player); |
How many distinct types of accounts are there?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) | SELECT COUNT(DISTINCT acc_type) AS num_types FROM customer; |
What are the names of all clubs that do not have any players?
Schema:
- club(Region, Start_year, name)
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT name FROM club WHERE Club_ID NOT IN (SELECT Club_ID FROM player); |
Who is the youngest male?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT name FROM Person WHERE gender = 'male' AND age = (SELECT MIN(age) FROM Person WHERE gender = 'male'); |
What are the songs in album "A Kiss Before You Go: Live in Hamburg"?
Schema:
- Albums(COUNT, Label, Title)
- Tracklists(...)
- Songs(Title) | SELECT T3.Title FROM Albums AS T1 JOIN Tracklists AS T2 ON T1.AId = T2.AlbumId JOIN Songs AS T3 ON T2.SongId = T3.SongId WHERE T1.Title = 'A Kiss Before You Go: Live in Hamburg'; |
How many departments are led by heads who are not mentioned?
Schema:
- department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name)
- management(temporary_acting) | SELECT COUNT(*) AS num_departments FROM department WHERE department_ID NOT IN (SELECT department_ID FROM management); |
What are the average amount purchased and value purchased for the supplier who supplies the most products.?
Schema:
- Product_Suppliers(COUNT, DOUBLE, TRY_CAST, product_id, supplier_id) | SELECT AVG(TRY_CAST(total_amount_purchased AS DOUBLE)) AS avg_amount_purchased, AVG(total_value_purchased) AS avg_value_purchased FROM Product_Suppliers WHERE supplier_id = (SELECT supplier_id FROM Product_Suppliers WHERE supplier_id IS NOT NULL GROUP BY supplier_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1); |
What are the minimum and maximum vote percents of elections?
Schema:
- election(Committee, Date, Delegate, District, Vote_Percent, Votes) | SELECT MIN(Vote_Percent) AS min_vote_percent, MAX(Vote_Percent) AS max_vote_percent FROM election; |
what states border states that the mississippi runs through?
Schema:
- border_info(T1, border, state_name)
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT border FROM border_info WHERE state_name IN (SELECT traverse FROM river WHERE river_name = 'mississippi'); |
Find the last names of professors who are not playing Canoeing or Kayaking.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
- Faculty_Participates_in(FacID)
- Activity(activity_name) | SELECT Lname FROM Faculty WHERE "Rank" = 'Professor' AND Lname NOT IN (SELECT DISTINCT T1.Lname FROM Faculty AS T1 JOIN Faculty_Participates_in AS T2 ON T1.FacID = T2.FacID JOIN Activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'); |
What is total number of show times per dat for each cinema?
Schema:
- schedule(...)
- cinema(COUNT, Capacity, Location, Name, Openning_year, T1, c) | SELECT T2.Name, SUM(T1.Show_times_per_day) AS total_show_times_per_day FROM schedule AS T1 JOIN cinema AS T2 ON T1.Cinema_ID = T2.Cinema_ID GROUP BY T1.Cinema_ID, T2.Name; |
For each director, what is the title and score of their most poorly rated movie?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year) | SELECT T2.title, T1.stars, T2.director, MIN(T1.stars) AS min_stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T2.director, T2.title, T1.stars; |
How many cartoons were written by "Joseph Kuhr"?
Schema:
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by) | SELECT COUNT(*) AS num_cartoons FROM Cartoon WHERE Written_by = 'Joseph Kuhr'; |
Which institution is the author "Matthias Blume" belong to? Give me the name of the institution.?
Schema:
- Authors(fname, lname)
- Authorship(...)
- Inst(...) | SELECT DISTINCT T3.name FROM Authors AS T1 JOIN Authorship AS T2 ON T1.authID = T2.authID JOIN Inst AS T3 ON T2.instID = T3.instID WHERE T1.fname = 'Matthias' AND T1.lname = 'Blume'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.