question
stringlengths
43
589
query
stringlengths
19
598
List all product names in ascending order of price.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT Product_Name FROM Products ORDER BY Product_Price ASC NULLS LAST;
Which customer, who has made at least one payment, has spent the least money? List his or her first name, last name, and the id.? Schema: - customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) - payment(amount, payment_date)
SELECT T1.first_name, T1.last_name, T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name, T1.customer_id ORDER BY SUM(amount) ASC NULLS LAST LIMIT 1;
How many different instructors have taught some course? Schema: - teaches(ID, Spr, semester)
SELECT COUNT(DISTINCT ID) AS num_instructors FROM teaches;
how many users reviewed " Sushi Too " in Pittsburgh? Schema: - review(i_id, rank, rating, text) - business(business_id, city, full_address, name, rating, review_count, state) - user_(name)
SELECT COUNT(DISTINCT T3.name) AS num_users FROM review AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN user_ AS T3 ON T3.user_id = T2.user_id WHERE T1.city = 'Pittsburgh' AND T1.name = 'Sushi Too';
Show me chi papers .? Schema: - venue(venueId, venueName) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T1.paperId FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T2.venueName = 'chi';
Find the name and checking balance of the account with the lowest saving balance.? Schema: - ACCOUNTS(name) - CHECKING(balance) - SAVINGS(SAV, balance)
SELECT T2.balance, T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid ORDER BY T3.balance ASC NULLS LAST LIMIT 1;
What is ids of the songs whose resolution is higher than the resolution of any songs with rating lower than 8? Schema: - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT f_id FROM song WHERE resolution > (SELECT MAX(resolution) FROM song WHERE rating < 8);
Count the number of distinct instructors who have taught a course.? Schema: - teaches(ID, Spr, semester)
SELECT COUNT(DISTINCT ID) AS num_instructors FROM teaches;
List the names and phone numbers of all the distinct suppliers who supply red jeans.? Schema: - Suppliers(...) - Product_Suppliers(COUNT, DOUBLE, TRY_CAST, product_id, supplier_id) - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT DISTINCT T1.supplier_name, T1.supplier_phone FROM Suppliers AS T1 JOIN Product_Suppliers AS T2 ON T1.supplier_id = T2.supplier_id JOIN Products AS T3 ON T2.product_id = T3.product_id WHERE T3.product_name = 'red jeans';
Show the names of donors who donated to both school "Glenn" and "Triton."? Schema: - endowment(School_id, amount, donator_name) - School(County, Enrollment, Location, Mascot, School_name)
SELECT DISTINCT T1.donator_name FROM endowment AS T1 JOIN School AS T2 ON CAST(T1.School_id AS TEXT) = T2.School_id JOIN endowment AS T3 ON T1.donator_name = T3.donator_name JOIN School AS T4 ON CAST(T3.School_id AS TEXT) = T4.School_id WHERE T2.School_name = 'Glenn' AND T2.School_name = 'Triton';
What is the issue date of the volume with the minimum weeks on top? Schema: - volume(Artist_ID, Issue_Date, Song, Weeks_on_Top)
SELECT Issue_Date FROM volume ORDER BY Weeks_on_Top ASC NULLS LAST LIMIT 1;
Find all students taught by MARROTTE KIRK. Output first and last names of students.? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName) - teachers(Classroom, FirstName, LastName)
SELECT T1.FirstName, T1.LastName FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T2.FirstName = 'MARROTTE' AND T2.LastName = 'KIRK';
Find the id and number of shops for the company that produces the most expensive furniture.? Schema: - manufacturer(Manufacturer_ID, Name, Open_Year) - furniture_manufacte(...)
SELECT T1.Manufacturer_ID, T1.Num_of_Shops FROM manufacturer AS T1 JOIN furniture_manufacte AS T2 ON T1.Manufacturer_ID = T2.Manufacturer_ID ORDER BY T2.Price_in_Dollar DESC NULLS LAST LIMIT 1;
Count the number of stores the chain South has.? Schema: - Department_Stores(COUNT, dept_store_chain_id) - Department_Store_Chain(...)
SELECT COUNT(*) AS num_stores FROM Department_Stores AS T1 JOIN Department_Store_Chain AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id WHERE T2.dept_store_chain_name = 'South';
Show the minimum amount of transactions whose type code is "PUR" and whose share count is bigger than 50.? Schema: - Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code)
SELECT MIN(amount_of_transaction) AS min_amount_of_transaction FROM Transactions WHERE transaction_type_code = 'PUR' AND TRY_CAST(share_count AS DOUBLE) > 50;
Who acted " Alan Turing " in the movie " The Imitation Game " ? 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 T1.name FROM cast_ AS T2 JOIN actor AS T1 ON T2.aid = T1.aid JOIN movie AS T3 ON T3.mid = T2.msid WHERE T2.role = 'Alan Turing' AND T3.title = 'The Imitation Game';
What is the average number of rooms of apartments with type code "Studio"? Schema: - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT AVG(TRY_CAST(room_count AS INT)) AS avg_room_count FROM Apartments WHERE apt_type_code = 'Studio';
What parties have at least three representatives? Schema: - representative(JO, Lifespan, Name, Party, State, T1)
SELECT Party FROM representative WHERE Party IS NOT NULL GROUP BY Party HAVING COUNT(*) >= 3;
Which colleges do the tryout players whose name starts with letter D go to? Schema: - Tryout(COUNT, EX, T1, cName, decision, pPos) - Player(HS, pName, weight, yCard)
SELECT T1.cName FROM Tryout AS T1 JOIN Player AS T2 ON T1.pID = T2.pID WHERE T2.pName ILIKE 'D%';
Find the phone numbers of customers using the most common policy type among the available policies.? Schema: - Available_Policies(COUNT, Customer_Phone, Life, policy_type_code)
SELECT Customer_Phone FROM Available_Policies WHERE policy_type_code = (SELECT policy_type_code FROM Available_Policies WHERE policy_type_code IS NOT NULL GROUP BY policy_type_code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1);
List the project details of the projects launched by the organisation? Schema: - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
SELECT project_details FROM Projects WHERE organisation_id IN (SELECT organisation_id FROM Projects WHERE organisation_id IS NOT NULL GROUP BY organisation_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1);
Tell me the location of the club "Hopkins Student Enterprises".? Schema: - Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn)
SELECT ClubLocation FROM Club WHERE ClubName = 'Hopkins Student Enterprises';
where is a good place in the yosemite and mono lake area for french food ? Schema: - restaurant(...) - geographic(...) - location(...)
SELECT T3.house_number, T1.name FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name JOIN location AS T3 ON T1.id = T3.restaurant_id WHERE T2.region = 'yosemite and mono lake area' AND T1.food_type = 'french' AND T1.rating > 2.5;
Find the number of reviews on businesses located in " South Summerlin " neighbourhood? Schema: - neighbourhood(...) - business(business_id, city, full_address, name, rating, review_count, state) - review(i_id, rank, rating, text)
SELECT COUNT(DISTINCT T3."text") AS num_reviews FROM neighbourhood AS T1 JOIN business AS T2 ON T1.business_id = T2.business_id JOIN review AS T3 ON T3.business_id = T2.business_id WHERE T1.neighbourhood_name = ' South Summerlin';
find all films in which " Rowan Atkinson " acted as " Mr. Bean "? 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 T2.title FROM cast_ AS T3 JOIN actor AS T1 ON T3.aid = T1.aid JOIN movie AS T2 ON T2.mid = T3.msid WHERE T1.name = 'Rowan Atkinson' AND T3.role = 'Mr. Bean';
How many people live in Asia, and what is the largest GNP among them? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
SELECT SUM(Population) AS total_population, MAX(GNP) AS largest_gnp FROM country WHERE Continent = 'Asia';
What is the total amount of settlement made for all the settlements? Schema: - Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount)
SELECT SUM(Amount_Settled) AS total_amount_settled FROM Settlements;
Find the name of the company that produces both furnitures with less than 6 components and furnitures with more than 10 components.? Schema: - furniture(Furniture_ID, Market_Rate, Name) - furniture_manufacte(...) - manufacturer(Manufacturer_ID, Name, Open_Year)
SELECT DISTINCT t3_a.Name FROM furniture AS T1_a JOIN furniture_manufacte AS T2_a ON t1_a.Furniture_ID = t2_a.Furniture_ID JOIN manufacturer AS T3_a ON t2_a.Manufacturer_ID = t3_a.Manufacturer_ID WHERE t1_a.Num_of_Component < 6 AND t3_a.Name IN (SELECT t3_b.Name FROM furniture AS T1_b JOIN furniture_manufacte AS T2_b ON t1_b.Furniture_ID = t2_b.Furniture_ID JOIN manufacturer AS T3_b ON t2_b.Manufacturer_ID = t3_b.Manufacturer_ID WHERE t1_b.Num_of_Component > 10);
display the department id and the total salary for those departments which contains at least two employees.? Schema: - employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more))
SELECT DEPARTMENT_ID, SUM(SALARY) AS total_salary FROM employees WHERE DEPARTMENT_ID IS NOT NULL GROUP BY DEPARTMENT_ID HAVING COUNT(*) >= 2;
what is the lowest point in usa? Schema: - highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
SELECT lowest_point FROM highlow WHERE lowest_elevation = (SELECT MIN(lowest_elevation) FROM highlow);
What is the campus fee of "San Jose State University" in year 1996? Schema: - Campuses(Campus, County, Franc, Location) - csu_fees(CampusFee)
SELECT CampusFee FROM Campuses AS T1 JOIN csu_fees AS T2 ON T1.Id = T2.Campus WHERE T1.Campus = 'San Jose State University' AND T2."Year" = 1996;
What is the official language used in the country the name of whose head of state is Beatrix.? 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 T2."Language" FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.HeadOfState = 'Beatrix' AND T2.IsOfficial = 'T';
What are the companies of entrepreneurs, ordered descending by amount of money requested? Schema: - entrepreneur(COUNT, Company, Investor, Money_Requested)
SELECT Company FROM entrepreneur ORDER BY Money_Requested DESC NULLS LAST;
List all the name of organizations in order of the date formed.? Schema: - Organizations(date_formed, organization_name)
SELECT organization_name FROM Organizations ORDER BY date_formed ASC NULLS LAST;
papers at chi? Schema: - venue(venueId, venueName) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T1.paperId FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T2.venueName = 'chi';
What is the least popular kind of decor? Schema: - Reservations(Adults, CheckIn, FirstName, Kids, LastName) - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT T2.decor FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T2.decor ORDER BY COUNT(T2.decor) ASC NULLS LAST LIMIT 1;
Which last names are both used by customers and by staff? 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 last_name FROM Customers WHERE last_name IN (SELECT last_name FROM Staff);
List the customer event id and the corresponding move in date and property id.? Schema: - Customer_Events(Customer_Event_ID, date_moved_in, property_id)
SELECT Customer_Event_ID, date_moved_in, property_id FROM Customer_Events;
Find all phones that have word 'Full' in their accreditation types. List the Hardware Model name and Company name.? Schema: - phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode)
SELECT Hardware_Model_name, Company_name FROM phone WHERE Accreditation_type LIKE 'Full';
Find the top 3 products which have the largest number of problems? Schema: - Problems(date_problem_reported, problem_id) - Product(product_id, product_name)
SELECT T2.product_name FROM Problems AS T1 JOIN Product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 3;
Show station names without any trains.? Schema: - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) - train_station(...)
SELECT Name FROM station WHERE Station_ID NOT IN (SELECT Station_ID FROM train_station);
Find the number and average age of students living in each city.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT COUNT(*) AS num_students, AVG(Age) AS avg_age, city_code FROM Student GROUP BY city_code;
What are the name and phone of the customer with the most ordered product quantity? Schema: - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) - Customer_Orders(customer_id, order_date, order_id, order_shipping_charges) - Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
SELECT T1.customer_name, T1.customer_phone FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_Items AS T3 ON T3.order_id = T2.order_id GROUP BY T1.customer_id, T1.customer_name, T1.customer_phone ORDER BY SUM(TRY_CAST(T3.order_quantity AS DOUBLE)) DESC NULLS LAST LIMIT 1;
What is the number of escape games in " Madison " ? Schema: - category(...) - business(business_id, city, full_address, name, rating, review_count, state)
SELECT COUNT(DISTINCT T1.name) AS num_escape_games FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T1.city = 'Madison' AND T2.category_name = 'escape games';
What are the distinct hometowns of gymnasts with total points more than 57.5? Schema: - gymnast(Floor_Exercise_Points, Horizontal_Bar_Points) - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T1.Total_Points > 57.5;
what is the number of restaurant in Texas? Schema: - category(...) - business(business_id, city, full_address, name, rating, review_count, state)
SELECT COUNT(DISTINCT T1.name) AS num_restaurants FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T1.state = 'Texas' AND T2.category_name = 'restaurant';
What is the number of distinct publication dates? Schema: - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
SELECT COUNT(DISTINCT Publication_Date) AS num_publication_dates FROM publication;
what is the highest point in the state with the capital des moines? Schema: - highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT highest_point FROM highlow WHERE state_name IN (SELECT state_name FROM state WHERE capital = 'des moines');
Find the country of origin for the artist who made the least number of songs? Schema: - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name, T1.country ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
What are the carriers of devices that are not in stock anywhere? Schema: - device(COUNT, Carrier, Software_Platform) - stock(Quantity)
SELECT Carrier FROM device WHERE Device_ID NOT IN (SELECT Device_ID FROM stock);
keyphrases used by Christof Dallermassl in 2000? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - paperKeyphrase(...) - writes(...) - author(...)
SELECT DISTINCT T2.keyphraseId FROM paper AS T3 JOIN paperKeyphrase 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 = 'Christof Dallermassl' AND T3."year" = 2000;
find the ids of reviewers who did not give 4 star.? Schema: - Rating(Rat, mID, rID, stars)
SELECT rID FROM Rating WHERE rID NOT IN (SELECT rID FROM Rating WHERE stars = 4);
Return the names of the 3 countries with the fewest people.? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
SELECT Name FROM country ORDER BY Population ASC NULLS LAST LIMIT 3;
Count the number of different last names actors have.? Schema: - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
SELECT COUNT(DISTINCT last_name) AS num_last_names FROM actor;
List the branch name and city without any registered members.? Schema: - branch(Address_road, City, Name, Open_year, membership_amount) - membership_register_branch(...)
SELECT Name, City FROM branch WHERE Branch_ID NOT IN (SELECT Branch_ID FROM membership_register_branch);
What is the largest payment amount? Schema: - payment(amount, payment_date)
SELECT amount FROM payment ORDER BY amount DESC NULLS LAST LIMIT 1;
How many distinct locations of perpetrators are there? Schema: - perpetrator(Country, Date, Injured, Killed, Location, Year)
SELECT COUNT(DISTINCT Location) AS num_locations FROM perpetrator;
What are the products with the maximum page size eqal to A4 or a pages per minute color less 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;
What is the winery at which the wine with the highest score was made? Schema: - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
SELECT Winery FROM wine ORDER BY Score DESC NULLS LAST LIMIT 1;
What are the total amount and average amount paid in claim headers? Schema: - Claim_Headers(Amount_Piad)
SELECT SUM(Amount_Piad) AS total_amount, AVG(Amount_Piad) AS avg_amount FROM Claim_Headers;
What are the titles of the books whose writer is not "Elaine Lee"? Schema: - book(Ela, Issues, Title, Writer)
SELECT Title FROM book WHERE Writer != 'Elaine Lee';
How many friends does each student have? Schema: - Friend(student_id)
SELECT student_id, COUNT(*) AS num_friends FROM Friend GROUP BY student_id;
What is average life expectancy in the countries where English is not the official language? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) - countrylanguage(COUNT, CountryCode, Engl, Language)
SELECT AVG(LifeExpectancy) AS avg_life_expectancy FROM country WHERE Name NOT IN (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" = 'English' AND T2.IsOfficial = 'T');
List the companies and the investors of entrepreneurs.? Schema: - entrepreneur(COUNT, Company, Investor, Money_Requested)
SELECT Company, Investor FROM entrepreneur;
What is the name of the airline with the most routes? Schema: - airlines(Abbreviation, Airline, COUNT, Country, active, country, name) - routes(...)
SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What papers cite Daniel Jurafsky ? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - cite(...) - writes(...) - author(...)
SELECT DISTINCT T3.paperId FROM paper AS T3 JOIN cite AS T4 ON T3.paperId = T4.citingPaperId JOIN writes AS T2 ON T2.paperId = T4.citedPaperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'Daniel Jurafsky';
What are the student ids for those on scholarship in major number 600? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
SELECT DISTINCT T1.StuID FROM Student AS T1 JOIN SportsInfo AS T2 ON T1.StuID = T2.StuID WHERE T1.Major = 600 AND T2.OnScholarship = 'Y';
What are the customer phone numbers under the policy "Life Insurance"? Schema: - Available_Policies(COUNT, Customer_Phone, Life, policy_type_code)
SELECT Customer_Phone FROM Available_Policies WHERE policy_type_code = 'Life Insurance';
How many video games have type Massively multiplayer online game? Schema: - Video_Games(COUNT, Dest, GName, GType, onl)
SELECT COUNT(*) AS num_games FROM Video_Games WHERE GType = 'Massively multiplayer online game';
What is the total number of customers who use banks in New York City? Schema: - bank(SUM, bname, city, morn, no_of_customers, state)
SELECT SUM(no_of_customers) AS total_customers FROM bank WHERE city = 'New York City';
Give the names and locations of all wrestlers.? Schema: - wrestler(COUNT, Days_held, Location, Name, Reign)
SELECT Name, Location FROM wrestler;
What are the names of the pilots that have not won any matches in Australia? Schema: - pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team) - match_(Competition, Date, Match_ID, Venue)
SELECT Name FROM pilot WHERE Pilot_Id NOT IN (SELECT Winning_Pilot FROM match_ WHERE Country = 'Australia');
Show the date and venue of each workshop in ascending alphabetical order of the venue.? Schema: - workshop(Date, Venue)
SELECT "Date", Venue FROM workshop ORDER BY Venue ASC NULLS LAST;
Which catalog content has the highest height? Give me the catalog entry name.? Schema: - Catalog_Contents(capacity, catalog_entry_name, height, next_entry_id, price_in_dollars, price_in_euros, product_stock_number)
SELECT catalog_entry_name FROM Catalog_Contents ORDER BY height DESC NULLS LAST LIMIT 1;
Which apartments have type code "Flat"? Give me their apartment numbers.? Schema: - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT apt_number FROM Apartments WHERE apt_type_code = 'Flat';
Which papers have the substring "Database" in their titles? Show the titles of the papers.? Schema: - Papers(title)
SELECT title FROM Papers WHERE title LIKE '%Database%';
Count the number of cities in Australia.? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
SELECT COUNT(*) AS num_cities FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id WHERE T2.country = 'Australia';
How many documents are there of each type? 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_Type_Code, COUNT(*) AS num_documents FROM Documents GROUP BY Document_Type_Code;
Sort all captain names by their ages from old to young.? Schema: - captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l)
SELECT Name FROM captain ORDER BY age DESC NULLS LAST;
Who are Noah A Smith 's coauthors ? 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';
Find the total number of students living in the male dorm (with gender M).? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - Lives_in(...) - Dorm(dorm_name, gender, student_capacity)
SELECT COUNT(*) AS num_students FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.gender = 'M';
What are the names of climbers and the corresponding names of mountains that they climb? Schema: - climber(Country, K, Name, Points) - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT T1.Name, T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID;
What are keyphrases by Christof Dallermassl in 2000 ? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - paperKeyphrase(...) - writes(...) - author(...)
SELECT DISTINCT T2.keyphraseId FROM paper AS T3 JOIN paperKeyphrase 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 = 'Christof Dallermassl' AND T3."year" = 2000;
What is the most popular first name of the actors? Schema: - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
SELECT first_name FROM actor WHERE first_name IS NOT NULL GROUP BY first_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
For each grade, return the grade number, the number of classrooms used for the grade, and the total number of students enrolled in the grade.? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName)
SELECT Grade, COUNT(DISTINCT Classroom) AS num_classrooms, COUNT(*) AS num_students FROM list GROUP BY Grade;
which of the states bordering oklahoma has the largest population? 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 is the horsepower of the car with the greatest accelerate? Schema: - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT T1.Horsepower FROM cars_data AS T1 ORDER BY T1.Accelerate DESC NULLS LAST LIMIT 1;
What is the first name of the student whose last name starts with the letter S and is taking ACCT-211? Schema: - STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE) - ENROLL(...) - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
SELECT T1.STU_FNAME FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM JOIN CLASS AS T3 ON T2.CLASS_CODE = T3.CLASS_CODE WHERE T3.CRS_CODE = 'ACCT-211' AND T1.STU_LNAME ILIKE 'S%';
Show the first name, last name, and phone number for all female faculty members.? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
SELECT Fname, Lname, Phone FROM Faculty WHERE Sex = 'F';
What are the names of the stations that are located in Palo Alto but have never been the ending point of the trips? 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 name FROM station WHERE city = 'Palo Alto' AND name NOT IN (SELECT end_station_name FROM trip WHERE end_station_name IS NOT NULL GROUP BY end_station_name HAVING COUNT(*) > 100);
What are the first names and office locations for all professors sorted alphabetically by first name? Schema: - PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) - EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME)
SELECT T2.EMP_FNAME, T1.PROF_OFFICE FROM PROFESSOR AS T1 JOIN EMPLOYEE AS T2 ON T1.EMP_NUM = T2.EMP_NUM ORDER BY T2.EMP_FNAME ASC NULLS LAST;
List the names of journalists in ascending order of years working.? Schema: - journalist(Age, COUNT, Name, Nationality, T1, Years_working)
SELECT Name FROM journalist ORDER BY Years_working ASC NULLS LAST;
return me the number of papers by " H. V. Jagadish " on PVLDB after 2000 .? 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 T4.title) AS num_papers 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 T1.name = 'H. V. Jagadish' AND T2.name = 'PVLDB' AND T4."year" > 2000;
Which address do not have any member with the black membership card? Schema: - member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
SELECT Address FROM member_ WHERE Address NOT IN (SELECT Address FROM member_ WHERE Membership_card = 'Black');
What is the number of carsw ith over 6 cylinders? Schema: - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT COUNT(*) AS num_cars FROM cars_data WHERE Cylinders > 6;
What are the different types of transactions? Schema: - Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type)
SELECT DISTINCT transaction_type FROM Financial_Transactions;
Find the number of vocal types used in song "Demon Kitty Rag"? 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 = 'Demon Kitty Rag';
What are the name, height and prominence of mountains which do not belong to the range 'Aberdare Range'? Schema: - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT name, Height, Prominence FROM mountain WHERE "Range" != 'Aberdare Range';
What is the name and open year for the branch with most number of memberships registered in 2016? Schema: - membership_register_branch(...) - branch(Address_road, City, Name, Open_year, membership_amount)
SELECT T2.Name, T2.Open_year FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.Branch_ID = T2.Branch_ID WHERE T1.Register_Year = 2016 GROUP BY T2.Branch_ID, T2.Name, T2.Open_year ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
How many elections are there? Schema: - election(Committee, Date, Delegate, District, Vote_Percent, Votes)
SELECT COUNT(*) AS num_elections FROM election;