question
stringlengths
43
589
query
stringlengths
19
598
Show all ages and corresponding number of students.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT Age, COUNT(*) AS num_students FROM Student GROUP BY Age;
Count the number of customers who hold an account.? Schema: - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
SELECT COUNT(DISTINCT customer_id) AS num_customers FROM Accounts;
Return the completion date for all the tests that have "Fail" result.? Schema: - Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) - Student_Tests_Taken(date_test_taken, test_result)
SELECT T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = 'Fail';
What are the first and last names of the top 10 longest-serving 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 first_name, last_name FROM employees ORDER BY hire_date ASC NULLS LAST LIMIT 10;
Show the number of buildings with a height above the average or a number of floors above the average.? Schema: - building(Floors, Height_feet, Name, build)
SELECT COUNT(*) AS num_buildings FROM building WHERE Height_feet > (SELECT AVG(Height_feet) FROM building) OR Floors > (SELECT AVG(Floors) FROM building);
how many papers accepted in nature communications 2015? 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 T1."year" = 2015 AND T2.venueName = 'nature communications';
Find the average age of students living in each dorm and the name of dorm.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - Lives_in(...) - Dorm(dorm_name, gender, student_capacity)
SELECT AVG(T1.Age) AS avg_age, T3.dorm_name FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name;
what papers do parsing papers typically cite ? 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';
What are the ids of the problems which are reported after 1978-06-26? Schema: - Problems(date_problem_reported, problem_id)
SELECT problem_id FROM Problems WHERE date_problem_reported > DATE '1978-06-26';
Which program is broadcast most frequently? Give me the program name.? Schema: - program(Beij, Launch, Name, Origin, Owner) - broadcast(Program_ID, Time_of_day)
SELECT T1.Name FROM program AS T1 JOIN broadcast AS T2 ON T1.Program_ID = T2.Program_ID GROUP BY T2.Program_ID, T1.Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What degrees were conferred in San Francisco State University in the year 2001? Schema: - Campuses(Campus, County, Franc, Location) - degrees(Campus, Degrees, SUM, Year)
SELECT Degrees FROM Campuses AS T1 JOIN degrees AS T2 ON T1.Id = T2.Campus WHERE T1.Campus = 'San Francisco State University' AND T2."Year" = 2001;
List the organisation id with the maximum outcome count, and the count.? Schema: - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) - Project_Outcomes(outcome_code)
SELECT T1.organisation_id, COUNT(*) AS num_outcomes FROM Projects AS T1 JOIN Project_Outcomes AS T2 ON T1.project_id = T2.project_id GROUP BY T1.organisation_id ORDER BY num_outcomes DESC NULLS LAST LIMIT 1;
how many states border the mississippi river? Schema: - border_info(T1, border, state_name) - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT COUNT(DISTINCT border) AS num_states FROM border_info WHERE state_name IN (SELECT traverse FROM river WHERE river_name = 'mississippi');
How many appelations are in Napa Country? Schema: - appellations(Area, County)
SELECT COUNT(*) AS num_appellations FROM appellations WHERE County = 'Napa';
Give the name of the lowest earning instructor in the Statistics department.? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary ASC NULLS LAST LIMIT 1;
What are the student IDs for everybody who worked for more than 10 hours per week on all sports? Schema: - SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
SELECT StuID FROM SportsInfo WHERE StuID IS NOT NULL GROUP BY StuID HAVING SUM(HoursPerWeek) > 10;
What is the name of the claim processing stage that most of the claims are on? Schema: - Claims_Processing(Claim_Outcome_Code) - Claims_Processing_Stages(Claim_Status_Description, Claim_Status_Name)
SELECT T2.Claim_Status_Name FROM Claims_Processing AS T1 JOIN Claims_Processing_Stages AS T2 ON T1.Claim_Stage_ID = T2.Claim_Stage_ID GROUP BY T1.Claim_Stage_ID, T2.Claim_Status_Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
count of ACL papers by author? Schema: - venue(venueId, venueName) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - writes(...)
SELECT DISTINCT COUNT(T2.paperId) AS num_papers, T1.authorId FROM venue AS T3 JOIN paper AS T2 ON T3.venueId = T2.venueId JOIN writes AS T1 ON T1.paperId = T2.paperId WHERE T3.venueName = 'ACL' GROUP BY T1.authorId;
Show the product type and name for the products with price higher than 1000 or lower than 500.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT product_type_code, product_name FROM Products WHERE product_price > 1000 OR product_price < 500;
What is average lesson price taught by staff with first name as Janessa and last name as Sawayn? Schema: - Lessons(lesson_status_code) - 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 AVG(price) AS avg_lesson_price FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn';
What are the ids, date opened, name, and other details for all accounts? Schema: - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
SELECT account_id, date_account_opened, account_name, other_account_details FROM Accounts;
Show ids for all documents in type CV without expense budgets.? 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)) - Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID)
SELECT Document_ID FROM Documents WHERE Document_Type_Code = 'CV' AND Document_ID NOT IN (SELECT Document_ID FROM Documents_with_Expenses);
What is the number of distinct languages used around the world? Schema: - countrylanguage(COUNT, CountryCode, Engl, Language)
SELECT COUNT(DISTINCT "Language") AS num_languages FROM countrylanguage;
Count the number of students who have advisors.? Schema: - advisor(s_ID)
SELECT COUNT(DISTINCT s_ID) AS num_students FROM advisor;
What are the names of all the physicians who took appointments.? Schema: - Appointment(AppointmentID, Start) - Physician(I, Name)
SELECT T2.Name FROM Appointment AS T1 JOIN Physician AS T2 ON T1.Physician = T2.EmployeeID;
Find the branch names of banks in the New York state.? Schema: - bank(SUM, bname, city, morn, no_of_customers, state)
SELECT bname FROM bank WHERE state = 'New York';
What are the carriers of devices whose software platforms are not "Android"? Schema: - device(COUNT, Carrier, Software_Platform)
SELECT Carrier FROM device WHERE Software_Platform != 'Android';
What is the best restaurant in san francisco for french 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 = 'san francisco' AND T1.food_type = 'french' AND T1.rating = (SELECT MAX(T1.rating) FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'san francisco' AND T1.food_type = 'french');
What are the names of the technicians by ascending order of quality rank for the machine they are assigned? Schema: - repair_assignment(...) - machine(...) - technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name)
SELECT T3.name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.Machine_ID = T2.Machine_ID JOIN technician AS T3 ON T1.technician_id = T3.technician_id ORDER BY T2.quality_rank ASC NULLS LAST;
What are the state and country of all the cities that have post codes starting with 4.\? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
SELECT state_province_county, country FROM Addresses WHERE zip_postcode LIKE '4%';
List the carriers of devices in ascending alphabetical order.? Schema: - device(COUNT, Carrier, Software_Platform)
SELECT Carrier FROM device ORDER BY Carrier ASC NULLS LAST;
What campus has the most faculties in 2003? Schema: - Campuses(Campus, County, Franc, Location) - faculty(Faculty)
SELECT T1.Campus FROM Campuses AS T1 JOIN faculty AS T2 ON T1.Id = T2.Campus WHERE T2."Year" = 2003 ORDER BY T2.Faculty DESC NULLS LAST LIMIT 1;
What is the template type code of the template used by document with the name "Data base"? Schema: - Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number) - 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.Template_Type_Code FROM Templates AS T1 JOIN Documents AS T2 ON T1.Template_ID = T2.Template_ID WHERE T2.Document_Name = 'Data base';
Show the people that have been governor the most times.? Schema: - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT Governor FROM party WHERE Governor IS NOT NULL GROUP BY Governor ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Give me all the phone numbers and email addresses of the workshop groups where services are performed.? Schema: - Drama_Workshop_Groups(COUNT, Currency_Code, Marketing_Region_Code, Store_Name) - Services(Service_Type_Code, Service_name)
SELECT T1.Store_Phone, T1.Store_Email_Address FROM Drama_Workshop_Groups AS T1 JOIN Services AS T2 ON T1.Workshop_Group_ID = T2.Workshop_Group_ID;
what is the state with the lowest population? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT state_name FROM state WHERE population = (SELECT MIN(population) FROM state);
what state that borders oklahoma has the highest population? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) - border_info(T1, border, state_name)
SELECT state_name FROM state WHERE state_name IN (SELECT border FROM border_info WHERE state_name = 'oklahoma') ORDER BY population DESC NULLS LAST LIMIT 1;
What is the average bike availablility for stations not in Palo Alto? Schema: - status(...) - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
SELECT AVG(bikes_available) AS avg_bikes_available FROM status WHERE station_id NOT IN (SELECT id FROM station WHERE city = 'Palo Alto');
Show the names of journalists and the dates of the events they reported.? Schema: - news_report(...) - event(Date, Event_Attendance, Name, Venue, Year) - journalist(Age, COUNT, Name, Nationality, T1, Years_working)
SELECT T3.Name, T2."Date" 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;
List all the distinct president votes and the vice president votes.? Schema: - Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote)
SELECT DISTINCT President_Vote, Vice_President_Vote FROM Voting_record;
What are the different nationalities of pilots? Show each nationality and the number of pilots of each nationality.? Schema: - pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team)
SELECT Nationality, COUNT(*) AS num_pilots FROM pilot GROUP BY Nationality;
Which programs' origins are not "Beijing"? Give me the program names.? Schema: - program(Beij, Launch, Name, Origin, Owner)
SELECT Name FROM program WHERE Origin != 'Beijing';
How many entrepreneurs are there? Schema: - entrepreneur(COUNT, Company, Investor, Money_Requested)
SELECT COUNT(*) AS num_entrepreneurs FROM entrepreneur;
What are the types of the ships that have both shiips with tonnage more than 6000 and those with tonnage less than 4000? Schema: - ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage)
SELECT DISTINCT T1.Type FROM (SELECT DISTINCT Type FROM ship WHERE Tonnage > 6000) AS T1 JOIN (SELECT DISTINCT Type FROM ship WHERE Tonnage < 4000) AS T2 ON T1.Type = T2.Type;
What is the student capacity and type of gender for the dorm whose name as the phrase Donor in it? Schema: - Dorm(dorm_name, gender, student_capacity)
SELECT student_capacity, gender FROM Dorm WHERE dorm_name LIKE '%Donor%';
Show the most common builder of railways.? Schema: - railway(Builder, COUNT, Location)
SELECT Builder FROM railway WHERE Builder IS NOT NULL GROUP BY Builder ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the names of all female candidates in alphabetical order (sex is F)? 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_rate)
SELECT T1.Name FROM people AS T1 JOIN candidate AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Sex = 'F' ORDER BY T1.Name ASC NULLS LAST;
how many big cities are in texas? 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 population > 150000 AND state_name = 'texas';
Which claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number.? 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, COUNT(*) AS num_settlements FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID GROUP BY T1.Claim_ID, T1.Date_Claim_Made ORDER BY num_settlements DESC NULLS LAST LIMIT 1;
Find the first names of all customers that live in Brazil and have an invoice.? Schema: - Customer(Email, FirstName, LastName, State, lu) - Invoice(BillingCountry)
SELECT DISTINCT T1.FirstName FROM Customer AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.Country = 'Brazil';
what is the length of 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);
how many cities named austin are there in the usa? 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 city_name = 'austin';
What is the country of the airport with the highest elevation? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT country FROM airports ORDER BY elevation DESC NULLS LAST LIMIT 1;
return me the authors who have 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) - writes(...) - author(...)
SELECT T2.name FROM publication_keyword AS T5 JOIN keyword AS T1 ON T5.kid = T1.kid JOIN publication AS T3 ON T3.pid = T5.pid JOIN writes AS T4 ON T4.pid = T3.pid JOIN author AS T2 ON T4.aid = T2.aid WHERE T1.keyword = 'Relational Database';
What are the names and ids of products costing between 600 and 700? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT product_name, product_id FROM Products WHERE product_price BETWEEN 600 AND 700;
return me the number of papers on VLDB conference after 2000 .? 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' AND T2."year" > 2000;
What are the names, ages, and jobs of all people who are friends with Alice for the longest amount of time? Schema: - Person(M, age, city, eng, gender, job, name) - PersonFriend(M, friend, name)
SELECT T1.name, T1.age, T1.job FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice' AND T2."year" = (SELECT MAX("year") FROM PersonFriend WHERE friend = 'Alice');
conferences in 2013? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT venueId FROM paper WHERE "year" = 2013;
Find the average checking balance.? Schema: - CHECKING(balance)
SELECT AVG(balance) AS avg_balance FROM CHECKING;
data sets for semantic parsing? Schema: - paperDataset(...) - dataset(...) - paperKeyphrase(...) - keyphrase(...)
SELECT DISTINCT T2.datasetId FROM paperDataset AS T3 JOIN dataset AS T2 ON T3.datasetId = T2.datasetId JOIN paperKeyphrase AS T1 ON T1.paperId = T3.paperId JOIN keyphrase AS T4 ON T1.keyphraseId = T4.keyphraseId WHERE T4.keyphraseName = 'semantic parsing';
What is the number of aircraft? Schema: - aircraft(Description, aid, d, distance, name)
SELECT COUNT(*) AS num_aircraft FROM aircraft;
Find the distinct winery of wines having price between 50 and 100.? Schema: - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
SELECT DISTINCT Winery FROM wine WHERE Price BETWEEN 50 AND 100;
What are the names of customers with a higher checking balance than savings balance? Schema: - ACCOUNTS(name) - CHECKING(balance) - SAVINGS(SAV, balance)
SELECT T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid WHERE T2.balance > T3.balance;
Which department offers the most number of degrees? List department name and id.? Schema: - Degree_Programs(degree_summary_name, department_id) - Departments(...)
SELECT T2.department_name, T1.department_id FROM Degree_Programs AS T1 JOIN Departments AS T2 ON T1.department_id = T2.department_id GROUP BY T1.department_id, T2.department_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
How many players have more than 1000 hours of training? Schema: - Player(HS, pName, weight, yCard)
SELECT COUNT(*) AS num_players FROM Player WHERE HS > 1000;
Show the name for regions and the number of storms for each region.? Schema: - region(Label, Region_code, Region_name) - affected_region(Region_id)
SELECT T1.Region_name, COUNT(*) AS num_storms FROM region AS T1 JOIN affected_region AS T2 ON T1.Region_id = T2.Region_id GROUP BY T1.Region_id, T1.Region_name;
What are the names, headquarters and revenues for manufacturers, sorted by revenue descending? Schema: - Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue)
SELECT Name, Headquarter, Revenue FROM Manufacturers ORDER BY Revenue DESC NULLS LAST;
What are the date, mean temperature and mean humidity for the top 3 days with the largest max gust speeds? 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 "date", mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC NULLS LAST LIMIT 3;
How many cars has over 6 cylinders? Schema: - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT COUNT(*) AS num_cars FROM cars_data WHERE Cylinders > 6;
Show names of pilots that have more than one record.? Schema: - pilot_record(...) - pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team)
SELECT T2.Pilot_name, COUNT(*) AS num_records FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.Pilot_ID = T2.Pilot_ID GROUP BY T2.Pilot_name HAVING COUNT(*) > 1;
Find all Mexican restaurant in Dallas with a rating above 3.5? Schema: - category(...) - business(business_id, city, full_address, name, rating, review_count, state)
SELECT T1.name FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN category AS T3 ON T3.business_id = T1.business_id WHERE T1.city = 'Dallas' AND T1.rating > 3.5 AND T2.category_name = 'Mexican' AND T3.category_name = 'restaurant';
display the employee name ( first name and last name ) and hire date for all employees in the same department as Clara excluding Clara.? 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 FROM employees WHERE DEPARTMENT_ID = (SELECT DEPARTMENT_ID FROM employees WHERE FIRST_NAME = 'Clara') AND FIRST_NAME != 'Clara';
Show the names and heights of buildings with at least two institutions founded after 1880.? Schema: - building(Floors, Height_feet, Name, build) - Institution(COUNT, Enrollment, Founded, Type)
SELECT T1.Name, T1.Height_feet FROM building AS T1 JOIN Institution AS T2 ON T1.building_id = T2.building_id WHERE T2.Founded > 1880 GROUP BY T1.Name, T1.Height_feet, T1.building_id HAVING COUNT(*) >= 2;
For each course id, how many students are registered and what are the course names? 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_Registrations(COUNT, student_id) - Courses(course_description, course_name)
SELECT T3.course_name, COUNT(*) AS num_students FROM Students AS T1 JOIN Student_Course_Registrations AS T2 ON T1.student_id = T2.student_id JOIN Courses AS T3 ON CAST(T2.course_id AS TEXT) = T3.course_id GROUP BY T2.course_id, T3.course_name;
Find the different billing countries for all invoices.? Schema: - Invoice(BillingCountry)
SELECT DISTINCT BillingCountry FROM Invoice;
What is the money rank of the poker player with the highest earnings? Schema: - poker_player(Best_Finish, Earnings, Final_Table_Made, Money_Rank)
SELECT Money_Rank FROM poker_player ORDER BY Earnings DESC NULLS LAST LIMIT 1;
brian curless convolution paper? 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';
Which authors published papers in 2015 ? Schema: - writes(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T1.authorId FROM writes AS T1 JOIN paper AS T2 ON T1.paperId = T2.paperId WHERE T2."year" = 2015;
Which airports do not have departing or arriving flights? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) - flights(DestAirport, FlightNo, SourceAirport)
SELECT AirportName FROM airports WHERE AirportCode NOT IN (SELECT SourceAirport FROM flights UNION ALL SELECT DestAirport FROM flights);
Return the text of tweets about the topic 'intern'.? Schema: - tweets(I, tweet_text, uid)
SELECT tweet_text FROM tweets WHERE tweet_text ILIKE '%intern%';
Please show the titles of films and the types of market estimations.? Schema: - film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) - film_market_estimation(High_Estimate, Low_Estimate, Type)
SELECT T1.Title, T2.Type FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID;
What are all the different book publishers? Schema: - book_club(Author_or_Editor, Book_Title, COUNT, Category, Publ, Publisher, T1)
SELECT DISTINCT Publisher FROM book_club;
What is the total amount of money spent by Lucas Mancini? Schema: - customers(Mart, city, company, country, email, first_name, last_name, phone, state) - invoices(billing_city, billing_country, billing_state, total)
SELECT SUM(T2.total) AS total_spent FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = 'Lucas' AND T1.last_name = 'Mancini';
Sort the list of all the first and last names of authors in alphabetical order of the last names.? Schema: - Authors(fname, lname)
SELECT fname, lname FROM Authors ORDER BY lname ASC NULLS LAST;
Find the name, checking balance and saving balance of all accounts in the bank.? Schema: - ACCOUNTS(name) - CHECKING(balance) - SAVINGS(SAV, balance)
SELECT T2.balance AS checking_balance, T3.balance AS saving_balance, T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid;
Which apartments have bookings with both status codes "Provisional" and "Confirmed"? Give me the apartment numbers.? Schema: - Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code) - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT DISTINCT T3.apt_number FROM (SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = 'Confirmed') AS T3 JOIN (SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = 'Provisional') AS T4 ON T3.apt_number = T4.apt_number;
What are the names and buying prices of all the products? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT product_name, typical_buying_price FROM Products;
find the id of tv channels that do not play any cartoon directed by Ben Jones.? Schema: - TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name) - Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by)
SELECT id FROM TV_Channel WHERE id NOT IN (SELECT Channel FROM Cartoon WHERE Directed_by = 'Ben Jones');
Where does the staff member with the first name Elsa live? Schema: - staff(...) - address(address, district, phone, postal_code)
SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa';
What are the details of the car with id 1? Schema: - Vehicles(vehicle_details, vehicle_id)
SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1;
What is the county that produces the most wines scoring higher than 90? 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 WHERE T2.Score > 90 GROUP BY T1.County ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the number of cities in the United States with more than 3 airports? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT city FROM airports WHERE country = 'United States' AND city IS NOT NULL GROUP BY city HAVING COUNT(*) > 3;
How many business rates are related to each cmi cross reference? List cross reference id, master customer id and the n? Schema: - Business_Rates(...) - CMI_Cross_References(source_system_code)
SELECT T2.cmi_cross_ref_id, T2.master_customer_id, COUNT(*) AS num_business_rates FROM Business_Rates AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id GROUP BY T2.cmi_cross_ref_id, T2.master_customer_id;
What is the payment method of the customer that has purchased the least quantity of items? Schema: - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) - Customer_Orders(customer_id, order_date, order_id, order_shipping_charges) - Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
SELECT T1.payment_method 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_name, T1.payment_method ORDER BY SUM(TRY_CAST(T3.order_quantity AS DOUBLE)) ASC NULLS LAST LIMIT 1;
List all the username and passwords of users with the most popular role.? Schema: - Users(COUNT, password, role_code, user_log, user_name)
SELECT user_name, password FROM Users WHERE role_code IS NOT NULL AND user_name IS NOT NULL AND password IS NOT NULL GROUP BY role_code, user_name, password ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the names of perpetrators? 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;
what state which the mississippi runs through has the largest population? 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');
Show the result of the submission with the highest score.? Schema: - Acceptance(...) - submission(Author, COUNT, College, Scores)
SELECT T1."Result" FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY T2.Scores DESC NULLS LAST LIMIT 1;
What is the role code with the largest number of employees? Schema: - Employees(COUNT, Date_of_Birth, Employee_ID, Employee_Name, Role_Code, employee_id, employee_name, role_code)
SELECT Role_Code FROM Employees WHERE Role_Code IS NOT NULL GROUP BY Role_Code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
How many different status codes of things are there? Schema: - Timed_Status_of_Things(Status_of_Thing_Code)
SELECT COUNT(DISTINCT Status_of_Thing_Code) AS num_status_codes FROM Timed_Status_of_Things;