question
stringlengths
43
589
query
stringlengths
19
598
List the themes of parties in ascending order of number of hosts.? Schema: - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT Party_Theme FROM party ORDER BY Number_of_hosts ASC NULLS LAST;
Who has coauthored with Noah A Smith ? 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';
What is the number of the cars with horsepower more than 150? Schema: - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT COUNT(*) AS num_cars FROM cars_data WHERE Horsepower > 150;
What is the id of the product that is booked for 3 times? Schema: - Products_Booked(booked_count, product_id)
SELECT product_id FROM Products_Booked WHERE product_id IS NOT NULL GROUP BY product_id HAVING COUNT(*) = 3;
Show different tourist attractions' names, ids, and the corresponding number of visits.? Schema: - Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more)) - Visits(Visit_Date)
SELECT T1.Name, T2.Tourist_Attraction_ID, COUNT(*) AS num_visits FROM Tourist_Attractions AS T1 JOIN Visits AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID, T1.Name;
How many papers were written on Multiuser Receiver in the Decision Feedback this year ? 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 = 'Multiuser Receiver in the Decision Feedback' AND T3."year" = 2016 GROUP BY T3.paperId HAVING COUNT(DISTINCT T1.keyphraseName) > 1;
What are the names of the singers who are not French citizens? Schema: - singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
SELECT Name FROM singer WHERE Citizenship != 'France';
Sort the apartment numbers in ascending order of room count.? Schema: - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT apt_number FROM Apartments ORDER BY room_count ASC NULLS LAST;
What is the school code of the accounting department? Schema: - DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
SELECT SCHOOL_CODE FROM DEPARTMENT WHERE DEPT_NAME = 'Accounting';
how many cities are there in us? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT COUNT(city_name) AS num_cities FROM city WHERE country_name = 'united states';
Find the first names of faculties of rank Professor in alphabetic order.? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
SELECT Fname FROM Faculty WHERE "Rank" = 'Professor' ORDER BY Fname ASC NULLS LAST;
For the airline ids with the top 10 most routes operated, what are their names? Schema: - airlines(Abbreviation, Airline, COUNT, Country, active, country, name) - routes(...)
SELECT T1.name, T2.alid FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.name, T2.alid ORDER BY COUNT(*) DESC NULLS LAST LIMIT 10;
Which classes have more than two captains? Schema: - captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l)
SELECT Class FROM captain WHERE Class IS NOT NULL GROUP BY Class HAVING COUNT(*) > 2;
What is the first name, gpa and phone number of the top 5 students with highest gpa? Schema: - STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
SELECT STU_GPA, STU_PHONE, STU_FNAME FROM STUDENT ORDER BY STU_GPA DESC NULLS LAST LIMIT 5;
What is the total number of all football games played by scholarship students? Schema: - SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
SELECT SUM(GamesPlayed) AS num_games FROM SportsInfo WHERE SportName = 'Football' AND OnScholarship = 'Y';
Find all movies written by " Matt Damon "? Schema: - written_by(...) - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) - writer(...)
SELECT T1.title FROM written_by AS T3 JOIN movie AS T1 ON T3.msid = T1.mid JOIN writer AS T2 ON T3.wid = T2.wid WHERE T2.name = 'Matt Damon';
what states are next to kentucky? Schema: - border_info(T1, border, state_name)
SELECT border FROM border_info WHERE state_name = 'kentucky';
What is the vocal type of the band mate whose first name is "Marianne" played the most? Schema: - Vocals(COUNT, Type) - Band(...)
SELECT Type FROM Vocals AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id WHERE Firstname = 'Marianne' AND Type IS NOT NULL GROUP BY Type ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the details for statements with the details 'Private Project', and what are the names of the corresponding documents? Schema: - Statements(Statement_Details, Statement_ID) - 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 T1.Statement_Details, T2.Document_Name FROM Statements AS T1 JOIN Documents AS T2 ON T1.Statement_ID = T2.Document_ID WHERE T1.Statement_Details = 'Private Project';
Find the pixels of the screen modes that are used by both phones with full accreditation types and phones with Provisional accreditation types.? Schema: - screen_mode(used_kb) - phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode)
SELECT DISTINCT T3.Pixels FROM (SELECT T1.Pixels FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T2.Accreditation_type = 'Provisional') AS T3 JOIN (SELECT T1.Pixels FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T2.Accreditation_type = 'Full') AS T4 ON T3.Pixels = T4.Pixels;
Which students in third grade are not taught by teacher COVIN JEROME? Give me the last names of the students.? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName) - teachers(Classroom, FirstName, LastName)
SELECT DISTINCT T1.LastName FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T1.Grade = 3 AND T2.FirstName != 'COVIN' AND T2.LastName != 'JEROME';
How many cities have a stadium that was opened before the year of 2006? Schema: - stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
SELECT COUNT(DISTINCT City) AS num_cities FROM stadium WHERE Opening_year < 2006;
Return the party email that has used party services the greatest number of times.? Schema: - Parties(party_email, party_phone, payment_method_code) - Party_Services(...)
SELECT T1.party_email FROM Parties AS T1 JOIN Party_Services AS T2 ON T1.party_id = T2.customer_id GROUP BY T1.party_email ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Show the musical nominee with award "Tony Award" or "Cleavant Derricks".? Schema: - musical(Award, COUNT, Name, Nom, Nominee, Result, T1)
SELECT Nominee FROM musical WHERE Award = 'Tony Award' OR Award = 'Cleavant Derricks';
Show the ministers and the time they took and left office, listed by the time they left office.? Schema: - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT Minister, Took_office, Left_office FROM party ORDER BY Left_office ASC NULLS LAST;
What are the name and payment method of customers who have both mailshots in 'Order' outcome and mailshots in 'No Response' outcome.? Schema: - Mailshot_Customers(outcome_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 DISTINCT T2.customer_name, T2.payment_method FROM Mailshot_Customers AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id JOIN Mailshot_Customers AS T3 ON T2.customer_id = T3.customer_id WHERE (T1.outcome_code = 'Order' AND T3.outcome_code = 'No Response') OR (T1.outcome_code = 'No Response' AND T3.outcome_code = 'Order');
What is the maximum number that a certain service is provided? List the service id, details and number.? Schema: - Services(Service_Type_Code, Service_name) - Residents_Services(...)
SELECT T1.service_id, T1.service_details, COUNT(*) AS num_residents FROM Services AS T1 JOIN Residents_Services AS T2 ON T1.service_id = T2.service_id GROUP BY T1.service_id, T1.service_details ORDER BY num_residents DESC NULLS LAST LIMIT 1;
Which city is the headquarter of the store named "Blackville" in? Schema: - store(Type) - store_district(...) - district(City_Area, City_Population, District_name, d)
SELECT T3.Headquartered_City FROM store AS T1 JOIN store_district AS T2 ON T1.Store_ID = T2.Store_ID JOIN district AS T3 ON T2.District_ID = T3.District_ID WHERE T1.Store_Name = 'Blackville';
How many distinct colleges are associated with players from the team with name "Columbus Crew".? Schema: - match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team) - team(Name)
SELECT COUNT(DISTINCT T1.College) AS num_colleges FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = 'Columbus Crew';
How many branches where have more than average number of memberships are there? Schema: - branch(Address_road, City, Name, Open_year, membership_amount)
SELECT COUNT(*) AS num_branches FROM branch WHERE membership_amount > (SELECT AVG(membership_amount) FROM branch);
Give me the detail and opening hour for each museum.? Schema: - Museums(...) - 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 T1.Museum_Details, T2.Opening_Hours FROM Museums AS T1 JOIN Tourist_Attractions AS T2 ON T1.Museum_ID = T2.Tourist_Attraction_ID;
return me the number of papers in PVLDB in " University of Michigan " .? Schema: - organization(continent, homepage, name) - author(...) - writes(...) - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - journal(Theme, homepage, name)
SELECT COUNT(DISTINCT T5.title) AS num_papers FROM organization AS T2 JOIN author AS T1 ON T2.oid = T1.oid JOIN writes AS T4 ON T4.aid = T1.aid JOIN publication AS T5 ON T4.pid = T5.pid JOIN journal AS T3 ON T5.jid = T3.jid WHERE T3.name = 'PVLDB' AND T2.name = 'University of Michigan';
Find the name, class and rank of all captains.? Schema: - captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l)
SELECT Name, Class, "Rank" FROM captain;
Find out the send dates of the documents with the grant amount of more than 5000 were granted by organisation type described? 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)) - Grants(grant_amount, organisation_id) - Organisations(...) - Organisation_Types(...)
SELECT T1.sent_date FROM Documents AS T1 JOIN Grants AS T2 ON T1.grant_id = T2.grant_id JOIN Organisations AS T3 ON T2.organisation_id = T3.organisation_id JOIN Organisation_Types AS T4 ON T3.organisation_type = T4.organisation_type WHERE T2.grant_amount > 5000 AND T4.organisation_type_description = 'Research';
popular topics at NIPS 2015? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - venue(venueId, venueName)
SELECT DISTINCT COUNT(T3.paperId) AS num_papers, T1.keyphraseId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T3."year" = 2015 AND T4.venueName = 'NIPS' GROUP BY T1.keyphraseId ORDER BY num_papers DESC NULLS LAST;
what is the length of the rio grande river? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT LENGTH FROM river WHERE river_name = 'rio grande';
Find the order detail for the products with price above 2000.? Schema: - Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT T1.Other_Item_Details FROM Order_Items AS T1 JOIN Products AS T2 ON CAST(T1.Product_ID AS TEXT) = T2.Product_ID WHERE T2.Product_Price > 2000;
What are id and name of the products whose price is lower than 600 or higher than 900? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT product_id, product_name FROM Products WHERE product_price < 600 OR product_price > 900;
Show all advisors who have at least two students.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT Advisor FROM Student WHERE Advisor IS NOT NULL GROUP BY Advisor HAVING COUNT(*) >= 2;
how high is the highest point in the largest state? 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 T2.highest_elevation FROM highlow AS T2 JOIN state AS T1 ON T1.state_name = T2.state_name WHERE T1.area = (SELECT MAX(area) FROM state);
How many different instruments are used in the song "Badlands"? Schema: - Instruments(COUNT, Instrument) - Songs(Title)
SELECT COUNT(DISTINCT Instrument) AS num_instruments FROM Instruments AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Title = 'Badlands';
What are the dates of the orders made by the customer named "Jeramie"? 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)) - Orders(customer_id, date_order_placed, order_id)
SELECT T2.date_order_placed FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = 'Jeramie';
Give the distinct department ids of departments in which a manager is in charge of 4 or more 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 DISTINCT DEPARTMENT_ID FROM employees WHERE DEPARTMENT_ID IS NOT NULL AND MANAGER_ID IS NOT NULL GROUP BY DEPARTMENT_ID, MANAGER_ID HAVING COUNT(EMPLOYEE_ID) >= 4;
What is the date of birth for the staff member named Janessa Sawayn? Schema: - 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 date_of_birth FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn';
Find the number of rooms for different block code? Schema: - Block(...) - Room(BlockCode, RoomType, Unavailable)
SELECT COUNT(*) AS num_rooms, T1.BlockCode FROM Block AS T1 JOIN Room AS T2 ON T1.BlockFloor = T2.BlockFloor AND T1.BlockCode = T2.BlockCode GROUP BY T1.BlockCode;
Return the age of the person with the greatest height.? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
SELECT Age FROM people ORDER BY Height DESC NULLS LAST LIMIT 1;
How many different card types are there? Schema: - Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to)
SELECT COUNT(DISTINCT card_type_code) AS num_card_types FROM Customers_Cards;
What are the crime rates of counties that contain cities that have white percentages of over 90? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) - county_public_safety(COUNT, Case_burden, Crime_rate, Location, Name, Police_force, Police_officers, Population, T1)
SELECT T2.Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID WHERE T1.White > 90;
What are the names of the stations which serve both "Ananthapuri Express" and "Guruvayur Express" trains? Schema: - train_station(...) - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) - train(Name, Service, Time, destination, name, origin, time, train_number)
SELECT T2.Name FROM train_station AS T1 JOIN station AS T2 ON T1.Station_ID = T2.Station_ID JOIN train AS T3 ON T3.Train_ID = T1.Train_ID WHERE T3.Name = 'Ananthapuri Express' AND T2.Name IN (SELECT T2.Name FROM train_station AS T1 JOIN station AS T2 ON T1.Station_ID = T2.Station_ID JOIN train AS T3 ON T3.Train_ID = T1.Train_ID WHERE T3.Name = 'Guruvayur Express');
Show the names of the three most recent festivals.? Schema: - festival_detail(Chair_Name, Festival_Name, Location, T1, Year)
SELECT Festival_Name FROM festival_detail ORDER BY "Year" DESC NULLS LAST LIMIT 3;
What is the average number of hosts for parties? Schema: - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT AVG(Number_of_hosts) AS avg_number_of_hosts FROM party;
List the name of the shop with the latest open year.? Schema: - shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more))
SELECT Shop_Name FROM shop ORDER BY Open_Year DESC NULLS LAST LIMIT 1;
What are the cities that have a branch that opened in 2001 and a branch with more than 100 members? Schema: - branch(Address_road, City, Name, Open_year, membership_amount)
SELECT City FROM branch WHERE Open_year = 2001 AND membership_amount > 100;
What is the zip code of the address where the teacher with first name "Lyla" lives? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) - Teachers(email_address, first_name, gender, last_name)
SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'Lyla';
Find the first names of all instructors who have taught some course and the course description.? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) - EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) - COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE)
SELECT T2.EMP_FNAME, T3.CRS_DESCRIPTION FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE;
Find the title, credit, and department name of courses that have more than one prerequisites? Schema: - course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) - prereq(...)
SELECT T1.title, T1.credits, T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id, T1.title, T1.credits, T1.dept_name HAVING COUNT(*) > 1;
How many users are there? Schema: - useracct(...)
SELECT COUNT(*) AS num_users FROM useracct;
What are the full names of the 3 instructors who teach the most courses? Schema: - Course(CName, Credits, Days) - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
SELECT T2.Fname, T2.LName FROM Course AS T1 JOIN Faculty AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor, T2.Fname, T2.LName ORDER BY COUNT(*) DESC NULLS LAST LIMIT 3;
Find the average order quantity per order.? Schema: - Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
SELECT AVG(TRY_CAST(order_quantity AS DOUBLE)) AS avg_order_quantity FROM Order_Items;
What are the first names, office locations, and departments of all instructors, and also what are the descriptions of the courses they teach? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) - EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) - COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE) - PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) - DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
SELECT T2.EMP_FNAME, T4.PROF_OFFICE, T3.CRS_DESCRIPTION, T5.DEPT_NAME FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM JOIN DEPARTMENT AS T5 ON T4.DEPT_CODE = T5.DEPT_CODE;
Show the names of people who have been on the negative side of debates at least twice.? Schema: - debate_people(...) - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
SELECT T2.Name FROM debate_people AS T1 JOIN people AS T2 ON T1.Negative = T2.People_ID GROUP BY T2.Name HAVING COUNT(*) >= 2;
What are the names of customers with checking balances lower than the average checking balance? Schema: - ACCOUNTS(name) - CHECKING(balance)
SELECT T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT AVG(balance) FROM CHECKING);
What is first names of the top 5 staff who have handled the greatest number of complaints? Schema: - Staff(COUNT, Name, Other_Details, date_joined_staff, date_left_staff, date_of_birth, email_address, first_name, gender, last_name, middle_name, nickname) - Complaints(complaint_status_code, complaint_type_code)
SELECT T1.first_name FROM Staff AS T1 JOIN Complaints AS T2 ON T1.staff_id = T2.staff_id GROUP BY T2.staff_id, T1.first_name ORDER BY COUNT(*) ASC NULLS LAST LIMIT 5;
What is the city_code of the city that the most students live in? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT city_code FROM Student WHERE city_code IS NOT NULL GROUP BY city_code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
For each distinct test result, find the number of students who got the result.? Schema: - Student_Tests_Taken(date_test_taken, test_result)
SELECT test_result, COUNT(*) AS num_students FROM Student_Tests_Taken WHERE test_result IS NOT NULL GROUP BY test_result ORDER BY num_students DESC NULLS LAST;
When was the last transcript released? Schema: - Transcripts(other_details, transcript_date)
SELECT transcript_date FROM Transcripts ORDER BY transcript_date DESC NULLS LAST LIMIT 1;
Find the number of routes whose destination airports are in Canada.? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) - routes(...)
SELECT COUNT(*) AS num_routes FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE country = 'Canada';
For each election cycle, report the number of voting records.? Schema: - Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote)
SELECT Election_Cycle, COUNT(*) AS num_voting_records FROM Voting_record GROUP BY Election_Cycle;
What is the last name of the musician that have produced the most songs? Schema: - Performance(...) - Band(...) - Songs(Title)
SELECT T2.Lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE Lastname IS NOT NULL GROUP BY Lastname ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Find the number of airports whose name contain the word 'International'.? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT COUNT(*) AS num_airports FROM airports WHERE name LIKE '%International%';
Give the different reigns of wrestlers who are not located in Tokyo, Japan.? Schema: - wrestler(COUNT, Days_held, Location, Name, Reign)
SELECT DISTINCT Reign FROM wrestler WHERE Location != 'Tokyo, Japan';
Find names of the document without any images.? 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)) - Document_Sections(...) - Document_Sections_Images(...)
SELECT document_name FROM Documents WHERE document_name NOT IN (SELECT T1.document_name FROM Documents AS T1 JOIN Document_Sections AS T2 ON T1.document_code = T2.document_code JOIN Document_Sections_Images AS T3 ON T2.section_id = T3.section_id);
What is the name of the movie produced after 2000 and directed by James Cameron? Schema: - Movie(T1, director, title, year)
SELECT title FROM Movie WHERE director = 'James Cameron' AND "year" > 2000;
How many drivers are there? Schema: - driver(Age, Home_city, Name, Party)
SELECT COUNT(*) AS num_drivers FROM driver;
What instrument did the musician with last name "Heilo" use in the song "Le Pop"? Schema: - Performance(...) - Band(...) - Songs(Title) - Instruments(COUNT, Instrument)
SELECT T4.Instrument FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id JOIN Songs AS T3 ON T3.SongId = T1.SongId JOIN Instruments AS T4 ON T4.SongId = T3.SongId AND T4.BandmateId = T2.Id WHERE T2.Lastname = 'Heilo' AND T3.Title = 'Le Pop';
What are the ids of the stations in San Francisco that normally have more than 10 bikes available? Schema: - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) - status(...)
SELECT DISTINCT id FROM (SELECT id FROM station WHERE city = 'San Francisco') T1, (SELECT station_id FROM status WHERE station_id IS NOT NULL GROUP BY station_id HAVING AVG(bikes_available) > 10) AS T2 WHERE T1.id = T2.station_id;
Find all the female actors born in " New York City " after 1980? Schema: - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
SELECT name FROM actor WHERE birth_city = 'New York City' AND birth_year > 1980 AND gender = 'female';
How many cars have a larger accelerate than the car with the largest horsepower? Schema: - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT COUNT(*) AS num_cars FROM cars_data WHERE Accelerate > (SELECT Accelerate FROM cars_data ORDER BY Horsepower DESC NULLS LAST LIMIT 1);
List all businesses with rating 3.5? Schema: - business(business_id, city, full_address, name, rating, review_count, state)
SELECT name FROM business WHERE rating = 3.5;
display the full name (first and last), hire date, salary, and department number for those employees whose first name does not containing the letter M.? Schema: - employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more))
SELECT FIRST_NAME, LAST_NAME, HIRE_DATE, SALARY, DEPARTMENT_ID FROM employees WHERE FIRST_NAME NOT LIKE '%M%';
Return the maximum number of points for climbers from the United Kingdom.? Schema: - climber(Country, K, Name, Points)
SELECT MAX(Points) AS max_points FROM climber WHERE Country = 'United Kingdom';
Give the different hometowns of gymnasts that have a total point score of above 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;
Show all cities and corresponding number of students.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT city_code, COUNT(*) AS num_students FROM Student GROUP BY city_code;
return me the number of keywords in VLDB conference .? Schema: - publication_keyword(...) - keyword(keyword) - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - conference(homepage, name)
SELECT COUNT(DISTINCT T1.keyword) AS num_keywords FROM publication_keyword AS T4 JOIN keyword AS T1 ON T4.kid = T1.kid JOIN publication AS T3 ON T3.pid = T4.pid JOIN conference AS T2 ON T3.cid = CAST(T2.cid AS TEXT) WHERE T2.name = 'VLDB';
What are the first names and support rep ids for employees serving 10 or more customers? Schema: - Customer(Email, FirstName, LastName, State, lu) - Employee(BirthDate, City, FirstName, LastName, Phone)
SELECT T1.FirstName, T1.SupportRepId FROM Customer AS T1 JOIN Employee AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.FirstName, T1.SupportRepId HAVING COUNT(*) >= 10;
List the types of competition and the number of competitions of each type.? Schema: - competition(COUNT, Competition_type, Country, T1, Year)
SELECT Competition_type, COUNT(*) AS num_competitions FROM competition GROUP BY Competition_type;
Tell me the types of the policy used by the customer named "Dayana Robel".? 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)) - Customers_Policies(...) - Available_Policies(COUNT, Customer_Phone, Life, policy_type_code)
SELECT DISTINCT T3.policy_type_code FROM Customers AS T1 JOIN Customers_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID JOIN Available_Policies AS T3 ON T2.Policy_ID = T3.Policy_ID WHERE T1.Customer_name = 'Dayana Robel';
What is the card type code with most number of cards? Schema: - Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to)
SELECT card_type_code FROM Customers_Cards WHERE card_type_code IS NOT NULL GROUP BY card_type_code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Show the names of journalists and the names of the events they reported in ascending order? Schema: - news_report(...) - event(Date, Event_Attendance, Name, Venue, Year) - journalist(Age, COUNT, Name, Nationality, T1, Years_working)
SELECT T3.Name, T2.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID ORDER BY T2.Event_Attendance ASC NULLS LAST;
How many dogs have not gone through any treatment? Schema: - Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight) - Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id)
SELECT COUNT(*) AS num_dogs FROM Dogs WHERE dog_id NOT IN (SELECT dog_id FROM Treatments);
Find the distinct unit prices for tracks.? Schema: - Track(Milliseconds, Name, UnitPrice)
SELECT DISTINCT UnitPrice FROM Track;
What is the pixel aspect ratio and country of origin for all TV channels that do not use English? Schema: - TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name)
SELECT Pixel_aspect_ratio_PAR, Country FROM TV_Channel WHERE "Language" != 'English';
what is the largest city of wyoming? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT city_name FROM city WHERE population = (SELECT MAX(population) FROM city WHERE state_name = 'wyoming') AND state_name = 'wyoming';
which is the highest peak not in alaska? 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 WHERE state_name != 'alaska');
What is the name of the customer who has made the minimum amount of payment in one claim? Schema: - Claim_Headers(Amount_Piad) - Policies(COUNT, Policy_Type_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 T3.Customer_Details FROM Claim_Headers AS T1 JOIN Policies AS T2 ON T1.Policy_ID = T2.Policy_ID JOIN Customers AS T3 ON T2.Customer_ID = T3.Customer_ID WHERE T1.Amount_Piad = (SELECT MIN(Amount_Piad) FROM Claim_Headers);
In which distinct years was the governor "Eliot Spitzer"? Schema: - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT DISTINCT "Year" FROM party WHERE Governor = 'Eliot Spitzer';
What are the different cities listed? Schema: - Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue)
SELECT DISTINCT Headquarter FROM Manufacturers;
For each product with some problems, list the count of problems and the product id.? Schema: - Problems(date_problem_reported, problem_id) - Product(product_id, product_name)
SELECT COUNT(*) AS num_problems, T2.product_id FROM Problems AS T1 JOIN Product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_id;
What are the name and publication date of the catalogs with catalog level number above 5? Schema: - Catalogs(COUNT, catalog_publisher, date_of_latest_revision) - Catalog_Structure(catalog_level_name, catalog_level_number)
SELECT T1.catalog_name, T1.date_of_publication FROM Catalogs AS T1 JOIN Catalog_Structure AS T2 ON T1.catalog_id = T2.catalog_id WHERE catalog_level_number > 5;
WebKB papers? Schema: - paperDataset(...) - dataset(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.paperId FROM paperDataset AS T2 JOIN dataset AS T1 ON T2.datasetId = T1.datasetId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.datasetName = 'WebKB';