question
stringlengths
43
589
query
stringlengths
19
598
What are the first names of all students in course ACCT-211? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) - ENROLL(...) - STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
SELECT T3.STU_FNAME FROM CLASS AS T1 JOIN ENROLL AS T2 ON T1.CLASS_CODE = T2.CLASS_CODE JOIN STUDENT AS T3 ON T2.STU_NUM = T3.STU_NUM WHERE T1.CRS_CODE = 'ACCT-211';
Which skill is used in fixing the most number of faults? List the skill id and description.? Schema: - Skills(...) - Skills_Required_To_Fix(...)
SELECT T1.skill_id, T1.skill_description FROM Skills AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.skill_id = T2.skill_id GROUP BY T1.skill_id, T1.skill_description ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
How many documents have document type code CV or BK? Schema: - All_Documents(Date_Stored, Document_Name, Document_Type_Code)
SELECT COUNT(*) AS num_documents FROM All_Documents WHERE Document_Type_Code = 'CV' OR Document_Type_Code = 'BK';
what is the best restaurant in the bay area for american food ? Schema: - restaurant(...) - geographic(...) - location(...)
SELECT T3.house_number, T1.name FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name JOIN location AS T3 ON T1.id = T3.restaurant_id WHERE T2.region = 'bay area' AND T1.food_type = 'american' AND T1.rating = (SELECT MAX(T1.rating) FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.ci...
List the subject ID, name of subject and the number of courses available for each subject in ascending order of the course counts.? Schema: - Courses(course_description, course_name) - Subjects(subject_name)
SELECT T1.subject_id, T2.subject_name, COUNT(*) AS num_courses FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id, T2.subject_name ORDER BY num_courses ASC NULLS LAST;
What is the semester which most student registered in? Show both the name and the id.? Schema: - Semesters(...) - Student_Enrolment(...)
SELECT T1.semester_name, T1.semester_id FROM Semesters AS T1 JOIN Student_Enrolment AS T2 ON T1.semester_id = T2.semester_id GROUP BY T1.semester_id, T1.semester_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
what rivers flow through the state with the largest population? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) - 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 state_name FROM state WHERE population = (SELECT MAX(population) FROM state));
what are some good places in mountain view for arabic food ? Schema: - restaurant(...) - location(...)
SELECT T2.house_number, T1.name FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'mountain view' AND T1.food_type = 'arabic' AND T1.rating > 2.5;
Show the number of document types.? Schema: - Ref_Document_Types(Document_Type_Code, Document_Type_Description, Document_Type_Name, document_type_code, document_type_description)
SELECT COUNT(*) AS num_document_types FROM Ref_Document_Types;
List all location codes and location names.? Schema: - Ref_Locations(Location_Code, Location_Description, Location_Name)
SELECT Location_Code, Location_Name FROM Ref_Locations;
What is the membership card held by both members living in Hartford and ones living in Waterbury address? Schema: - member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
SELECT DISTINCT T1.Membership_card FROM (SELECT Membership_card FROM member_ WHERE Address = 'Hartford') AS T1, (SELECT Membership_card FROM member_ WHERE Address = 'Waterbury') AS T2 WHERE T1.Membership_card = T2.Membership_card;
Give the names of people who did not participate in the candidate election.? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) - candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_ra...
SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM candidate);
Give the songs included in volumes that have more than 1 week on top.? Schema: - volume(Artist_ID, Issue_Date, Song, Weeks_on_Top)
SELECT Song FROM volume WHERE Weeks_on_Top > 1;
Show the name and location of track with 1 race.? Schema: - race(Class, Date, Name) - track(Location, Name, Seat, Seating, T1, Year_Opened)
SELECT T2.Name, T2.Location FROM race AS T1 JOIN track AS T2 ON T1.Track_ID = CAST(T2.Track_ID AS TEXT) GROUP BY T1.Track_ID, T2.Name, T2.Location HAVING COUNT(*) = 1;
How many countries has more than 2 car makers ? Schema: - countries(...) - car_makers(...)
SELECT COUNT(*) AS num_countries FROM countries WHERE CountryId IN (SELECT CountryId FROM car_makers WHERE CountryId IS NOT NULL GROUP BY CountryId HAVING COUNT(*) > 2);
Give me the maximum low temperature and average precipitation at the Amersham station.? Schema: - weekly_weather(low_temperature, wind_speed_mph) - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
SELECT MAX(T1.low_temperature) AS max_low_temperature, AVG(T1.precipitation) AS avg_precipitation FROM weekly_weather AS T1 JOIN station AS T2 ON T1.station_id = T2.id WHERE T2.network_name = 'Amersham';
For each zip code, return the average mean temperature of August there.? Schema: - weather(AVG, COUNT, M, Ra, cloud_cover, date, diff, events, mean_humidity, mean_sea_level_pressure_inches, mean_temperature_f, mean_visibility_miles, ... (1 more))
SELECT zip_code, AVG(mean_temperature_f) AS avg_temperature FROM weather WHERE "date" LIKE '8/%' GROUP BY zip_code;
return me the paper after 2000 in VLDB conference with more than 200 citations .? Schema: - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - conference(homepage, name)
SELECT T2.title FROM publication AS T2 JOIN conference AS T1 ON T2.cid = CAST(T1.cid AS TEXT) WHERE T1.name = 'VLDB' AND T2.citation_num > 200 AND T2."year" > 2000;
Give me a list of names and years of races that had any driver whose forename is Lewis? Schema: - results(...) - races(date, name) - drivers(forename, nationality, surname)
SELECT T2.name, T2."year" FROM results AS T1 JOIN races AS T2 ON T1.raceId = T2.raceId JOIN drivers AS T3 ON T1.driverId = T3.driverId WHERE T3.forename = 'Lewis';
How many drivers were in the Australian Grand Prix held in 2009? Schema: - results(...) - races(date, name)
SELECT COUNT(*) AS num_drivers FROM results AS T1 JOIN races AS T2 ON T1.raceId = T2.raceId WHERE T2.name = 'Australian Grand Prix' AND "year" = 2009;
List all the neighbourhoods with Italian restaurant in Madison? Schema: - category(...) - business(business_id, city, full_address, name, rating, review_count, state) - neighbourhood(...)
SELECT T1.neighbourhood_name FROM category AS T3 JOIN business AS T2 ON T3.business_id = T2.business_id JOIN category AS T4 ON T4.business_id = T2.business_id JOIN neighbourhood AS T1 ON T1.business_id = T2.business_id WHERE T2.city = 'Madison' AND T3.category_name = 'Italian' AND T4.category_name = 'restaurant';
What is the template type code for template type description "Book".? Schema: - Ref_Template_Types(Template_Type_Code, Template_Type_Description)
SELECT Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Description = 'Book';
What is the complete description of the researcher role.? Schema: - Staff_Roles(role_code, role_description)
SELECT role_description FROM Staff_Roles WHERE role_code = 'researcher';
Which customer uses the most policies? Give me the customer name.? 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(...)
SELECT T1.Customer_name FROM Customers AS T1 JOIN Customers_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID GROUP BY T1.Customer_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the nationality of the actress " 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';
What are the names of perpetrators in country "China" or "Japan"? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) - perpetrator(Country, Date, Injured, Killed, Location, Year)
SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country = 'China' OR T2.Country = 'Japan';
How many countries have a republic as their form of government? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
SELECT COUNT(*) AS num_countries FROM country WHERE GovernmentForm = 'Republic';
Which manager won the most manager award? Give me the manager's first name, last name and id.? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) - manager_award(...)
SELECT T1.name_first, T1.name_last, T2.player_id FROM player AS T1 JOIN manager_award AS T2 ON T1.player_id = T2.player_id GROUP BY T1.name_first, T1.name_last, T2.player_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the top three apartment types in terms of the average room count? Give me the? Schema: - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT apt_type_code FROM Apartments WHERE apt_type_code IS NOT NULL GROUP BY apt_type_code ORDER BY AVG(TRY_CAST(room_count AS INT)) DESC NULLS LAST LIMIT 3;
What are the ages of all of Zach's friends who are in the longest relationship? Schema: - Person(M, age, city, eng, gender, job, name) - PersonFriend(M, friend, name)
SELECT T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Zach' AND T2."year" = (SELECT MAX("year") FROM PersonFriend WHERE name = 'Zach');
What are the dates of ceremony and results for each music festival? Schema: - music_festival(COUNT, Category, Date_of_ceremony, Result)
SELECT Date_of_ceremony, "Result" FROM music_festival;
What are the names and parties of representatives? Schema: - representative(JO, Lifespan, Name, Party, State, T1)
SELECT Name, Party FROM representative;
Find the last name of female (sex is F) students in the descending order of age.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT LName FROM Student WHERE Sex = 'F' ORDER BY Age DESC NULLS LAST;
What are the ranks of captains that are both in the Cutter and Armed schooner classes? Schema: - captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l)
SELECT "Rank" FROM captain WHERE Class = 'Cutter' AND "Rank" IN (SELECT "Rank" FROM captain WHERE Class = 'Armed schooner');
Which team offers the lowest average salary? Give me the name and id of the team.? Schema: - team(Name) - salary(salary)
SELECT T1.name, T1.team_id FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.name, T1.team_id ORDER BY AVG(T2.salary) ASC NULLS LAST LIMIT 1;
How many distinct allergies are there? Schema: - Allergy_Type(Allergy, AllergyType, COUNT)
SELECT COUNT(DISTINCT AllergyType) AS num_allergies FROM Allergy_Type;
display all the information of employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40.? Schema: - employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 mo...
SELECT * FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT IS NOT NULL OR DEPARTMENT_ID != 40;
How many total credits are offered by each department? Schema: - course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
SELECT SUM(credits) AS total_credits, dept_name FROM course GROUP BY dept_name;
Find the name and salary of instructors whose salary is below the average salary of the instructors in the Physics department.? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT name, salary FROM instructor WHERE salary < (SELECT AVG(salary) FROM instructor WHERE dept_name = 'Physics');
What are the ids of documents that have 2 or more paragraphs? Schema: - Paragraphs(COUNT, Document_ID, Other_Details, Paragraph_Text, T1)
SELECT Document_ID FROM Paragraphs WHERE Document_ID IS NOT NULL GROUP BY Document_ID HAVING COUNT(*) >= 2;
What are the names of the dorm that does not have a TV Lounge? Schema: - Dorm(dorm_name, gender, student_capacity) - Has_amenity(dormid) - Dorm_amenity(amenity_name)
SELECT dorm_name FROM Dorm WHERE dorm_name NOT IN (SELECT T1.dorm_name FROM Dorm AS T1 JOIN Has_amenity AS T2 ON T1.dormid = T2.dormid JOIN Dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge');
Show the country name and capital of all countries.? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
SELECT Country_name, Capital FROM country;
List the papers on TAIL that were published in NIPS? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - venue(venueId, venueName)
SELECT DISTINCT T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.keyphraseName = 'TAIL' AND T4.venueName = 'NIPS';
What is the code of the course which the student whose last name is Smithson took? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) - ENROLL(...) - STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
SELECT T1.CRS_CODE FROM CLASS AS T1 JOIN ENROLL AS T2 ON T1.CLASS_CODE = T2.CLASS_CODE JOIN STUDENT AS T3 ON T3.STU_NUM = T2.STU_NUM WHERE T3.STU_LNAME = 'Smithson';
Find the names of all instructors in computer science department? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.';
Which park had most attendances in 2008? Schema: - home_game(attendance, year) - park(city, state)
SELECT T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1."year" = 2008 ORDER BY T1.attendance DESC NULLS LAST LIMIT 1;
Find the total number of courses offered.? Schema: - Courses(course_description, course_name)
SELECT COUNT(*) AS num_courses FROM Courses;
List all the customers in increasing order of IDs.? 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 Customer_ID, Customer_name FROM Customers ORDER BY Customer_ID ASC NULLS LAST;
What are the different names of the product characteristics? Schema: - Characteristics(characteristic_name)
SELECT DISTINCT characteristic_name FROM Characteristics;
papers of ali farhadi in eccv 2016? Schema: - venue(venueId, venueName) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - writes(...) - author(...)
SELECT DISTINCT T3.paperId FROM venue AS T4 JOIN paper AS T3 ON T4.venueId = T3.venueId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'ali farhadi' AND T3."year" = 2016 AND T4.venueName = 'eccv';
What is the name of the browser that became compatible with the accelerator 'CProxy' after year 1998 ? Schema: - browser(id, market_share, name) - accelerator_compatible_browser(...) - Web_client_accelerator(Client, Operating_system)
SELECT T1.name FROM browser AS T1 JOIN accelerator_compatible_browser AS T2 ON T1.id = T2.browser_id JOIN Web_client_accelerator AS T3 ON T2.accelerator_id = T3.id WHERE T3.name = 'CProxy' AND T2.compatible_since_year > 1998;
How many addresses are in the district of California? Schema: - address(address, district, phone, postal_code)
SELECT COUNT(*) AS num_addresses FROM address WHERE district = 'California';
Find all movies featuring " Woody Strode " and " Jason Robards "? Schema: - cast_(...) - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
SELECT T4.title FROM cast_ AS T5 JOIN actor AS T1 ON T5.aid = T1.aid JOIN movie AS T4 ON T4.mid = T5.msid JOIN cast_ AS T3 ON T4.mid = T3.msid JOIN actor AS T2 ON T3.aid = T2.aid WHERE T1.name = 'Woody Strode' AND T2.name = 'Jason Robards';
Show the location name and code with the least 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;
What is the id of the files that are available in the format of mp4 and a resolution smaller than 1000? Schema: - files(COUNT, duration, f_id, formats) - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT DISTINCT T1.f_id FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp4' AND T2.resolution < 1000;
How many stadiums are not in country "Russia"? Schema: - stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
SELECT COUNT(*) AS num_stadiums FROM stadium WHERE Country != 'Russia';
what is a good restaurant in the bay area ? Schema: - location(...) - restaurant(...) - geographic(...)
SELECT T2.house_number, T1.name FROM location AS T2 JOIN restaurant AS T1 ON T1.id = T2.restaurant_id WHERE T1.city_name IN (SELECT city_name FROM geographic WHERE region = 'bay area') AND T1.rating > 2.5;
which state 's capital city is the largest? 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)
SELECT state_name FROM city WHERE population = (SELECT MAX(T1.population) FROM state AS T2 JOIN city AS T1 ON T2.capital = T1.city_name);
papers written by Peter Mertens and Dina Barbian? Schema: - writes(...) - author(...)
SELECT DISTINCT T3.paperId FROM writes AS T3 JOIN author AS T2 ON T3.authorId = T2.authorId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T2.authorName = 'Peter Mertens' AND T1.authorName = 'Dina Barbian';
What are the gas station ids, locations, and manager names for the gas stations ordered by opening year? Schema: - gas_station(COUNT, Location, Manager_Name, Open_Year, Station_ID)
SELECT Station_ID, Location, Manager_Name FROM gas_station ORDER BY Open_Year ASC NULLS LAST;
What are all the policy types of the customer that has the most policies listed? 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_Phon...
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 = (SELECT T1.Customer_name FROM Customers AS T1 JOIN Customers_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID G...
List papers that has keyword 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';
Show the ids of the faculty who don't participate in any activity.? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) - Faculty_Participates_in(FacID)
SELECT FacID FROM Faculty WHERE FacID NOT IN (SELECT FacID FROM Faculty_Participates_in);
How many different classes are there? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
SELECT COUNT(DISTINCT CLASS_CODE) AS num_classes FROM CLASS;
Find the name of the room with the maximum occupancy.? Schema: - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC NULLS LAST LIMIT 1;
Which department has the most professors with a Ph.D.? Schema: - PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) - DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
SELECT T2.DEPT_NAME, T1.DEPT_CODE FROM PROFESSOR AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE WHERE T1.PROF_HIGH_DEGREE = 'Ph.D.' GROUP BY T1.DEPT_CODE, T2.DEPT_NAME ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the total population for all the districts that have an area larger tahn the average city area? Schema: - district(City_Area, City_Population, District_name, d)
SELECT SUM(City_Population) AS total_population FROM district WHERE City_Area > (SELECT AVG(City_Area) FROM district);
return me the journal that has the most number of papers containing keyword " Relational Database " .? Schema: - publication_keyword(...) - keyword(keyword) - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - journal(Theme, homepage, name)
SELECT T3.name FROM publication_keyword AS T4 JOIN keyword AS T1 ON T4.kid = T1.kid JOIN publication AS T2 ON T2.pid = T4.pid JOIN journal AS T3 ON T2.jid = T3.jid WHERE T1.keyword = 'Relational Database' GROUP BY T3.name ORDER BY COUNT(DISTINCT T2.title) DESC NULLS LAST LIMIT 1;
What are the different addresses that have students living there? 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))
SELECT DISTINCT current_address_id FROM Students;
What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'? Schema: - department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name) - management(temporary_acting) - head(age, born_state, head_ID, name)
SELECT DISTINCT T1.Creation FROM department AS T1 JOIN management AS T2 ON T1.department_ID = T2.department_ID JOIN head AS T3 ON T2.head_ID = T3.head_ID WHERE T3.born_state = 'Alabama';
When did the first payment happen? Schema: - payment(amount, payment_date)
SELECT payment_date FROM payment ORDER BY payment_date ASC NULLS LAST LIMIT 1;
List the types of competition that have at most five competitions of that type.? Schema: - competition(COUNT, Competition_type, Country, T1, Year)
SELECT Competition_type FROM competition WHERE Competition_type IS NOT NULL GROUP BY Competition_type HAVING COUNT(*) <= 5;
Find the names of customers who have bought by at least three distinct 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_shippin...
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 are the title and director of each film? Schema: - film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
SELECT Title, Directed_by FROM film;
Find the name of the customers who have at most two orders.? Schema: - Orders(customer_id, date_order_placed, order_id) - 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_name FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id, T2.customer_name HAVING COUNT(*) <= 2;
Report the distinct advisors who have more than 2 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;
Show the country where people older than 30 and younger than 25 are from.? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
SELECT DISTINCT p1.Country FROM people p1 JOIN people p2 ON p1.Country = p2.Country WHERE p1.Age < 25 AND p2.Age > 30;
Which countries have more than one mountain? Schema: - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT Country FROM mountain WHERE Country IS NOT NULL GROUP BY Country HAVING COUNT(*) > 1;
Count the number of different 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 COUNT(DISTINCT Party_name) AS num_parties FROM party;
what are the population densities of each us state? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT density FROM state;
Show all member names who are not in charge of any event.? Schema: - member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) - party_events(Event_Name)
SELECT Member_Name FROM member_ WHERE Member_Name NOT IN (SELECT T1.Member_Name FROM member_ AS T1 JOIN party_events AS T2 ON T1.Member_ID = T2.Member_in_charge_ID);
When was the first asset acquired? Schema: - Assets(asset_acquired_date, asset_details, asset_disposed_date, asset_id, asset_make, asset_model)
SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date ASC NULLS LAST LIMIT 1;
What are all the labels? Schema: - Albums(COUNT, Label, Title)
SELECT DISTINCT Label FROM Albums;
coauthors of 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';
For each team, how many technicians are there? Schema: - technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name)
SELECT Team, COUNT(*) AS num_technicians FROM technician GROUP BY Team;
List the distinct names of the instructors, ordered by name.? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT DISTINCT name FROM instructor ORDER BY name ASC NULLS LAST;
return me the number of papers on VLDB conference .? Schema: - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - conference(homepage, name)
SELECT COUNT(DISTINCT T2.title) AS num_papers FROM publication AS T2 JOIN conference AS T1 ON T2.cid = CAST(T1.cid AS TEXT) WHERE T1.name = 'VLDB';
Show each county along with the number of schools and total enrollment in each county.? Schema: - School(County, Enrollment, Location, Mascot, School_name)
SELECT County, COUNT(*) AS num_schools, SUM(Enrollment) AS total_enrollment FROM School GROUP BY County;
display job Title, the difference between minimum and maximum salaries for those jobs which max salary within the range 12000 to 18000.? Schema: - jobs(JOB_TITLE, diff)
SELECT JOB_TITLE, MAX_SALARY - MIN_SALARY AS diff FROM jobs WHERE MAX_SALARY BETWEEN 12000 AND 18000;
what is the longest river flowing through texas? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT river_name FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river WHERE traverse = 'texas') AND traverse = 'texas';
what is the longest river in the united states? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT river_name FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river);
What are the average prominence of the mountains in country 'Morocco'? Schema: - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT AVG(Prominence) AS avg_prominence FROM mountain WHERE Country = 'Morocco';
For each company id, what are the companies and how many gas stations does each one operate? Schema: - station_company(...) - company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more))
SELECT T2.Company, COUNT(*) AS num_gas_stations FROM station_company AS T1 JOIN company AS T2 ON T1.Company_ID = T2.Company_ID GROUP BY T1.Company_ID, T2.Company;
Find the last names of students studying in room 111.? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName)
SELECT LastName FROM list WHERE Classroom = 111;
give me a good restaurant on bethel island rd in bethel island ? 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 = 'bethel island' AND T2.street_name = 'bethel island rd' AND T1.rating > 2.5;
What is the venue of Fracture of acrylic bone cement ? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT venueId FROM paper WHERE title = 'Fracture of acrylic bone cement';
What are the employee ids, full names, and job ids for employees who make more than the highest earning employee with title PU_MAN? 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 EMPLOYEE_ID, FIRST_NAME, LAST_NAME, JOB_ID FROM employees WHERE SALARY > (SELECT MAX(SALARY) FROM employees WHERE JOB_ID = 'PU_MAN');
What are the themes and locations of 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 Party_Theme, Location FROM party;
Show all document type codes, document type names, document type descriptions.? Schema: - Ref_Document_Types(Document_Type_Code, Document_Type_Description, Document_Type_Name, document_type_code, document_type_description)
SELECT Document_Type_Code, Document_Type_Name, Document_Type_Description FROM Ref_Document_Types;
Show the names of climbers and the heights of mountains they climb.? Schema: - climber(Country, K, Name, Points) - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT T1.Name, T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID;