question
stringlengths 43
589
| query
stringlengths 19
598
|
|---|---|
Find the claim id and claim date of the claim that incurred the most settlement count. Also tell me the count.?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled)
- Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount)
|
SELECT T1.Claim_ID, T1.Date_Claim_Made, COUNT(*) AS num_settlements FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID GROUP BY T1.Claim_ID, T1.Date_Claim_Made ORDER BY num_settlements DESC NULLS LAST LIMIT 1;
|
What are the names of the services that have never been used?
Schema:
- Services(Service_Type_Code, Service_name)
- Party_Services(...)
|
SELECT DISTINCT service_name FROM Services WHERE service_name NOT IN (SELECT T1.service_name FROM Services AS T1 JOIN Party_Services AS T2 ON T1.service_id = T2.service_id);
|
What are the ids of the students who registered for course 301?
Schema:
- Student_Course_Attendance(course_id, date_of_attendance, student_id)
|
SELECT student_id FROM Student_Course_Attendance WHERE course_id = 301;
|
Sort the company names in descending order of the company's market value.?
Schema:
- Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name)
|
SELECT name FROM Companies ORDER BY Market_Value_billion DESC NULLS LAST;
|
Find the number of vocal types used in song "Le Pop"?
Schema:
- Vocals(COUNT, Type)
- Songs(Title)
|
SELECT COUNT(*) AS num_vocal_types FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Title = 'Le Pop';
|
Show the crime rates of counties in ascending order of number of police officers.?
Schema:
- county_public_safety(COUNT, Case_burden, Crime_rate, Location, Name, Police_force, Police_officers, Population, T1)
|
SELECT Crime_rate FROM county_public_safety ORDER BY Police_officers ASC NULLS LAST;
|
Return the unique name for stations that have ever had 7 bikes available.?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
- status(...)
|
SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available = 7;
|
Show the ids and names of festivals that have at least two nominations for artworks.?
Schema:
- nomination(...)
- artwork(COUNT, Name, Type)
- festival_detail(Chair_Name, Festival_Name, Location, T1, Year)
|
SELECT T1.Festival_ID, T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID GROUP BY T1.Festival_ID, T3.Festival_Name HAVING COUNT(*) >= 2;
|
Return the first names and last names of employees who earn more than 30000 in salary.?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
|
SELECT Fname, Lname FROM employee WHERE Salary > 30000;
|
What is the first and last name of the employee who reports 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';
|
Show order ids and the total quantity in each order.?
Schema:
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
|
SELECT order_id, SUM(TRY_CAST(product_quantity AS INT)) AS total_quantity FROM Order_Items GROUP BY order_id;
|
What is the total number of people who has no friend living in the city of Austin.?
Schema:
- PersonFriend(M, friend, name)
- Person(M, age, city, eng, gender, job, name)
|
SELECT COUNT(DISTINCT name) AS num_people FROM PersonFriend WHERE friend NOT IN (SELECT name FROM Person WHERE city = 'Austin');
|
How many regions do we have?
Schema:
- region(Label, Region_code, Region_name)
|
SELECT COUNT(*) AS num_regions FROM region;
|
which state is the city springfield located 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';
|
What are the names and ids of the different categories, and how many films are in each?
Schema:
- film_category(...)
- category(...)
|
SELECT T2.name, T1.category_id, COUNT(*) AS num_films FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T2.name, T1.category_id;
|
Show the delegates and the names of the party they belong to.?
Schema:
- election(Committee, Date, Delegate, District, Vote_Percent, Votes)
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
|
SELECT T1.Delegate, T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID;
|
What is the id of the project with least number of documents?
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 Project_ID FROM Documents WHERE Project_ID IS NOT NULL GROUP BY Project_ID ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
|
what keyphrase does Brian DeRenzi write about that gets most citations ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...)
|
SELECT DISTINCT T1.keyphraseName, SUM(T3.numCitedBy) AS num_citations FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T5 ON T4.authorId = T5.authorId WHERE T5.authorName = 'Brian DeRenzi' GROUP BY T1.keyphraseName ORDER BY num_citations DESC NULLS LAST;
|
what is the area of all the states combined?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
|
SELECT SUM(area) AS total_area FROM state;
|
What are the total purchases for members rated at level 6?
Schema:
- purchase(...)
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
|
SELECT COUNT(*) AS num_purchases FROM purchase AS T1 JOIN member_ AS T2 ON T1.Member_ID = T2.Member_ID WHERE T2.Level = 6;
|
Show different hometown of teachers and the number of teachers from each hometown.?
Schema:
- teacher(Age, COUNT, D, Hometown, Name)
|
SELECT Hometown, COUNT(*) AS num_teachers FROM teacher GROUP BY Hometown;
|
2014 papers?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
|
SELECT DISTINCT paperId FROM paper WHERE "year" = 2014;
|
What is the produdction code and channel of the most recent cartoon ?
Schema:
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by)
|
SELECT Production_code, Channel FROM Cartoon ORDER BY Original_air_date DESC NULLS LAST LIMIT 1;
|
What is the best place in san francisco for french 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 = 'san francisco' AND T1.food_type = 'french' AND T1.rating = (SELECT MAX(T1.rating) FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'san francisco' AND T1.food_type = 'french');
|
hot topics at NIPS 2015?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- venue(venueId, venueName)
|
SELECT DISTINCT COUNT(T3.paperId) AS num_papers, T1.keyphraseId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T3."year" = 2015 AND T4.venueName = 'NIPS' GROUP BY T1.keyphraseId ORDER BY num_papers DESC NULLS LAST;
|
Find the names of the items that did not receive any review.?
Schema:
- item(title)
- review(i_id, rank, rating, text)
|
SELECT title FROM item WHERE i_id NOT IN (SELECT i_id FROM review);
|
What papers have Peter Mertens and Dina Barbian written ?
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';
|
Show the official names of the cities that have hosted more than one 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 T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID, T1.Official_Name HAVING COUNT(*) > 1;
|
What is the id of the reviewer named Daniel Lewis?
Schema:
- Reviewer(Lew, name, rID)
|
SELECT rID FROM Reviewer WHERE name = 'Daniel Lewis';
|
what is the population of the largest state that borders 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 population FROM state WHERE area = (SELECT MAX(area) FROM state WHERE state_name IN (SELECT border FROM border_info WHERE state_name = 'texas')) AND state_name IN (SELECT border FROM border_info WHERE state_name = 'texas');
|
Find names of colleges with enrollment greater than that of some (at least one) college in the FL state.?
Schema:
- College(M, cName, enr, state)
|
SELECT DISTINCT cName FROM College WHERE enr > (SELECT MIN(enr) FROM College WHERE state = 'FL');
|
How many papers has David M. Blei published in AISTATS ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...)
|
SELECT DISTINCT COUNT(T3.paperId) AS num_papers 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 = 'David M. Blei' AND T4.venueName = 'AISTATS';
|
Find the average prices of all products from each manufacture, and list each company's name.?
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 AVG(T1.Price) AS avg_price, T2.Name FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name;
|
what datasets did jitendra malik use in his papers ?
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';
|
What is the most common status across all cities?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
|
SELECT Status FROM city WHERE Status IS NOT NULL GROUP BY Status ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
|
How many Bangladeshi artists are listed?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
|
SELECT COUNT(*) AS num_artists FROM artist WHERE country = 'Bangladesh';
|
Please show the categories of the music festivals and the count.?
Schema:
- music_festival(COUNT, Category, Date_of_ceremony, Result)
|
SELECT Category, COUNT(*) AS num_festivals FROM music_festival GROUP BY Category;
|
What is the average time span in days of contact channels in the database?
Schema:
- Customer_Contact_Channels(DATEDIFF, DAY, active_from_date, active_to_date, channel_code, contact_number, diff)
|
SELECT AVG(DATEDIFF(DAY, active_from_date, active_to_date)) AS diff FROM Customer_Contact_Channels;
|
What are the instruments are used in the song "Le Pop"?
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';
|
In which locations are there more than one movie theater with capacity above 300?
Schema:
- cinema(COUNT, Capacity, Location, Name, Openning_year, T1, c)
|
SELECT Location FROM cinema WHERE Capacity > 300 AND Location IS NOT NULL GROUP BY Location HAVING COUNT(*) > 1;
|
How many distinct FDA approval statuses are there for the medicines?
Schema:
- medicine(FDA_approved, Trade_Name, name)
|
SELECT COUNT(DISTINCT FDA_approved) AS num_statuses FROM medicine;
|
What are the 3 counties that have the smallest population? Give me the county names.?
Schema:
- county(County_name, Population, Zip_code)
|
SELECT County_name FROM county ORDER BY Population ASC NULLS LAST LIMIT 3;
|
What are the names of players who won in both 2013 and 2016?
Schema:
- matches_(COUNT, T1, loser_age, loser_name, minutes, tourney_name, winner_age, winner_hand, winner_name, winner_rank, winner_rank_points, year)
|
SELECT DISTINCT T1.winner_name FROM matches_ AS T1 JOIN matches_ AS T2 ON T1.winner_name = T2.winner_name WHERE T1."year" = 2013 AND T2."year" = 2016;
|
what states neighbor kentucky?
Schema:
- border_info(T1, border, state_name)
|
SELECT border FROM border_info WHERE state_name = 'kentucky';
|
return me all the researchers in " University of Michigan " .?
Schema:
- organization(continent, homepage, name)
- author(...)
|
SELECT T1.name FROM organization AS T2 JOIN author AS T1 ON T2.oid = T1.oid WHERE T2.name = 'University of Michigan';
|
Which school has the fewest professors?
Schema:
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE)
|
SELECT T1.SCHOOL_CODE FROM DEPARTMENT AS T1 JOIN PROFESSOR AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.SCHOOL_CODE ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
|
What is the number of cartoones 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';
|
Find all movies featuring " Jason Robards " and " Woody Strode "?
Schema:
- cast_(...)
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
|
SELECT T4.title FROM cast_ AS T5 JOIN actor AS T1 ON T5.aid = T1.aid JOIN movie AS T4 ON T4.mid = T5.msid JOIN cast_ AS T3 ON T4.mid = T3.msid JOIN actor AS T2 ON T3.aid = T2.aid WHERE T1.name = 'Woody Strode' AND T2.name = 'Jason Robards';
|
who published Parsing papers at acl 2012?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- venue(venueId, venueName)
|
SELECT DISTINCT T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.keyphraseName = 'Parsing' AND T3."year" = 2012 AND T4.venueName = 'acl';
|
What is the first name, country code, and birth date of the player with the most winner rank points across all matches?
Schema:
- players(COUNT, birth_date, country_code, first_name, hand, last_name)
- matches_(COUNT, T1, loser_age, loser_name, minutes, tourney_name, winner_age, winner_hand, winner_name, winner_rank, winner_rank_points, year)
|
SELECT T1.first_name, T1.country_code, T1.birth_date FROM players AS T1 JOIN matches_ AS T2 ON T1.player_id = T2.winner_id ORDER BY T2.winner_rank_points DESC NULLS LAST LIMIT 1;
|
What are the names of all cities and states?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
|
SELECT DISTINCT town_city FROM (SELECT town_city FROM Addresses UNION ALL SELECT state_province_county FROM Addresses);
|
Count the number of distinct delegates who are from counties with population above 50000.?
Schema:
- county(County_name, Population, Zip_code)
- election(Committee, Date, Delegate, District, Vote_Percent, Votes)
|
SELECT COUNT(DISTINCT T2.Delegate) AS num_delegates FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District WHERE T1.Population > 50000;
|
what is the population density of the state with the smallest population?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
|
SELECT density FROM state WHERE population = (SELECT MIN(population) FROM state);
|
Show all transaction types.?
Schema:
- Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type)
|
SELECT DISTINCT transaction_type FROM Financial_Transactions;
|
What are the member names and hometowns of those who registered at a branch in 2016?
Schema:
- membership_register_branch(...)
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
|
SELECT T2.Name, T2.Hometown FROM membership_register_branch AS T1 JOIN member_ AS T2 ON T1.Member_ID = T2.Member_ID WHERE T1.Register_Year = 2016;
|
Find the branch name of the bank that has the most number of customers.?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state)
|
SELECT bname FROM bank ORDER BY no_of_customers DESC NULLS LAST LIMIT 1;
|
Show the average, maximum, minimum enrollment of all schools.?
Schema:
- School(County, Enrollment, Location, Mascot, School_name)
|
SELECT AVG(Enrollment) AS avg_enrollment, MAX(Enrollment) AS max_enrollment, MIN(Enrollment) AS min_enrollment FROM School;
|
How many customers live in Prague city?
Schema:
- customers(Mart, city, company, country, email, first_name, last_name, phone, state)
|
SELECT COUNT(*) AS num_customers FROM customers WHERE city = 'Prague';
|
What is the starting year of the oldest technicians?
Schema:
- technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name)
|
SELECT Starting_Year FROM technician ORDER BY Age DESC NULLS LAST LIMIT 1;
|
Show the number of all customers without an account.?
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))
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
|
SELECT COUNT(*) AS num_customers FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts);
|
For each fourth-grade classroom, show the classroom number and the total number of students using it.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
|
SELECT Classroom, COUNT(*) AS num_students FROM list WHERE Grade = '4' GROUP BY Classroom;
|
For each faculty rank, show the number of faculty members who have it.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
|
SELECT "Rank", COUNT(*) AS num_faculty FROM Faculty GROUP BY "Rank";
|
How many counties are there?
Schema:
- county_public_safety(COUNT, Case_burden, Crime_rate, Location, Name, Police_force, Police_officers, Population, T1)
|
SELECT COUNT(*) AS num_counties FROM county_public_safety;
|
What are the names of all friends who are from New York?
Schema:
- Person(M, age, city, eng, gender, job, name)
- PersonFriend(M, friend, name)
|
SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.city = 'new york city';
|
How many papers has Noah Smith co-authored since 2009 ?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
|
SELECT DISTINCT COUNT(DISTINCT T2.paperId) AS num_papers 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 != 'Noah Smith' AND T3."year" > 2009 AND T2.paperId IN (SELECT T2.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName LIKE 'Noah Smith');
|
Show the ids of high schoolers who have friends and are also liked by someone else.?
Schema:
- Friend(student_id)
- Likes(student_id)
|
SELECT DISTINCT T1.student_id FROM Friend AS T1 JOIN Likes AS T2 ON T1.student_id = T2.liked_id;
|
What are all different template ids used for documents, and how many times were each of them used?
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 Template_ID, COUNT(*) AS num_documents FROM Documents GROUP BY Template_ID;
|
what state has the smallest urban population?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
|
SELECT state_name FROM city WHERE state_name IS NOT NULL GROUP BY state_name ORDER BY SUM(population) ASC NULLS LAST LIMIT 1;
|
Return the first names of customers who did not rented a film after the date '2005-08-23 02:06:01'.?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id)
- rental(...)
|
SELECT first_name FROM customer WHERE customer_id NOT IN(SELECT customer_id FROM rental WHERE rental_date > '2005-08-23 02:06:01');
|
How many furniture components are there in total?
Schema:
- furniture(Furniture_ID, Market_Rate, Name)
|
SELECT SUM(Num_of_Component) AS num_furniture_components FROM furniture;
|
How many different kinds of clients are supported by the web clients accelerators?
Schema:
- Web_client_accelerator(Client, Operating_system)
|
SELECT COUNT(DISTINCT Client) AS num_clients FROM Web_client_accelerator;
|
What are the titles and directors of the films were never presented in China?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
- film_market_estimation(High_Estimate, Low_Estimate, Type)
- market(Country, Number_cities)
|
SELECT Title, Director FROM film WHERE Film_ID NOT IN (SELECT Film_ID FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID WHERE Country = 'China');
|
Who is the writer of " The Truman Show "?
Schema:
- written_by(...)
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
- writer(...)
|
SELECT T2.name FROM written_by AS T3 JOIN movie AS T1 ON T3.msid = T1.mid JOIN writer AS T2 ON T3.wid = T2.wid WHERE T1.title = 'The Truman Show';
|
What is the film title and inventory id of the item in the inventory which was rented most frequently?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
- inventory(COUNT, store_id)
- rental(...)
|
SELECT T1.title, T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2. film_id JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T1.title, T2.inventory_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
|
Question Answering papers?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
|
SELECT DISTINCT T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.keyphraseName = 'Question Answering';
|
What are the names of people who do not play poker?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- poker_player(Best_Finish, Earnings, Final_Table_Made, Money_Rank)
|
SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM poker_player);
|
What are the order details of the products with price higher than 2000?
Schema:
- 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 T1.Other_Item_Details FROM Order_Items AS T1 JOIN Products AS T2 ON CAST(T1.Product_ID AS TEXT) = T2.Product_ID WHERE T2.Product_Price > 2000;
|
What are the ids of all reviewers who have not given 4 stars at least once?
Schema:
- Rating(Rat, mID, rID, stars)
|
SELECT rID FROM Rating WHERE stars != 4;
|
How many aircrafts have distance between 1000 and 5000?
Schema:
- aircraft(Description, aid, d, distance, name)
|
SELECT COUNT(*) AS num_aircrafts FROM aircraft WHERE distance BETWEEN 1000 AND 5000;
|
what is the highest point in each state whose lowest point is sea level?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
|
SELECT highest_point, state_name FROM highlow WHERE lowest_elevation = 0;
|
what river traverses the most states?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
|
SELECT river_name FROM river GROUP BY (river_name) ORDER BY COUNT(DISTINCT traverse) DESC NULLS LAST LIMIT 1;
|
What are the names of poker players, ordered ascending by the number of final tables they have made?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- poker_player(Best_Finish, Earnings, Final_Table_Made, Money_Rank)
|
SELECT T1.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Final_Table_Made ASC NULLS LAST;
|
Find the description of the club "Pen and Paper Gaming".?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn)
|
SELECT ClubDesc FROM Club WHERE ClubName = 'Pen and Paper Gaming';
|
Return the full names and salaries of employees with null commissions.?
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 FIRST_NAME, LAST_NAME, SALARY FROM employees WHERE COMMISSION_PCT IS NULL;
|
What is title of album which track Balls to the Wall belongs to?
Schema:
- albums(I, title)
- tracks(composer, milliseconds, name, unit_price)
|
SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T2.name = 'Balls to the Wall';
|
Count the number of appelations in Napa County.?
Schema:
- appellations(Area, County)
|
SELECT COUNT(*) AS num_appellations FROM appellations WHERE County = 'Napa';
|
List the names of products that are not in any event.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Products_in_Events(...)
|
SELECT Product_Name FROM Products WHERE Product_ID NOT IN (SELECT Product_ID FROM Products_in_Events);
|
Return the names and template ids for documents that contain the letter w in their description.?
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 ids and total number of hours played for each game?
Schema:
- Plays_Games(GameID, Hours_Played, StuID)
|
SELECT GameID, SUM(Hours_Played) AS total_hours_played FROM Plays_Games GROUP BY GameID;
|
What campuses are in Los Angeles county?
Schema:
- Campuses(Campus, County, Franc, Location)
|
SELECT Campus FROM Campuses WHERE County = 'Los Angeles';
|
What is the id and last name of the driver with the longest laptime?
Schema:
- drivers(forename, nationality, surname)
- lapTimes(...)
|
SELECT T1.driverId, T1.surname FROM drivers AS T1 JOIN lapTimes AS T2 ON T1.driverId = T2.driverId ORDER BY T2.milliseconds DESC NULLS LAST LIMIT 1;
|
What is the largest and smallest customer codes?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
|
SELECT MAX(TRY_CAST(customer_code AS BIGINT)) AS max_customer_code, MIN(TRY_CAST(customer_code AS BIGINT)) AS min_customer_code FROM Customers;
|
Find the number of different product types.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
|
SELECT COUNT(DISTINCT product_type_code) AS num_product_types FROM Products;
|
what is the most populated state bordering oklahoma?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
- border_info(T1, border, state_name)
|
SELECT state_name FROM state WHERE state_name IN (SELECT border FROM border_info WHERE state_name = 'oklahoma') ORDER BY population DESC NULLS LAST LIMIT 1;
|
What are airport names at City 'Aberdeen'?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
|
SELECT AirportName FROM airports WHERE City = 'Aberdeen';
|
Find the name of dorms that can accommodate more than 300 students.?
Schema:
- Dorm(dorm_name, gender, student_capacity)
|
SELECT dorm_name FROM Dorm WHERE student_capacity > 300;
|
Which department has the highest average instructor salary?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary)
|
SELECT dept_name FROM instructor WHERE dept_name IS NOT NULL GROUP BY dept_name ORDER BY AVG(salary) DESC NULLS LAST LIMIT 1;
|
return the smallest salary for every departments.?
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 MIN(SALARY) AS min_salary, DEPARTMENT_ID FROM employees GROUP BY DEPARTMENT_ID;
|
How many different captain ranks are there?
Schema:
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l)
|
SELECT COUNT(DISTINCT "Rank") AS num_ranks FROM captain;
|
Find the first name of the band mate that has performed in most songs.?
Schema:
- Performance(...)
- Band(...)
- Songs(Title)
|
SELECT T2.Firstname FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE Firstname IS NOT NULL GROUP BY Firstname ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.