question
stringlengths
43
589
query
stringlengths
19
598
Show all the distinct institution types.? Schema: - Institution(COUNT, Enrollment, Founded, Type)
SELECT DISTINCT Type FROM Institution;
What are the names of conductors, ordered by age? Schema: - conductor(Age, Name, Nationality, Year_of_Work)
SELECT Name FROM conductor ORDER BY Age ASC NULLS LAST;
How many staff does each project has? List the project id and the number in an ascending order.? Schema: - Project_Staff(COUNT, date_from, date_to, role_code) - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
SELECT T1.project_id, COUNT(*) AS num_staff FROM Project_Staff AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id ORDER BY num_staff ASC NULLS LAST;
return me the paper after 2000 with the most citations .? Schema: - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
SELECT title FROM publication WHERE "year" > 2000 ORDER BY citation_num DESC NULLS LAST LIMIT 1;
Count the number of high schoolers in grades 9 or 10.? Schema: - Highschooler(COUNT, ID, grade, name)
SELECT COUNT(*) AS num_highschoolers FROM Highschooler WHERE grade = 9 OR grade = 10;
For each payment method, return how many customers use it.? 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 payment_method_code, COUNT(*) AS num_customers FROM Customers GROUP BY payment_method_code;
what did sharon goldwater write ? Schema: - writes(...) - author(...)
SELECT DISTINCT T2.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'sharon goldwater';
Which customer had at least 2 policies but did not file any claims? List the customer details and id.? 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_Policies(COUNT, Policy_Type_Code) - Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled)
SELECT T1.Customer_Details, T1.Customer_ID FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID LEFT JOIN Claims AS T3 ON T2.Policy_ID = T3.Policy_ID GROUP BY T1.Customer_Details, T1.Customer_ID, T3.Policy_ID HAVING COUNT(*) >= 2 AND T3.Policy_ID IS NULL;
Find the number of manufactures that are based in Tokyo or Beijing.? Schema: - Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue)
SELECT COUNT(*) AS num_manufacturers FROM Manufacturers WHERE Headquarter = 'Tokyo' OR Headquarter = 'Beijing';
What are the names of the directors who made exactly one movie? Schema: - Movie(T1, director, title, year)
SELECT director FROM Movie WHERE director IS NOT NULL GROUP BY director HAVING COUNT(*) = 1;
are there any monte carlo simulation papers since 2011 ? 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 = 'monte carlo simulation' AND T3."year" > 2011;
which journal did Donald E Knuth publish his last paper ? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.journalId, T3."year" 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 = 'Donald E Knuth' GROUP BY T3.journalId, T3."year" ORDER BY T3."year" DESC NULLS LAST;
Which professionals have operated a treatment that costs less than the average? Give me theor first names and last names.? Schema: - Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street) - Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id)
SELECT DISTINCT T1.first_name, T1.last_name FROM Professionals AS T1 NATURAL JOIN Treatments AS T2 WHERE cost_of_treatment < (SELECT AVG(cost_of_treatment) FROM Treatments);
What is the name of the most expensive product? 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 DESC NULLS LAST LIMIT 1;
Which project made the most number of outcomes? List the project details and the project id.? Schema: - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) - Project_Outcomes(outcome_code)
SELECT T1.project_details, T1.project_id FROM Projects AS T1 JOIN Project_Outcomes AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id, T1.project_details ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Show the membership level with most number of members.? Schema: - member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
SELECT Level FROM member_ WHERE Level IS NOT NULL GROUP BY Level ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Show the team that have at least two technicians.? Schema: - technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name)
SELECT Team FROM technician WHERE Team IS NOT NULL GROUP BY Team HAVING COUNT(*) >= 2;
Show the maximum amount of transaction.? Schema: - Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code)
SELECT MAX(amount_of_transaction) AS max_amount_of_transaction FROM Transactions;
What are the maximum and minimum number of transit passengers of all aiports.? Schema: - airport(Airport_Name, City, Country, Domestic_Passengers, International_Passengers, Transit_Passengers, id, name)
SELECT MAX(Transit_Passengers) AS max_transit_passengers, MIN(Transit_Passengers) AS min_transit_passengers FROM airport;
Find the program which most number of students are enrolled in. List both the id and the summary.? Schema: - Degree_Programs(degree_summary_name, department_id) - Student_Enrolment(...)
SELECT T1.degree_program_id, T1.degree_summary_name FROM Degree_Programs AS T1 JOIN Student_Enrolment AS T2 ON T1.degree_program_id = T2.degree_program_id GROUP BY T1.degree_program_id, T1.degree_summary_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the name and results of the battles when the bulgarian commander is not 'Boril'? Schema: - battle(Baldw, bulgarian_commander, date, latin_commander, name, result)
SELECT name, "result" FROM battle WHERE bulgarian_commander != 'Boril';
How many tracks do we have? Schema: - track(Location, Name, Seat, Seating, T1, Year_Opened)
SELECT COUNT(*) AS num_tracks FROM track;
Which physicians prescribe a medication of brand X? Tell me the name and position of those physicians.? Schema: - Physician(I, Name) - Prescribes(...) - Medication(Name)
SELECT DISTINCT T1.Name, T1."Position" FROM Physician AS T1 JOIN Prescribes AS T2 ON T1.EmployeeID = T2.Physician JOIN Medication AS T3 ON T3.Code = T2.Medication WHERE T3.Brand = 'X';
What are the ids of the movies that are not reviewed by Brittany Harris.? Schema: - Rating(Rat, mID, rID, stars) - Reviewer(Lew, name, rID)
SELECT mID FROM Rating WHERE mID NOT IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = 'Brittany Harris');
List all customers’ names in the alphabetical order.? Schema: - ACCOUNTS(name)
SELECT name FROM ACCOUNTS ORDER BY name ASC NULLS LAST;
What is the nationality of the actor " Christoph Waltz " ? Schema: - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
SELECT nationality FROM actor WHERE name = 'Christoph Waltz';
Find the name and id of accounts whose checking balance is below the maximum checking balance.? Schema: - ACCOUNTS(name) - CHECKING(balance)
SELECT T1.custid, T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT MAX(balance) FROM CHECKING);
Show the number of trains? Schema: - train(Name, Service, Time, destination, name, origin, time, train_number)
SELECT COUNT(*) AS num_trains FROM train;
List the names of people that are not entrepreneurs.? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) - entrepreneur(COUNT, Company, Investor, Money_Requested)
SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM entrepreneur);
Who directed the movie " James Bond " ? Schema: - director(Afghan, name, nationality) - directed_by(...) - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
SELECT T2.name FROM director AS T2 JOIN directed_by AS T1 ON T2.did = T1.did JOIN movie AS T3 ON T3.mid = T1.msid WHERE T3.title = 'James Bond';
What are the distinct cross reference source system codes which are related to the master customer details 'Gottlieb, Becker and Wyman'? Schema: - Customer_Master_Index(cmi_details) - CMI_Cross_References(source_system_code)
SELECT DISTINCT T2.source_system_code FROM Customer_Master_Index AS T1 JOIN CMI_Cross_References AS T2 ON T1.master_customer_id = T2.master_customer_id WHERE T1.cmi_details = 'Gottlieb, Becker and Wyman';
What is the role name and role description for employee called Ebba? Schema: - Employees(COUNT, Date_of_Birth, Employee_ID, Employee_Name, Role_Code, employee_id, employee_name, role_code) - Roles(Role_Code, Role_Description, Role_Name, role_code, role_description)
SELECT T2.Role_Name, T2.Role_Description FROM Employees AS T1 JOIN Roles AS T2 ON T1.Role_Code = T2.Role_Code WHERE T1.Employee_Name = 'Ebba';
What is the receipt date of the document with id 3? 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 receipt_date FROM Documents WHERE document_id = 3;
How many characteristics are there? Schema: - Characteristics(characteristic_name)
SELECT COUNT(*) AS num_characteristics FROM Characteristics;
What are the distinct classes that races can have? Schema: - race(Class, Date, Name)
SELECT DISTINCT Class FROM race;
List the names of the city with the top 5 white percentages.? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT Name FROM city ORDER BY White DESC NULLS LAST LIMIT 5;
For each project id, how many tasks are there? Schema: - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) - Tasks(...)
SELECT COUNT(*) AS num_tasks, T1.project_details FROM Projects AS T1 JOIN Tasks AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id, T1.project_details;
What is the name and capacity for the stadium with highest average attendance? Schema: - stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
SELECT Name, Capacity FROM stadium ORDER BY Average DESC NULLS LAST LIMIT 1;
Find the first names and last names of teachers in alphabetical order of last name.? Schema: - Teachers(email_address, first_name, gender, last_name)
SELECT first_name, last_name FROM Teachers ORDER BY last_name ASC NULLS LAST;
datasets used in papers written by jitendra malik ? 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';
How many clubs does the student named "Eric Tai" belong to? Schema: - Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn) - Member_of_club(...) - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT COUNT(DISTINCT T1.ClubName) AS num_clubs FROM Club AS T1 JOIN Member_of_club AS T2 ON T1.ClubID = T2.ClubID JOIN Student AS T3 ON T2.StuID = T3.StuID WHERE T3.Fname = 'Eric' AND T3.LName = 'Tai';
Which Payments were processed with Visa? List the payment Id, the date and the amount.? Schema: - Payments(Amount_Payment, COUNT, Date_Payment_Made, Payment_ID, Payment_Method_Code, V, amount_due, amount_paid, payment_date, payment_type_code)
SELECT Payment_ID, Date_Payment_Made, Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa';
What are the names of accounts with checking balances greater than the average checking balance and savings balances below the average savings balance? Schema: - ACCOUNTS(name) - CHECKING(balance) - SAVINGS(SAV, balance)
SELECT T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid WHERE T2.balance > (SELECT AVG(balance) FROM CHECKING) AND T3.balance < (SELECT AVG(balance) FROM SAVINGS);
Count the number of customer cards of the type Debit.? Schema: - Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to)
SELECT COUNT(*) AS num_cards FROM Customers_Cards WHERE card_type_code = 'Debit';
How many female students have milk or egg allergies? Schema: - Has_Allergy(Allergy, COUNT, StuID) - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT COUNT(*) AS num_female_students FROM Has_Allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Sex = 'F' AND T1.Allergy = 'Milk' OR T1.Allergy = 'Eggs';
Which room has cheapest base price? List the room's name and the base price.? Schema: - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT roomName, basePrice FROM Rooms ORDER BY basePrice ASC NULLS LAST LIMIT 1;
how many people reside in california? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT population FROM state WHERE state_name = 'california';
what is the area of the new mexico state? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT area FROM state WHERE state_name = 'new mexico';
List all the subject names.? Schema: - Subjects(subject_name)
SELECT subject_name FROM Subjects;
Return the gender and name of artist who produced the song with the lowest resolution.? 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.gender, T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name ORDER BY T2.resolution ASC NULLS LAST LIMIT 1;
Find the manager name and district of the shop whose number of products is the largest.? Schema: - shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more))
SELECT Manager_name, District FROM shop ORDER BY Number_products DESC NULLS LAST LIMIT 1;
What are the task details, task id and project id for the projects which are detailed as 'omnis' or have more than 2 outcomes? Schema: - Tasks(...) - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) - Project_Outcomes(outcome_code)
SELECT task_details, task_id, project_id FROM (SELECT T1.task_details, T1.task_id, T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'omnis' UNION ALL SELECT T1.task_details, T1.task_id, T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id JOIN Project_Outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T1.task_details, T1.task_id, T2.project_id HAVING COUNT(*) > 2) GROUP BY task_details, task_id, project_id;
List the position of players and the average number of points of players of each position.? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
SELECT "Position", AVG(Points) AS avg_points FROM player GROUP BY "Position";
Find the names of the artists who are from UK and have produced English 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 DISTINCT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.country = 'UK' AND T2.languages = 'english';
Show all customer ids and the number of cards owned by each customer.? 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 GROUP BY customer_id;
Show all game ids and the number of hours played.? Schema: - Plays_Games(GameID, Hours_Played, StuID)
SELECT GameID, SUM(Hours_Played) AS total_hours_played FROM Plays_Games GROUP BY GameID;
Show the employee ids for all employees with role name "Human Resource" or "Manager".? Schema: - Employees(COUNT, Date_of_Birth, Employee_ID, Employee_Name, Role_Code, employee_id, employee_name, role_code) - Roles(Role_Code, Role_Description, Role_Name, role_code, role_description)
SELECT T1.Employee_ID FROM Employees AS T1 JOIN Roles AS T2 ON T1.Role_Code = T2.Role_Code WHERE T2.Role_Name = 'Human Resource' OR T2.Role_Name = 'Manager';
What are the names of the technicians and how many machines are they assigned to repair? Schema: - repair_assignment(...) - technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name)
SELECT T2.name, COUNT(*) AS num_machines FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_id = T2.technician_id GROUP BY T2.name;
What are the different customer ids, and how many cards does each one hold? 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 GROUP BY customer_id;
which states border the ohio river? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT traverse FROM river WHERE river_name = 'ohio';
What are the name and code of the location with the smallest number of documents? Schema: - Document_Locations(COUNT, Date_in_Location_From, Date_in_Locaton_To, Location_Code) - Ref_Locations(Location_Code, Location_Description, Location_Name)
SELECT T2.Location_Name, T1.Location_Code FROM Document_Locations AS T1 JOIN Ref_Locations AS T2 ON T1.Location_Code = T2.Location_Code GROUP BY T1.Location_Code, T2.Location_Name ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
Count the number of products that were never ordered.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) - Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
SELECT COUNT(*) AS num_products FROM Products WHERE product_id NOT IN (SELECT product_id FROM Order_Items);
return me the number of researchers in Databases area in " University of Michigan " .? Schema: - domain_author(...) - author(...) - domain(...) - organization(continent, homepage, name)
SELECT COUNT(DISTINCT T1.name) AS num_researchers FROM domain_author AS T4 JOIN author AS T1 ON T4.aid = T1.aid JOIN domain AS T3 ON T3.did = T4.did JOIN organization AS T2 ON T2.oid = T1.oid WHERE T3.name = 'Databases' AND T2.name = 'University of Michigan';
How many actors from China have acted in " Rush Hour 3 "? 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 COUNT(DISTINCT T1.name) AS num_actors FROM cast_ AS T2 JOIN actor AS T1 ON T2.aid = T1.aid JOIN movie AS T3 ON T3.mid = T2.msid WHERE T1.nationality = 'China' AND T3.title = 'Rush Hour 3';
give me some good arabics in mountain view ? 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;
which movie has the most number of actors from China ? 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.nationality = 'China' GROUP BY T2.title ORDER BY COUNT(DISTINCT T1.name) DESC NULLS LAST LIMIT 1;
Find the number of distinct courses that have enrolled students.? Schema: - Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id)
SELECT COUNT(course_id) AS num_courses FROM Student_Course_Enrolment;
Show the locations that have at least two performances.? Schema: - performance(Attendance, COUNT, Date, Location, T1)
SELECT Location FROM performance WHERE Location IS NOT NULL GROUP BY Location HAVING COUNT(*) >= 2;
What is the average latitude and longitude of all starting stations for 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 AVG(T1.lat) AS avg_latitude, AVG(T1.long) AS avg_longitude FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id;
what is a good restaurant in alameda ? 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 = 'alameda' AND T1.rating > 2.5;
How many universities have a location that contains NY? Schema: - university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School)
SELECT COUNT(*) AS num_universities FROM university WHERE Location LIKE '%NY%';
What is the product with 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;
Show the residences that have both a player of gender "M" and a player of gender "F".? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
SELECT DISTINCT p1.Residence FROM player p1 JOIN player p2 ON p1.Residence = p2.Residence WHERE p1.Gender = 'M' AND p2.Gender = 'F';
What is the last date of the staff leaving the projects? Schema: - Project_Staff(COUNT, date_from, date_to, role_code)
SELECT date_to FROM Project_Staff ORDER BY date_to DESC NULLS LAST LIMIT 1;
What are the names of the airports which are not in the country 'Iceland'? Schema: - airport(Airport_Name, City, Country, Domestic_Passengers, International_Passengers, Transit_Passengers, id, name)
SELECT name FROM airport WHERE Country != 'Iceland';
What are the names of colleges in LA that have more than 15,000 students and of colleges in AZ with less than 13,000 students? Schema: - College(M, cName, enr, state)
SELECT DISTINCT cName FROM (SELECT cName FROM College WHERE enr < 13000 AND state = 'AZ' UNION ALL SELECT cName FROM College WHERE enr > 15000 AND state = 'LA');
what rivers run through the states that border the state with the capital atlanta? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) - border_info(T1, border, state_name) - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT river_name FROM river WHERE traverse IN (SELECT border FROM border_info WHERE state_name IN (SELECT state_name FROM state WHERE capital = 'atlanta'));
What are the distinct names of customers who have purchased at least three different products? 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 DISTINCT T1.customer_name FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_Items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_id, T1.customer_name HAVING COUNT(DISTINCT T3.product_id) >= 3;
What is the name of the course with the most students enrolled? Schema: - Courses(course_description, course_name) - Student_Enrolment_Courses(...)
SELECT T1.course_name FROM Courses AS T1 JOIN Student_Enrolment_Courses AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the team and starting year of technicians? Schema: - technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name)
SELECT Team, Starting_Year FROM technician;
Return the total revenue of companies with headquarters in Tokyo or Taiwan.? Schema: - Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue)
SELECT SUM(Revenue) AS total_revenue FROM Manufacturers WHERE Headquarter = 'Tokyo' OR Headquarter = 'Taiwan';
What is the year that had the most concerts? Schema: - concert(COUNT, Year)
SELECT "Year" FROM concert GROUP BY "Year" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Find all students taught by OTHA MOYER. Output the first and last names of the 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 = 'OTHA' AND T2.LastName = 'MOYER';
Which city has the lowest GDP? Please list the city name and its GDP.? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT City, GDP FROM city ORDER BY GDP ASC NULLS LAST LIMIT 1;
What is the average rating of reviews written in year 2014 ? Schema: - review(i_id, rank, rating, text)
SELECT AVG(rating) AS avg_rating FROM review WHERE "year" = 2014;
papers related to Question Answering? 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 codes of template types that have fewer than 3 templates? Schema: - Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number)
SELECT Template_Type_Code FROM Templates WHERE Template_Type_Code IS NOT NULL GROUP BY Template_Type_Code HAVING COUNT(*) < 3;
Find the detail of products whose detail contains the word "Latte" or the word "Americano"? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT product_details FROM Products WHERE product_details LIKE '%Latte%' OR product_details LIKE '%Americano%';
Give the names of tracks that do not have a race in the class 'GT'.? Schema: - track(Location, Name, Seat, Seating, T1, Year_Opened) - race(Class, Date, Name)
SELECT T1.Name FROM track AS T1 LEFT JOIN (SELECT T2.Name FROM race AS T1 JOIN track AS T2 ON T1.Track_ID = CAST(T2.Track_ID AS TEXT) WHERE T1.Class = 'GT') AS T2 ON T1.Name = T2.Name WHERE T2.Name IS NULL;
Show institution names along with the number of proteins for each institution.? Schema: - Institution(COUNT, Enrollment, Founded, Type) - protein(...)
SELECT T1.Institution, COUNT(*) AS num_proteins FROM Institution AS T1 JOIN protein AS T2 ON T1.Institution_id = T2.Institution_id GROUP BY T1.Institution;
Please show the employee last names that serves no more than 20 customers.? Schema: - Customer(Email, FirstName, LastName, State, lu) - Employee(BirthDate, City, FirstName, LastName, Phone)
SELECT T1.LastName FROM Customer AS T1 JOIN Employee AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId, T1.LastName HAVING COUNT(*) <= 20;
What languages are only used by a single country with a republic government? 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.GovernmentForm = 'Republic' GROUP BY T2."Language" HAVING COUNT(*) = 1;
Find the name of the products that are not using the most frequently-used max page size.? Schema: - product(COUNT, pages_per_minute_color, product)
SELECT product FROM product WHERE product != (SELECT max_page_size FROM product WHERE max_page_size IS NOT NULL GROUP BY max_page_size ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1);
Find the name and hours of the students whose tryout decision is yes.? Schema: - Player(HS, pName, weight, yCard) - Tryout(COUNT, EX, T1, cName, decision, pPos)
SELECT T1.pName, T1.HS FROM Player AS T1 JOIN Tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes';
List top papers for parsing? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - cite(...)
SELECT DISTINCT T4.citedPaperId, COUNT(T4.citedPaperId) AS num_cites FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN cite AS T4 ON T3.paperId = T4.citedPaperId WHERE T1.keyphraseName = 'parsing' GROUP BY T4.citedPaperId ORDER BY num_cites DESC NULLS LAST;
How many projects are there? Schema: - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
SELECT COUNT(*) AS num_projects FROM Projects;
What is the average prices of wines for each each? Schema: - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
SELECT AVG(Price) AS avg_price, "Year" FROM wine GROUP BY "Year";
Count the number of flights into ATO.? Schema: - flights(DestAirport, FlightNo, SourceAirport)
SELECT COUNT(*) AS num_flights FROM flights WHERE DestAirport = 'ATO';
What place has the most flights coming from there? Schema: - flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more))
SELECT origin FROM flight WHERE origin IS NOT NULL GROUP BY origin ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
How many gas station are opened between 2000 and 2005? Schema: - gas_station(COUNT, Location, Manager_Name, Open_Year, Station_ID)
SELECT COUNT(*) AS num_gas_stations FROM gas_station WHERE Open_Year BETWEEN 2000 AND 2005;