question
stringlengths
43
589
query
stringlengths
19
598
what is the population of the capital of the largest state through which the mississippi runs? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT population FROM city WHERE city_name = (SELECT capital FROM state WHERE area = (SELECT MAX(T1.area) FROM state AS T1 JOIN river AS T2 ON T1.state_name = T2.traverse WHERE T2.river_name = 'mississippi'));
Find the names of the tourist attractions that is either accessible by bus or at address 254 Ottilie Junction.? Schema: - Locations(Address, Location_Name, Other_Details) - Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more))
SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = '254 Ottilie Junction' OR T2.How_to_Get_There = 'bus';
Question Answering publications? 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 is the name of the oldest manager? Schema: - manager(Age, Country, Level, Name, Working_year_starts, m1)
SELECT Name FROM manager ORDER BY Age DESC NULLS LAST LIMIT 1;
Which poll resource provided the most number of candidate information? Schema: - candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_rate)
SELECT Poll_Source FROM candidate WHERE Poll_Source IS NOT NULL GROUP BY Poll_Source ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
List first name and last name of customers that have more than 2 payments.? Schema: - Customer_Payments(payment_method_code) - 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 T2.first_name, T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id, T2.first_name, T2.last_name HAVING COUNT(*) > 2;
Which order has the most recent shipment? Give me the order id.? Schema: - Shipments(order_id, shipment_date, shipment_tracking_number)
SELECT order_id FROM Shipments WHERE shipment_date = (SELECT MAX(shipment_date) FROM Shipments);
What are the ids of all students along with how many sports and games did they play? Schema: - SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
SELECT StuID, COUNT(*) AS num_sports, SUM(GamesPlayed) AS num_games FROM SportsInfo GROUP BY StuID;
Show the carriers that have both phones with memory smaller than 32 and phones with memory bigger than 64.? Schema: - phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode)
SELECT DISTINCT p1.Carrier FROM phone p1 JOIN phone p2 ON p1.Carrier = p2.Carrier WHERE p1.Memory_in_G < 32 AND p2.Memory_in_G > 64;
Find the number of visitors who did not visit any museum opened after 2010.? Schema: - visitor(Age, Level_of_membership, Name) - museum(Name, Open_Year) - visit(...)
SELECT COUNT(*) AS num_visitors FROM visitor WHERE ID NOT IN (SELECT T2.visitor_ID FROM museum AS T1 JOIN visit AS T2 ON T1.Museum_ID = T2.Museum_ID WHERE T1.Open_Year > 2010);
Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling.? Schema: - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) - 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 T1.account_name, T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan' AND T2.customer_last_name = 'Keeling';
What are the different years in which there were cars produced that weighed less than 4000 and also cars that weighted more than 3000 ? Schema: - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT DISTINCT "Year" FROM cars_data WHERE Weight BETWEEN 3000 AND 4000;
List the names of companies by ascending number of sales.? Schema: - company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more))
SELECT Name FROM company ORDER BY Sales_in_Billion ASC NULLS LAST;
What are the name, phone number and email address of the customer who made the largest number of orders? 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)
SELECT T1.customer_name, T1.customer_phone, T1.customer_email FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id, T1.customer_name, T1.customer_phone, T1.customer_email ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
List all statement ids and statement details.? Schema: - Statements(Statement_Details, Statement_ID)
SELECT Statement_ID, Statement_Details FROM Statements;
Count the number of distinct player positions.? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
SELECT COUNT(DISTINCT "Position") AS num_positions FROM player;
How many papers are written by authors from the institution "University of Pennsylvania"? Schema: - Papers(title) - Authorship(...) - Inst(...)
SELECT COUNT(DISTINCT T1.title) AS num_papers FROM Papers AS T1 JOIN Authorship AS T2 ON T1.paperID = T2.paperID JOIN Inst AS T3 ON T2.instID = T3.instID WHERE T3.name = 'University of Pennsylvania';
What is the theme, date, and attendance for the exhibition in year 2004? Schema: - exhibition_record(...) - exhibition(Theme, Ticket_Price, Year)
SELECT T2.Theme, T1."Date", SUM(T1.Attendance) AS total_attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.Exhibition_ID = T2.Exhibition_ID WHERE T2."Year" = 2004 GROUP BY T2.Theme, T1."Date";
Which physicians are in charge of more than one patient? Give me their names.? Schema: - Physician(I, Name) - Patient(...)
SELECT T1.Name FROM Physician AS T1 JOIN Patient AS T2 ON T1.EmployeeID = T2.PCP GROUP BY T1.EmployeeID, T1.Name HAVING COUNT(*) > 1;
How many teachers does the student named MADLOCK RAY have? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName) - teachers(Classroom, FirstName, LastName)
SELECT COUNT(*) AS num_teachers FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T1.FirstName = 'MADLOCK' AND T1.LastName = 'RAY';
Find the total and average amount of settlements.? Schema: - Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount)
SELECT SUM(Settlement_Amount) AS total_settlement_amount, AVG(Settlement_Amount) AS avg_settlement_amount FROM Settlements;
In which country and state does Janessa Sawayn live? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) - Staff(COUNT, Name, Other_Details, date_joined_staff, date_left_staff, date_of_birth, email_address, first_name, gender, last_name, middle_name, nickname)
SELECT T1.country, T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn';
Find the city and name of bank branches that provide business loans.? Schema: - bank(SUM, bname, city, morn, no_of_customers, state) - loan(...)
SELECT T1.bname, T1.city FROM bank AS T1 JOIN loan AS T2 ON CAST(T1.branch_ID AS TEXT) = T2.branch_ID WHERE T2.loan_type = 'Business';
Count the number of different companies.? Schema: - entrepreneur(COUNT, Company, Investor, Money_Requested)
SELECT COUNT(DISTINCT Company) AS num_companies FROM entrepreneur;
Find the first name, country code and birth date of the winner who has the highest rank points in 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;
List all channel names ordered by their rating in percent from big to small.? Schema: - channel(Name, Owner, Rating_in_percent, Share_in_percent)
SELECT Name FROM channel ORDER BY Rating_in_percent DESC NULLS LAST;
Find the name and partition id for users who tweeted less than twice.? Schema: - user_profiles(email, followers, name, partitionid) - tweets(I, tweet_text, uid)
SELECT T1.name, T1.partitionid FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid, T1.name, T1.partitionid HAVING COUNT(*) < 2;
What is the number of movies directed by " Woody Allen " per year ? Schema: - director(Afghan, name, nationality) - directed_by(...) - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
SELECT COUNT(DISTINCT T3.title) AS num_movies, T3.release_year FROM director AS T2 JOIN directed_by AS T1 ON T2.did = T1.did JOIN movie AS T3 ON T3.mid = T1.msid WHERE T2.name = 'Woody Allen' GROUP BY T3.release_year;
What is the name of the course with the most registered students? Schema: - Courses(course_description, course_name) - Student_Course_Registrations(COUNT, student_id)
SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Registrations AS T2 ON T1.course_id = CAST(T2.course_id AS text) GROUP BY T1.course_id, T1.course_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Who is the advisor of Linda Smith? Give me the first name and last name.? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT T1.Fname, T1.Lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor WHERE T2.Fname = 'Linda' AND T2.Lname = 'Smith';
Papers from pldi 2015 ? 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 T1."year" = 2015 AND T2.venueName = 'pldi';
What are the first name, last name and id of the player with the most all star game experiences? Also list the count.? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) - all_star(...)
SELECT T1.name_first, T1.name_last, T1.player_id, COUNT(*) AS num_all_star_games FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id GROUP BY T1.name_first, T1.name_last, T1.player_id ORDER BY num_all_star_games DESC NULLS LAST LIMIT 1;
How many citations does luke zettlemoyer have per year? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - cite(...) - writes(...) - author(...)
SELECT DISTINCT COUNT(T4.citedPaperId) AS num_citations, T3."year" FROM paper AS T3 JOIN cite AS T4 ON T3.paperId = T4.citedPaperId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'luke zettlemoyer' GROUP BY T3."year";
how many places for french are there in palo alto ? Schema: - restaurant(...) - location(...)
SELECT COUNT(*) AS num_places FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'palo alto' AND T1.food_type = 'french';
Show the locations of parties with hosts older than 50.? Schema: - party_host(...) - host(Age, COUNT, Name, Nationality) - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT T3.Location FROM party_host AS T1 JOIN host AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE TRY_CAST(T2.Age AS INT) > 50;
What are the names and flags of ships that do not have a captain with the rank of Midshipman? Schema: - Ship(Built_Year, COUNT, Class, Flag, Name, Type) - captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l)
SELECT Name, Flag FROM Ship WHERE Ship_ID NOT IN (SELECT Ship_ID FROM captain WHERE "Rank" = 'Midshipman');
what is the tallest mountain in the united states? Schema: - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT mountain_name FROM mountain WHERE mountain_altitude = (SELECT MAX(mountain_altitude) FROM mountain);
What are the names of all departments in alphabetical order? Schema: - DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
SELECT DEPT_NAME FROM DEPARTMENT ORDER BY DEPT_NAME ASC NULLS LAST;
How many courses are there? Schema: - Courses(course_description, course_name)
SELECT COUNT(*) AS num_courses FROM Courses;
population of boulder? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT population FROM city WHERE city_name = 'boulder';
Find the name of each user and number of tweets tweeted by each of them.? Schema: - user_profiles(email, followers, name, partitionid) - tweets(I, tweet_text, uid)
SELECT T1.name, COUNT(*) AS num_tweets FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid, T1.name;
What is the paper about convolution from brian curless ? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - writes(...) - author(...)
SELECT DISTINCT T1.authorId, T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T5 ON T2.keyphraseId = T5.keyphraseId JOIN paper AS T3 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 = 'brian curless' AND T5.keyphraseName = 'convolution';
How many kids stay in the room DAMIEN TRACHSEL checked in on Sep 21, 2010? Schema: - Reservations(Adults, CheckIn, FirstName, Kids, LastName)
SELECT Kids FROM Reservations WHERE CheckIn = '2010-09-21' AND FirstName = 'DAMIEN' AND LastName = 'TRACHSEL';
Show the names of companies and the number of employees they have? Schema: - employment(...) - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) - company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more))
SELECT T3.Name, COUNT(*) AS num_employees FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID GROUP BY T3.Name;
What is the description of the role named "Proof Reader"? Schema: - Roles(Role_Code, Role_Description, Role_Name, role_code, role_description)
SELECT Role_Description FROM Roles WHERE Role_Name = 'Proof Reader';
How many tracks are in each genre? Schema: - genres(name) - tracks(composer, milliseconds, name, unit_price)
SELECT COUNT(*) AS num_tracks, T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name;
Find the names of the top 3 departments that provide the largest amount of courses? Schema: - course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
SELECT dept_name FROM course WHERE dept_name IS NOT NULL GROUP BY dept_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 3;
Show ids of all students who do not have any friends.? Schema: - Highschooler(COUNT, ID, grade, name) - Friend(student_id)
SELECT ID FROM Highschooler WHERE ID NOT IN (SELECT student_id FROM Friend);
Find the names of all wines produced in 2008.? Schema: - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
SELECT Name FROM wine WHERE "Year" = '2008';
what is the smallest state in the usa? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT state_name FROM state WHERE area = (SELECT MIN(area) FROM state);
What are the naems of all the projects, and how many scientists were assigned to each of them? Schema: - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) - AssignedTo(Scientist)
SELECT COUNT(*) AS num_scientists, T1.Name FROM Projects AS T1 JOIN AssignedTo AS T2 ON T1.Code = T2.Project GROUP BY T1.Name;
What are the descriptions of all the project outcomes? Schema: - Research_Outcomes(...) - Project_Outcomes(outcome_code)
SELECT T1.outcome_description FROM Research_Outcomes AS T1 JOIN Project_Outcomes AS T2 ON T1.outcome_code = T2.outcome_code;
Find the names of programs that are never broadcasted in the morning.? Schema: - program(Beij, Launch, Name, Origin, Owner) - broadcast(Program_ID, Time_of_day)
SELECT DISTINCT Name FROM program WHERE Name NOT IN (SELECT T1.Name FROM program AS T1 JOIN broadcast AS T2 ON T1.Program_ID = T2.Program_ID WHERE T2.Time_of_day = 'Morning');
What is the customer first, last name and id with least number of accounts.? Schema: - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) - 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 T2.customer_first_name, T2.customer_last_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id, T2.customer_first_name, T2.customer_last_name ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
What is the name and distance of every aircraft that can cover a distance of more than 5000 and which at least 5 people can fly? Schema: - certificate(eid) - aircraft(Description, aid, d, distance, name)
SELECT T2.name FROM certificate AS T1 JOIN aircraft AS T2 ON T2.aid = T1.aid WHERE T2.distance > 5000 GROUP BY T1.aid, T2.name HAVING COUNT(*) >= 5;
How many songs have a lead vocal? Schema: - Vocals(COUNT, Type) - Songs(Title)
SELECT COUNT(DISTINCT Title) AS num_songs FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Type = 'lead';
What are the first names of students, ordered by age from greatest to least? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT Fname FROM Student ORDER BY Age DESC NULLS LAST;
Find names and times of trains that run through stations for the local authority Chiltern.? Schema: - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) - route(...) - train(Name, Service, Time, destination, name, origin, time, train_number)
SELECT T3.name, T3."time" FROM station AS T1 JOIN route AS T2 ON T1.id = T2.station_id JOIN train AS T3 ON T2.train_id = T3.id WHERE T1.local_authority = 'Chiltern';
Find the names of all instructors whose salary is greater than the salary of all instructors in the Biology department.? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT name FROM instructor WHERE salary > (SELECT MAX(salary) FROM instructor WHERE dept_name = 'Biology');
What are the last names of the teachers who teach the student called GELL TAMI? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName) - teachers(Classroom, FirstName, LastName)
SELECT T2.LastName FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T1.FirstName = 'GELL' AND T1.LastName = 'TAMI';
What is all the customer information for customers in NY state? Schema: - Customer(Email, FirstName, LastName, State, lu)
SELECT * FROM Customer WHERE State = 'NY';
Count the number of schools.? Schema: - School(County, Enrollment, Location, Mascot, School_name)
SELECT COUNT(*) AS num_schools FROM School;
what is the most populous state through which the mississippi runs? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT state_name FROM state WHERE population = (SELECT MAX(population) FROM state WHERE state_name IN (SELECT traverse FROM river WHERE river_name = 'mississippi')) AND state_name IN (SELECT traverse FROM river WHERE river_name = 'mississippi');
What are the id, role, and first name of the professionals who have performed two or more treatments? 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 T1.professional_id, T1.role_code, T1.first_name FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id, T1.role_code, T1.first_name HAVING COUNT(*) >= 2;
Find the districts in which there are both shops selling less than 3000 products and shops selling more than 10000 products.? Schema: - shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more))
SELECT DISTINCT T1.District FROM shop AS T1 JOIN shop AS T2 ON T1.District = T2.District WHERE T1.Number_products < 3000 AND T2.Number_products > 10000;
Show all the locations with at least two cinemas 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(*) >= 2;
What is the name and address of the department with the most students? Schema: - STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE) - DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
SELECT T2.DEPT_NAME, T2.DEPT_ADDRESS FROM STUDENT AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.DEPT_CODE, T2.DEPT_NAME, T2.DEPT_ADDRESS ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Report the total number of students for each fourth-grade classroom.? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName)
SELECT Classroom, COUNT(*) AS num_students FROM list WHERE Grade = '4' GROUP BY Classroom;
How many airlines operate out of each country in descending order? Schema: - airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
SELECT country, COUNT(*) AS num_airlines FROM airlines WHERE country IS NOT NULL GROUP BY country ORDER BY num_airlines DESC NULLS LAST;
What are the names of products that have never been 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 product_name FROM Products LEFT JOIN Order_Items ON Products.product_id = Order_Items.product_id WHERE Order_Items.product_id IS NULL;
What are the names of representatives and the dates of elections they participated in.? Schema: - election(Committee, Date, Delegate, District, Vote_Percent, Votes) - representative(JO, Lifespan, Name, Party, State, T1)
SELECT T2.Name, T1."Date" FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID;
Given the titles of all courses, in order of titles and credits.? Schema: - course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
SELECT title FROM course ORDER BY title, credits ASC NULLS LAST;
how many papers are published in sigir ? Schema: - venue(venueId, venueName) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT COUNT(T1.paperId) AS num_papers FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T2.venueName = 'sigir';
Find the name of the most popular party form.? Schema: - Forms(form_type_code) - Party_Forms(...)
SELECT T1.form_name FROM Forms AS T1 JOIN Party_Forms AS T2 ON T1.form_id = T2.form_id GROUP BY T2.form_id, T1.form_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
How many Bars in " Dallas " have a rating above 3.5 ? Schema: - category(...) - business(business_id, city, full_address, name, rating, review_count, state)
SELECT COUNT(DISTINCT T1.name) AS num_bars FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T1.city = 'Dallas' AND T1.rating > 3.5 AND T2.category_name = 'Bars';
What are the ids of every student who has never attended a course? Schema: - Students(cell_mobile_number, current_address_id, date_first_registered, date_left, date_of_latest_logon, email_address, family_name, first_name, last_name, login_name, middle_name, other_student_details, ... (1 more)) - Student_Course_Attendance(course_id, date_of_attendance, student_id)
SELECT student_id FROM Students WHERE student_id NOT IN (SELECT student_id FROM Student_Course_Attendance);
What is the name of all tracks in the album named Balls to the Wall? Schema: - albums(I, title) - tracks(composer, milliseconds, name, unit_price)
SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.title = 'Balls to the Wall';
Count the number of markets that have a number of cities lower than 300.? Schema: - market(Country, Number_cities)
SELECT COUNT(*) AS num_markets FROM market WHERE Number_cities < 300;
Show names for artists without any exhibition.? Schema: - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) - exhibition(Theme, Ticket_Price, Year)
SELECT Name FROM artist WHERE Artist_ID NOT IN (SELECT Artist_ID FROM exhibition);
What is the name of the shipping agent of the document with id 2? Schema: - Ref_Shipping_Agents(shipping_agent_code, shipping_agent_name) - 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 Ref_Shipping_Agents.shipping_agent_name FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Documents.document_id = 2;
List the names of all distinct nurses ordered by alphabetical order? Schema: - Nurse(Name)
SELECT DISTINCT Name FROM Nurse ORDER BY Name ASC NULLS LAST;
find the name and age of the pilot who has won the most number of times among the pilots who are younger than 30.? Schema: - pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team) - match_(Competition, Date, Match_ID, Venue)
SELECT T1.Name, T1.Age FROM pilot AS T1 JOIN match_ AS T2 ON T1.Pilot_Id = T2.Winning_Pilot WHERE T1.Age < 30 GROUP BY T1.Pilot_Id, T1.Name, T1.Age ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Return the channel code and contact number of the customer contact channel whose active duration was the longest.? Schema: - Customer_Contact_Channels(DATEDIFF, DAY, active_from_date, active_to_date, channel_code, contact_number, diff)
SELECT channel_code, contact_number FROM Customer_Contact_Channels WHERE DATEDIFF(DAY, active_from_date, active_to_date) = (SELECT DATEDIFF(DAY, active_from_date, active_to_date) FROM Customer_Contact_Channels ORDER BY DATEDIFF(DAY, active_from_date, active_to_date) DESC NULLS LAST LIMIT 1);
Find the email and phone number of the customers who have never filed a complaint before.? 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)) - Complaints(complaint_status_code, complaint_type_code)
SELECT email_address, phone_number FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Complaints);
What are the ids of the candidates that have an outcome code of Pass? Schema: - Candidate_Assessments(asessment_outcome_code, assessment_date, candidate_id)
SELECT candidate_id FROM Candidate_Assessments WHERE asessment_outcome_code = 'Pass';
Find name of the project that needs the least amount of time to finish and the name of scientists who worked on it.? Schema: - AssignedTo(Scientist) - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) - Scientists(Name)
SELECT T2.Name, T3.Name FROM AssignedTo AS T1 JOIN Projects AS T2 ON T1.Project = T2.Code JOIN Scientists AS T3 ON T1.Scientist = T3.SSN WHERE T2.Hours = (SELECT MIN(Hours) FROM Projects);
What papers talk about 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 investors of entrepreneurs and the corresponding number of entrepreneurs invested by each investor? Schema: - entrepreneur(COUNT, Company, Investor, Money_Requested)
SELECT Investor, COUNT(*) AS num_entrepreneurs FROM entrepreneur GROUP BY Investor;
Find papers whose second author has last name "Turon" and is affiliated with an institution in the country "USA".? Schema: - Authors(fname, lname) - Authorship(...) - Papers(title) - Inst(...)
SELECT T3.title FROM Authors AS T1 JOIN Authorship AS T2 ON T1.authID = T2.authID JOIN Papers AS T3 ON T2.paperID = T3.paperID JOIN Inst AS T4 ON T2.instID = T4.instID WHERE T4.country = 'USA' AND T2.authOrder = 2 AND T1.lname = 'Turon';
List the date the claim was made, the date it was settled and the amount settled for all the claims which had exactly one settlement.? 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, T1.Date_Claim_Settled FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID GROUP BY T1.Claim_ID, T1.Date_Claim_Made, T1.Date_Claim_Settled HAVING COUNT(*) = 1;
how long is the longest river in the usa? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT LENGTH FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river);
What are the names for all aircrafts with at least 2 flights? Schema: - flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) - aircraft(Description, aid, d, distance, name)
SELECT T2.name FROM flight AS T1 JOIN aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid, T2.name HAVING COUNT(*) >= 2;
Find the country of all appelations who have at most three wines.? Schema: - appellations(Area, County) - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
SELECT T1.County FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation, T1.County HAVING COUNT(*) <= 3;
Find the names of the courses that have just one student enrollment.? Schema: - Courses(course_description, course_name) - Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id)
SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) = 1;
Return the name and max speed of the storm that affected the most regions.? Schema: - storm(Damage_millions_USD, Dates_active, Name, Number_Deaths) - affected_region(Region_id)
SELECT T1.Name, T1.Max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.Storm_ID = T2.Storm_ID GROUP BY T1.Storm_ID, T1.Name, T1.Max_speed ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What campus had more than 400 total enrollment but more than 200 full time enrollment in year 1956? Schema: - Campuses(Campus, County, Franc, Location) - enrollments(...)
SELECT T1.Campus FROM Campuses AS T1 JOIN enrollments AS T2 ON T1.Id = T2.Campus WHERE T2."Year" = 1956 AND TotalEnrollment_AY > 400 AND FTE_AY > 200;
Find the id of instructors who taught a class in Fall 2009 but not in Spring 2010.? Schema: - teaches(ID, Spr, semester)
SELECT ID FROM teaches WHERE semester = 'Fall' AND "year" = 2009 AND ID NOT IN (SELECT ID FROM teaches WHERE semester = 'Spring' AND "year" = 2010);
List the names of 5 users followed by the largest number of other users.? Schema: - user_profiles(email, followers, name, partitionid)
SELECT name FROM user_profiles ORDER BY followers DESC NULLS LAST LIMIT 5;
papers typically cited by parsing papers? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - cite(...)
SELECT DISTINCT T4.citedPaperId 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.citingPaperId WHERE T1.keyphraseName = 'parsing';
How many courses in total are listed? Schema: - Courses(course_description, course_name)
SELECT COUNT(*) AS num_courses FROM Courses;