question
stringlengths
43
589
query
stringlengths
19
598
What is the most cited paper by ohad shamir ? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - cite(...) - writes(...) - author(...)
SELECT DISTINCT T4.citedPaperId, COUNT(T4.citedPaperId) AS num_citations FROM paper AS T3 JOIN cite AS T4 ON T3.paperId = T4.citedPaperId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'ohad shamir' GROUP BY T4.citedPaperId ORDER BY num_citations DESC NULLS LAST;
Find journals about Temporal Data .? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.journalId 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 = 'Temporal Data' GROUP BY T3.journalId;
What are the first names, office locations of all lecturers who have taught some course? 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)
SELECT T2.EMP_FNAME, T4.PROF_OFFICE, 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 JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM;
What is the largest major? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT Major FROM Student WHERE Major IS NOT NULL GROUP BY Major ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
display the employee number, name( first name and last name ) and job title for all employees whose salary is more than any salary of those employees whose job title is 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');
Show the names of countries and the average speed of roller coasters from each country.? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) - roller_coaster(DOUBLE, Height, LENGTH, Park, Speed, Status, TRY_CAST)
SELECT T1.Name, AVG(TRY_CAST(T2.Speed AS DOUBLE)) AS avg_speed FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID GROUP BY T1.Name;
What is the maximum point for climbers whose country is United Kingdom? Schema: - climber(Country, K, Name, Points)
SELECT MAX(Points) AS max_points FROM climber WHERE Country = 'United Kingdom';
How many addresses are there in country USA? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
SELECT COUNT(*) AS num_addresses FROM Addresses WHERE country = 'USA';
How many actors are in the movie " Saving Private Ryan " ? Schema: - cast_(...) - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
SELECT COUNT(DISTINCT T1.name) AS num_actors FROM cast_ AS T2 JOIN actor AS T1 ON T2.aid = T1.aid JOIN movie AS T3 ON T3.mid = T2.msid WHERE T3.title = 'Saving Private Ryan';
What are the names of high schoolers who have likes, and how many likes does each have? Schema: - Likes(student_id) - Highschooler(COUNT, ID, grade, name)
SELECT T2.name, COUNT(*) AS num_likes FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID GROUP BY T1.student_id, T2.name;
Show countries where a singer above age 40 and a singer below 30 are from.? Schema: - singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
SELECT DISTINCT T1.Country FROM singer AS T1 JOIN singer AS T2 ON T1.Country = T2.Country WHERE T1.Age > 40 AND T2.Age < 30;
Compute the average age of all the dogs.? Schema: - Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
SELECT AVG(age) AS avg_age FROM Dogs;
What conferences does Daniella Coelho submit to ? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.venueId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'Daniella Coelho';
what states border the state with the smallest area? Schema: - border_info(T1, border, state_name) - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT border FROM border_info WHERE state_name = (SELECT state_name FROM state WHERE area = (SELECT MIN(area) FROM state));
What is the average height of the players from the college named 'Yale University'? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) - player_college(...) - college(College_Location, Leader_Name)
SELECT AVG(T1.height) AS avg_height FROM player AS T1 JOIN player_college AS T2 ON T1.player_id = T2.player_id JOIN college AS T3 ON T3.college_id = T2.college_id WHERE T3.name_full = 'Yale University';
Find the title and score of the movie with the lowest rating among all movies directed by each director.? Schema: - Rating(Rat, mID, rID, stars) - Movie(T1, director, title, year)
SELECT T2.title, T1.stars, T2.director, MIN(T1.stars) AS min_stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T2.director, T2.title, T1.stars;
Find the number of distinct gender for dorms.? Schema: - Dorm(dorm_name, gender, student_capacity)
SELECT COUNT(DISTINCT gender) AS num_genders FROM Dorm;
What are the types of vocals that the band member with the first name "Solveig" 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 = 'Solveig' AND Type IS NOT NULL GROUP BY Type ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the address content of the customer named "Maudie Kertzmann"? 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_Addresses(address_type_code) - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
SELECT T3.address_content FROM Customers AS T1 JOIN Customer_Addresses AS T2 ON T1.customer_id = T2.customer_id JOIN Addresses AS T3 ON T2.address_id = T3.address_id WHERE T1.customer_name = 'Maudie Kertzmann';
Which party has the largest number of delegates? Schema: - election(Committee, Date, Delegate, District, Vote_Percent, Votes) - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party, T2.Party ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Find the the date of enrollment of the "Spanish" course.? Schema: - Courses(course_description, course_name) - Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id)
SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = 'Spanish';
return me the journals, which have papers by " H. V. Jagadish " .? Schema: - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - journal(Theme, homepage, name) - writes(...) - author(...)
SELECT T2.name FROM publication AS T4 JOIN journal AS T2 ON T4.jid = T2.jid JOIN writes AS T3 ON T3.pid = T4.pid JOIN author AS T1 ON T3.aid = T1.aid WHERE T1.name = 'H. V. Jagadish';
What are the codes of the countries that do not speak English and whose government forms are not Republic? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) - countrylanguage(COUNT, CountryCode, Engl, Language)
SELECT Code FROM country WHERE GovernmentForm != 'Republic' AND Code NOT IN (SELECT CountryCode FROM countrylanguage WHERE "Language" = 'English');
Find the names of users who did not leave any review.? Schema: - useracct(...) - review(i_id, rank, rating, text)
SELECT name FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review);
Find the name of dorms which have both TV Lounge and Study Room as amenities.? Schema: - Dorm(dorm_name, gender, student_capacity) - Has_amenity(dormid) - Dorm_amenity(amenity_name)
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 IN ('TV Lounge', 'Study Room') GROUP BY T1.dorm_name HAVING COUNT(DISTINCT T3.amenity_name) = 2;
Which city does has most number of customers? 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)) - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
List member names and their party names.? Schema: - member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT T1.Member_Name, T2.Party_name FROM member_ AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID;
Count the number of accounts.? Schema: - ACCOUNTS(name)
SELECT COUNT(*) AS num_accounts FROM ACCOUNTS;
Return the number of customers who have at least one order with "Cancelled" status.? Schema: - Customer_Orders(customer_id, order_date, order_id, order_shipping_charges)
SELECT COUNT(DISTINCT customer_id) AS num_customers FROM Customer_Orders WHERE order_status = 'Cancelled';
Find the first names of all professors in the Accounting department who is teaching some course and the class room.? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) - EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) - PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) - DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
SELECT T2.EMP_FNAME, T1.CLASS_ROOM FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN PROFESSOR AS T3 ON T2.EMP_NUM = T3.EMP_NUM JOIN DEPARTMENT AS T4 ON T4.DEPT_CODE = T3.DEPT_CODE WHERE T4.DEPT_NAME = 'Accounting';
What is the average price of clothes? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT AVG(product_price) AS avg_price FROM Products WHERE product_type_code = 'Clothes';
Give me the id, role and email of the professionals who did not perform any treatment on dogs.? Schema: - Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street) - Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id)
SELECT T1.professional_id, T1.role_code, T1.email_address FROM Professionals AS T1 LEFT JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id WHERE T2.professional_id IS NULL;
Find the last name of the latest contact individual of the organization "Labour Party".? Schema: - Organizations(date_formed, organization_name) - Organization_Contact_Individuals(...) - Individuals(...)
SELECT T3.individual_last_name FROM Organizations AS T1 JOIN Organization_Contact_Individuals AS T2 ON T1.organization_id = T2.organization_id JOIN Individuals AS T3 ON T2.individual_id = T3.individual_id WHERE T1.organization_name = 'Labour Party' ORDER BY T2.date_contact_to DESC NULLS LAST LIMIT 1;
What are the ids and names of accounts with 4 or more transactions? Schema: - Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type) - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
SELECT T1.account_id, T2.account_name FROM Financial_Transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id, T2.account_name HAVING COUNT(*) >= 4;
Please show the most common occupation of players.? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
SELECT Occupation FROM player WHERE Occupation IS NOT NULL GROUP BY Occupation ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
List the titles of the books in ascending order of issues.? Schema: - book(Ela, Issues, Title, Writer)
SELECT Title FROM book ORDER BY Issues ASC NULLS LAST;
What is the title of all the cartools that are on the TV Channel with the series name "Sky Radio"? 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 T2.Title FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T1.series_name = 'Sky Radio';
conference papers of subhasis chaudhuri? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'subhasis chaudhuri';
How many students are there for each major? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT Major, COUNT(*) AS num_students FROM Student GROUP BY Major;
Return the number of flights.? Schema: - flights(DestAirport, FlightNo, SourceAirport)
SELECT COUNT(*) AS num_flights FROM flights;
What is the first name and job id for all employees in the Finance department? 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)) - departments(DEPARTMENT_NAME, Market)
SELECT T1.FIRST_NAME, T1.JOB_ID FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID WHERE T2.DEPARTMENT_NAME = 'Finance';
Show all payment method codes and the number of orders for each code.? Schema: - Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code)
SELECT payment_method_code, COUNT(*) AS num_orders FROM Invoices GROUP BY payment_method_code;
What are the names of the songs whose title has the word "the"? Schema: - Songs(Title)
SELECT Title FROM Songs WHERE Title LIKE '% the %';
display those employees who joined after 7th September, 1987.? 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 * FROM employees WHERE HIRE_DATE > '1987-09-07';
Show the average transaction amount for different transaction types.? Schema: - Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code)
SELECT transaction_type_code, AVG(amount_of_transaction) AS avg_transaction_amount FROM Transactions GROUP BY transaction_type_code;
what is the biggest state in the usa? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state);
Return the names of products in the category 'Spices'.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT product_name FROM Products WHERE product_category_code = 'Spices';
Give the average number of working horses on farms with more than 5000 total horses.? Schema: - farm(Cows, Working_Horses)
SELECT AVG(Working_Horses) AS avg_working_horses FROM farm WHERE Total_Horses > 5000;
What are the department names, cities, and state provinces for each department? Schema: - departments(DEPARTMENT_NAME, Market) - locations(COUNTRY_ID)
SELECT T1.DEPARTMENT_NAME, T2.CITY, T2.STATE_PROVINCE FROM departments AS T1 JOIN locations AS T2 ON T2.LOCATION_ID = T1.LOCATION_ID;
Find the name and gender of the candidate who got the highest support rate.? 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, T1.Sex FROM people AS T1 JOIN candidate AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Support_rate DESC NULLS LAST LIMIT 1;
What are the last name and office of all history professors? Schema: - EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) - PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) - DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
SELECT T1.EMP_LNAME, T2.PROF_OFFICE FROM EMPLOYEE AS T1 JOIN PROFESSOR AS T2 ON T1.EMP_NUM = T2.EMP_NUM JOIN DEPARTMENT AS T3 ON T2.DEPT_CODE = T3.DEPT_CODE WHERE T3.DEPT_NAME = 'History';
What is the type of vocals that the band member with the last name "Heilo" played the most? Schema: - Vocals(COUNT, Type) - Band(...)
SELECT Type FROM Vocals AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id WHERE Lastname = 'Heilo' AND Type IS NOT NULL GROUP BY Type ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
In what city was " Kevin Spacey " born ? Schema: - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
SELECT birth_city FROM actor WHERE name = 'Kevin Spacey';
Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'.? Schema: - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
SELECT T1.account_id, T1.date_account_opened, T1.account_name, T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan';
What are flight numbers of flights arriving at City "Aberdeen"? Schema: - flights(DestAirport, FlightNo, SourceAirport) - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT T1.FlightNo FROM flights AS T1 JOIN airports AS T2 ON T1.DestAirport = T2.AirportCode WHERE T2.City = 'Aberdeen';
return me the number of papers in VLDB conference 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) - conference(homepage, name)
SELECT COUNT(DISTINCT T5.title) AS num_papers FROM organization AS T3 JOIN author AS T1 ON T3.oid = T1.oid JOIN writes AS T4 ON T4.aid = T1.aid JOIN publication AS T5 ON T4.pid = T5.pid JOIN conference AS T2 ON T5.cid = CAST(T2.cid AS TEXT) WHERE T2.name = 'VLDB' AND T3.name = 'University of Michigan';
What is the payment method that were used the least often? Schema: - Payments(Amount_Payment, COUNT, Date_Payment_Made, Payment_ID, Payment_Method_Code, V, amount_due, amount_paid, payment_date, payment_type_code)
SELECT Payment_Method_Code FROM Payments WHERE Payment_Method_Code IS NOT NULL GROUP BY Payment_Method_Code ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
What are the first names and department numbers for employees with last name McEwen? 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, DEPARTMENT_ID FROM employees WHERE LAST_NAME = 'McEwen';
Give the codes of document types that have more than 2 corresponding documents.? Schema: - Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more))
SELECT document_type_code FROM Documents WHERE document_type_code IS NOT NULL GROUP BY document_type_code HAVING COUNT(*) > 2;
List all public schools and their locations.? Schema: - university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School)
SELECT School, Location FROM university WHERE Affiliation = 'Public';
Count the number 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 COUNT(*) AS num_parties FROM party;
What are the distinct reigns of wrestlers whose location is not "Tokyo,Japan" ? Schema: - wrestler(COUNT, Days_held, Location, Name, Reign)
SELECT DISTINCT Reign FROM wrestler WHERE Location != 'Tokyo, Japan';
what are the states that border the state with the greatest population? Schema: - border_info(T1, border, state_name) - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT border FROM border_info WHERE state_name = (SELECT state_name FROM state WHERE population = (SELECT MAX(population) FROM state));
Question Answering experiments? 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';
List the first name and last name of all customers.? 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 first_name, last_name FROM Customers;
Return the name of the high school student with the most friends.? Schema: - Friend(student_id) - Highschooler(COUNT, ID, grade, name)
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID GROUP BY T1.student_id, T2.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Find the number of amenities for each of the dorms that can accommodate more than 100 students.? Schema: - Dorm(dorm_name, gender, student_capacity) - Has_amenity(dormid)
SELECT COUNT(*) AS num_amenities, T1.dormid FROM Dorm AS T1 JOIN Has_amenity AS T2 ON T1.dormid = T2.dormid WHERE T1.student_capacity > 100 GROUP BY T1.dormid;
Show all allergies with number of students affected.? Schema: - Has_Allergy(Allergy, COUNT, StuID)
SELECT Allergy, COUNT(*) AS num_students FROM Has_Allergy GROUP BY Allergy;
What is the total number of faculty members? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
SELECT COUNT(*) AS num_faculty FROM Faculty;
in what venues does Peter Mertens publish ? Schema: - venue(venueId, venueName) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - writes(...) - author(...)
SELECT DISTINCT T3.journalId, T4.venueId 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 = 'Peter Mertens';
Show the name of colleges that have at least two players in descending alphabetical order.? Schema: - match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team)
SELECT College FROM match_season WHERE College IS NOT NULL GROUP BY College HAVING COUNT(*) >= 2 ORDER BY College DESC NULLS LAST;
What are the course codes for every class that the student with the last name 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';
What did Liwen Xiong published in 2015 ? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'Liwen Xiong' AND T3."year" = 2015;
What is the name of the airport with the most number of routes that start in China? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) - routes(...)
SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid WHERE T1.country = 'China' GROUP BY T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the average horsepower for all cars produced before 1980 ? Schema: - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT AVG(Horsepower) AS avg_horsepower FROM cars_data WHERE "Year" < 1980;
List all document ids with at least two 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;
Show the name of ships whose nationality is either United States or United Kingdom.? Schema: - ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage)
SELECT Name FROM ship WHERE Nationality = 'United States' OR Nationality = 'United Kingdom';
What are all the different start station names for a trip that lasted less than 100? Schema: - trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code)
SELECT DISTINCT start_station_name FROM trip WHERE duration < 100;
Return the name, phone number and email address for the customer with the most orders.? Schema: - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) - Customer_Orders(customer_id, order_date, order_id, order_shipping_charges)
SELECT T1.customer_name, T1.customer_phone, T1.customer_email FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id, T1.customer_name, T1.customer_phone, T1.customer_email ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Find the name of tracks which are in Movies playlist but not in music playlist.? Schema: - tracks(composer, milliseconds, name, unit_price) - playlist_tracks(...) - playlists(name)
SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' AND T1.name NOT IN (SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music');
Who writes a lot of papers in Machine Learning ? Schema: - paperKeyphrase(...) - keyphrase(...) - writes(...) - author(...)
SELECT T1.authorName FROM paperKeyphrase AS T2 JOIN keyphrase AS T4 ON T2.keyphraseId = T4.keyphraseId JOIN writes AS T3 ON T3.paperId = T2.paperId JOIN author AS T1 ON T3.authorId = T1.authorId WHERE T4.keyphraseName = 'Machine Learning' GROUP BY T1.authorName ORDER BY COUNT(DISTINCT T3.paperId) DESC NULLS LAST;
Find the first name of student who is taking classes from accounting and Computer Info. Systems departments? Schema: - STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE) - ENROLL(...) - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) - COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE) - DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
SELECT T1.STU_FNAME FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM JOIN CLASS AS T3 ON T2.CLASS_CODE = T3.CLASS_CODE JOIN COURSE AS T4 ON T3.CRS_CODE = T4.CRS_CODE JOIN DEPARTMENT AS T5 ON T5.DEPT_CODE = T4.DEPT_CODE WHERE T5.DEPT_NAME = 'Accounting' AND EXISTS (SELECT 1 FROM ENROLL AS T2_sub JOIN CLASS AS T3_sub ON T2_sub.CLASS_CODE = T3_sub.CLASS_CODE JOIN COURSE AS T4_sub ON T3_sub.CRS_CODE = T4_sub.CRS_CODE JOIN DEPARTMENT AS T5_sub ON T5_sub.DEPT_CODE = T4_sub.DEPT_CODE WHERE T5_sub.DEPT_NAME = 'Computer Info. Systems' AND T1.STU_NUM = T2_sub.STU_NUM);
Find the last names of teachers who are not involved in any detention.? Schema: - Teachers(email_address, first_name, gender, last_name) - Detention(detention_summary, detention_type_code)
SELECT DISTINCT last_name FROM Teachers WHERE last_name NOT IN (SELECT T1.last_name FROM Teachers AS T1 JOIN Detention AS T2 ON T1.teacher_id = T2.teacher_id);
which states have points that are higher than the highest point in colorado? Schema: - highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
SELECT state_name FROM highlow WHERE highest_elevation > (SELECT highest_elevation FROM highlow WHERE state_name = 'colorado');
What is the language used most often in the songs? Schema: - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT languages FROM song WHERE languages IS NOT NULL GROUP BY languages ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
For each shop, return the number of employees working there and the name of the shop.? Schema: - hiring(...) - shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more))
SELECT COUNT(*) AS num_employees, T2.Name FROM hiring AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T2.Name;
Which organisation type hires most research staff? Schema: - Organisations(...) - Research_Staff(staff_details)
SELECT T1.organisation_type FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_type ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
List the name of singers that do not have any song.? Schema: - singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT Name FROM singer WHERE Singer_ID NOT IN (SELECT Singer_ID FROM song);
What are the last names and ids of all drivers who had 11 pit stops and participated in more than 5 races? Schema: - drivers(forename, nationality, surname) - pitStops(driverId, raceId, stop) - results(...)
SELECT DISTINCT T1.surname, T1.driverId FROM (SELECT T1.surname, T1.driverId FROM drivers AS T1 JOIN pitStops AS T2 ON T1.driverId = T2.driverId GROUP BY T1.surname, T1.driverId HAVING COUNT(*) = 11) AS T1 JOIN (SELECT T1.surname, T1.driverId FROM drivers AS T1 JOIN results AS T2 ON T1.driverId = T2.driverId GROUP BY T1.surname, T1.driverId HAVING COUNT(*) > 5) AS T3 ON T1.driverId = T3.driverId;
Show the name of the building that has the most company offices.? Schema: - Office_locations(...) - buildings(Height, Status, Stories, name) - Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name)
SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T1.building_id, T2.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Find the name of airports whose altitude is between -50 and 50.? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT name FROM airports WHERE elevation BETWEEN -50 AND 50;
Find the names of channels that are not owned by CCTV.? Schema: - channel(Name, Owner, Rating_in_percent, Share_in_percent)
SELECT Name FROM channel WHERE Owner != 'CCTV';
How many different FDA approval statuses exist for medicines? Schema: - medicine(FDA_approved, Trade_Name, name)
SELECT COUNT(DISTINCT FDA_approved) AS num_statuses FROM medicine;
Show the product type codes that have both products with price higher than 4500 and products with price lower than 3000.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT DISTINCT T1.Product_Type_Code FROM Products AS T1 JOIN Products AS T2 ON T1.Product_Type_Code = T2.Product_Type_Code WHERE T1.Product_Price > 4500 AND T2.Product_Price < 3000;
Show all card type codes and the number of cards in each type.? Schema: - Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to)
SELECT card_type_code, COUNT(*) AS num_cards FROM Customers_Cards GROUP BY card_type_code;
Find the name of all customers whose name contains "Alex".? 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_name FROM Customers WHERE customer_name LIKE '%Alex%';
Find the name and rank of the 3 youngest winners across all matches.? Schema: - matches_(COUNT, T1, loser_age, loser_name, minutes, tourney_name, winner_age, winner_hand, winner_name, winner_rank, winner_rank_points, year)
SELECT winner_name, winner_rank FROM matches_ WHERE winner_name IS NOT NULL AND winner_rank IS NOT NULL AND winner_age IS NOT NULL GROUP BY winner_name, winner_rank, winner_age ORDER BY winner_age ASC NULLS LAST LIMIT 3;
what are name and phone number of patients who had more than one appointment? Schema: - Appointment(AppointmentID, Start) - Patient(...)
SELECT Name, Phone FROM Appointment AS T1 JOIN Patient AS T2 ON T1.Patient = T2.SSN GROUP BY T1.Patient, Name, Phone HAVING COUNT(*) > 1;
Show the dates, places, and names of events in descending order of the attendance.? Schema: - event(Date, Event_Attendance, Name, Venue, Year)
SELECT "Date", Name, Venue FROM event ORDER BY Event_Attendance DESC NULLS LAST;
Find the names of all modern rooms with a base price below $160 and two beds.? Schema: - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT roomName FROM Rooms WHERE basePrice < 160 AND beds = 2 AND decor = 'modern';