question
stringlengths
43
589
query
stringlengths
19
598
List the names of all the customers in alphabetical order.? 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_Details FROM Customers ORDER BY Customer_Details ASC NULLS LAST;
What is the model of the car with the smallest amount of horsepower? Schema: - car_names(COUNT, Model) - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT T1.Model FROM car_names AS T1 JOIN cars_data AS T2 ON T1.MakeId = T2.Id ORDER BY T2.Horsepower ASC NULLS LAST LIMIT 1;
Find the id of the order made most recently.? Schema: - Orders(customer_id, date_order_placed, order_id)
SELECT order_id FROM Orders ORDER BY date_order_placed DESC NULLS LAST LIMIT 1;
How many female people are older than 30 in our record? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
SELECT COUNT(*) AS num_females FROM people WHERE Is_Male = 'F' AND Age > 30;
For the oldest movie listed, what is its average rating and title? Schema: - Rating(Rat, mID, rID, stars) - Movie(T1, director, title, year)
SELECT AVG(T1.stars) AS avg_rating, T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2."year" = (SELECT MIN("year") FROM Movie) GROUP BY T2.title;
What are the names of the nations with the 3 lowest populations? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
SELECT Name FROM country ORDER BY Population ASC NULLS LAST LIMIT 3;
What is the sum of revenue from companies with headquarters in Austin? Schema: - Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue)
SELECT SUM(Revenue) AS total_revenue FROM Manufacturers WHERE Headquarter = 'Austin';
Show card number, name, and hometown for all members in a descending order of level.? Schema: - member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
SELECT Card_Number, Name, Hometown FROM member_ ORDER BY Level DESC NULLS LAST;
What are the names of all the subjects.? Schema: - Subjects(subject_name)
SELECT subject_name FROM Subjects;
What are the codes of the locations with at least three documents? Schema: - Document_Locations(COUNT, Date_in_Location_From, Date_in_Locaton_To, Location_Code)
SELECT Location_Code FROM Document_Locations WHERE Location_Code IS NOT NULL GROUP BY Location_Code HAVING COUNT(*) >= 3;
papers by Liwen Xiong 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 are the customer ids for customers who do not have an account? 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)) - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
SELECT Customers.customer_id FROM Customers LEFT JOIN Accounts ON Customers.customer_id = Accounts.customer_id WHERE Accounts.customer_id IS NULL;
Find the name, headquarter and revenue of all manufacturers sorted by their revenue in the descending order.? Schema: - Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue)
SELECT Name, Headquarter, Revenue FROM Manufacturers ORDER BY Revenue DESC NULLS LAST;
return me the author who 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) - 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' GROUP BY T2.name ORDER BY COUNT(DISTINCT T3.title) DESC NULLS LAST LIMIT 1;
Find the name of the department that has no students minored in? Schema: - Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2) - Minor_in(...)
SELECT DName FROM Department WHERE DName NOT IN (SELECT T1.DName FROM Department AS T1 JOIN Minor_in AS T2 ON T1.DNO = T2.DNO);
Show the names of phones with carrier either "Sprint" or "TMobile".? Schema: - phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode)
SELECT Name FROM phone WHERE Carrier = 'Sprint' OR Carrier = 'TMobile';
Show all school names in alphabetical order.? Schema: - School(County, Enrollment, Location, Mascot, School_name)
SELECT School_name FROM School ORDER BY School_name ASC NULLS LAST;
What is the salaray and name of the employee with the most certificates to fly planes more than 5000? Schema: - employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) - certificate(eid) - aircraft(Description, aid, d, distance, name)
SELECT T1.name FROM employee AS T1 JOIN certificate AS T2 ON T1.eid = T2.eid JOIN aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid, T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the color description of the product with name "catnip"? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) - Ref_Colors(color_description)
SELECT T2.color_description FROM Products AS T1 JOIN Ref_Colors AS T2 ON T1.color_code = T2.color_code WHERE T1.product_name = 'catnip';
monte carlo simulation papers since 2011? 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 = 'monte carlo simulation' AND T3."year" > 2011;
Which physicians are trained in procedures that are more expensive than 5000? Schema: - Physician(I, Name) - Trained_In(...) - Procedures(Cost, Name)
SELECT T1.Name FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment WHERE T3.Cost > 5000;
Return the country name and the numbers of languages spoken for each country that speaks at least 3 languages.? 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 COUNT(T2."Language") AS num_languages, T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Name HAVING COUNT(*) > 2;
List the names of members in ascending alphabetical order.? Schema: - member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
SELECT Name FROM member_ ORDER BY Name ASC NULLS LAST;
Who is the oldest person? Schema: - Person(M, age, city, eng, gender, job, name)
SELECT name FROM Person WHERE age = (SELECT MAX(age) FROM Person);
What is the first name and the last name of the customer who made the earliest rental? Schema: - customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) - rental(...)
SELECT T1.first_name, T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date ASC NULLS LAST LIMIT 1;
what city has the largest population? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT city_name FROM city WHERE population = (SELECT MAX(population) FROM city);
Return the full name and phone of the customer who has card number 4560596484842.? Schema: - Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to) - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
SELECT T2.customer_first_name, T2.customer_last_name, T2.customer_phone FROM Customers_Cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = '4560596484842';
Return the dates of birth for entrepreneurs who have either the investor Simon Woodroffe or Peter Jones.? Schema: - entrepreneur(COUNT, Company, Investor, Money_Requested) - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
SELECT T2.Date_of_Birth FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor = 'Simon Woodroffe' OR T1.Investor = 'Peter Jones';
Who is the person that has no friend? Schema: - Person(M, age, city, eng, gender, job, name) - PersonFriend(M, friend, name)
SELECT name FROM Person WHERE name NOT IN (SELECT name FROM PersonFriend);
Show the distinct countries of managers.? Schema: - manager(Age, Country, Level, Name, Working_year_starts, m1)
SELECT DISTINCT Country FROM manager;
What are the names of all colleges with a larger enrollment than the largest college in Florida? Schema: - College(M, cName, enr, state)
SELECT cName FROM College WHERE enr > (SELECT MAX(enr) FROM College WHERE state = 'FL');
Show the id and name of the employee with maximum salary.? Schema: - employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
SELECT eid, name FROM employee ORDER BY salary DESC NULLS LAST LIMIT 1;
Count the number of schools.? Schema: - school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type)
SELECT COUNT(*) AS num_schools FROM school;
Which employee received the most awards in evaluations? Give me the employee name.? Schema: - employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) - evaluation(Bonus)
SELECT T1.Name FROM employee AS T1 JOIN evaluation AS T2 ON CAST(T1.Employee_ID AS TEXT) = T2.Employee_ID GROUP BY T2.Employee_ID, T1.Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the names and decor of rooms with a king bed? Sort them by their price? Schema: - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT roomName, decor FROM Rooms WHERE bedType = 'King' ORDER BY basePrice ASC NULLS LAST;
What is the name of the student who has the highest total credits in the History department.? Schema: - student(COUNT, H, dept_name, name, tot_cred)
SELECT name FROM student WHERE dept_name = 'History' ORDER BY tot_cred DESC NULLS LAST LIMIT 1;
Find the government form name and total population for each government form whose average life expectancy is longer than 72.? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
SELECT SUM(Population) AS total_population, GovernmentForm FROM country WHERE GovernmentForm IS NOT NULL GROUP BY GovernmentForm HAVING AVG(LifeExpectancy) > 72;
Count the number of games taken place in park "Columbia Park" in 1907.? Schema: - home_game(attendance, year) - park(city, state)
SELECT COUNT(*) AS num_games FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1."year" = 1907 AND T2.park_name = 'Columbia Park';
Find all the name of documents without any sections.? Schema: - Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more)) - Document_Sections(...)
SELECT document_name FROM Documents WHERE document_code NOT IN (SELECT document_code FROM Document_Sections);
Please show the record formats of orchestras in ascending order of count.? Schema: - orchestra(COUNT, Major_Record_Format, Record_Company, Year_of_Founded)
SELECT Major_Record_Format FROM orchestra WHERE Major_Record_Format IS NOT NULL GROUP BY Major_Record_Format ORDER BY COUNT(*) ASC NULLS LAST;
What are the customer id and name corresponding to accounts with a checking balance less than the largest checking balance? Schema: - ACCOUNTS(name) - CHECKING(balance)
SELECT T1.custid, T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT MAX(balance) FROM CHECKING);
Show me the classrooms grade 5 is using.? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName)
SELECT DISTINCT Classroom FROM list WHERE Grade = 5;
Find the names of customers who ordered both products Latte and Americano.? 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) - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
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 JOIN Products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_details = 'Latte' AND EXISTS (SELECT 1 FROM Customer_Orders AS T2_sub JOIN Order_Items AS T3_sub ON t2_sub.order_id = t3_sub.order_id JOIN Products AS T4_sub ON t3_sub.product_id = t4_sub.product_id WHERE t4_sub.product_details = 'Americano' AND T1.customer_id = t2_sub.customer_id);
Return the average number of weeks on top for volumes by artists that are at most 25 years old.? Schema: - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) - volume(Artist_ID, Issue_Date, Song, Weeks_on_Top)
SELECT AVG(T2.Weeks_on_Top) AS avg_weeks_on_top FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Age <= 25;
How old is each student and how many students are each age? 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;
What are the first name, last name, and phone number of all the female faculty members? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
SELECT Fname, Lname, Phone FROM Faculty WHERE Sex = 'F';
pldi 2015 list of papers? Schema: - venue(venueId, venueName) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T1.paperId FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T1."year" = 2015 AND T2.venueName = 'pldi';
which states border states through which the mississippi traverses? Schema: - border_info(T1, border, state_name) - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT border FROM border_info WHERE state_name IN (SELECT traverse FROM river WHERE river_name = 'mississippi');
display those departments where more than ten employees work who got a commission percentage.? 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 DEPARTMENT_ID FROM employees WHERE DEPARTMENT_ID IS NOT NULL GROUP BY DEPARTMENT_ID HAVING COUNT(COMMISSION_PCT) > 10;
How many papers have "Atsushi Ohori" published? Schema: - Authors(fname, lname) - Authorship(...) - Papers(title)
SELECT COUNT(*) AS num_papers FROM Authors AS T1 JOIN Authorship AS T2 ON T1.authID = T2.authID JOIN Papers AS T3 ON T2.paperID = T3.paperID WHERE T1.fname = 'Atsushi' AND T1.lname = 'Ohori';
Find the name and nationality of the swimmer who has won (i.e., has a result of "win") more than 1 time.? Schema: - swimmer(Name, Nationality, meter_100, meter_200, meter_300) - record(...)
SELECT T1.Name, T1.Nationality FROM swimmer AS T1 JOIN record AS T2 ON T1.ID = T2.Swimmer_ID WHERE "Result" = 'Win' GROUP BY T2.Swimmer_ID, T1.Name, T1.Nationality HAVING COUNT(*) > 1;
How many students does LORIA ONDERSMA teaches? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName) - teachers(Classroom, FirstName, LastName)
SELECT COUNT(*) AS num_students FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T2.FirstName = 'LORIA' AND T2.LastName = 'ONDERSMA';
Which papers have the substring "ML" in their titles? Return the titles of the papers.? Schema: - Papers(title)
SELECT title FROM Papers WHERE title LIKE '%ML%';
What is the id of every employee who has at least a salary of 100000? Schema: - employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
SELECT eid FROM employee WHERE salary > 100000;
What is the first name and last name employee helps the customer with first name Leonie? Schema: - Customer(Email, FirstName, LastName, State, lu) - Employee(BirthDate, City, FirstName, LastName, Phone)
SELECT T2.FirstName, T2.LastName FROM Customer AS T1 JOIN Employee AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = 'Leonie';
List the names of aircrafts and that won matches at least twice.? Schema: - aircraft(Description, aid, d, distance, name) - match_(Competition, Date, Match_ID, Venue)
SELECT T1.Aircraft FROM aircraft AS T1 JOIN match_ AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T1.Aircraft_ID, T1.Aircraft HAVING COUNT(*) >= 2;
What is the code of each location and the number of documents in that location? Schema: - Document_Locations(COUNT, Date_in_Location_From, Date_in_Locaton_To, Location_Code)
SELECT Location_Code, COUNT(*) AS num_documents FROM Document_Locations GROUP BY Location_Code;
Show the names of conductors and the orchestras they have conducted.? Schema: - conductor(Age, Name, Nationality, Year_of_Work) - orchestra(COUNT, Major_Record_Format, Record_Company, Year_of_Founded)
SELECT T1.Name, T2.Orchestra FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID;
How many patients' prescriptions are made by physician John Dorian? Schema: - Patient(...) - Prescribes(...) - Physician(I, Name)
SELECT COUNT(T1.SSN) AS num_patients FROM Patient AS T1 JOIN Prescribes AS T2 ON T1.SSN = T2.Patient JOIN Physician AS T3 ON T2.Physician = T3.EmployeeID WHERE T3.Name = 'John Dorian';
Which distinct source system code includes the substring 'en'? Schema: - CMI_Cross_References(source_system_code)
SELECT DISTINCT source_system_code FROM CMI_Cross_References WHERE source_system_code LIKE '%en%';
papers about Question Answering? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.keyphraseName = 'Question Answering';
where is the best american in the bay area ? 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.city_name WHERE T2.region = 'bay area' AND T1.food_type = 'american');
Find the name of the customer who made an order most recently.? 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 FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.order_date DESC NULLS LAST LIMIT 1;
Find the description of the claim status "Open".? Schema: - Claims_Processing_Stages(Claim_Status_Description, Claim_Status_Name)
SELECT Claim_Status_Description FROM Claims_Processing_Stages WHERE Claim_Status_Name = 'Open';
how many people live in california? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT population FROM state WHERE state_name = 'california';
where can i eat some good arabic food on buchanan in san francisco ? 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 T2.street_name = 'buchanan' AND T1.food_type = 'arabic' AND T1.rating > 2.5;
Give me the average and minimum price (in Euro) of the products.? Schema: - Catalog_Contents(capacity, catalog_entry_name, height, next_entry_id, price_in_dollars, price_in_euros, product_stock_number)
SELECT AVG(price_in_euros) AS avg_price_in_euros, MIN(price_in_euros) AS min_price_in_euros FROM Catalog_Contents;
What are the locations of all the gas stations ordered by opening year? Schema: - gas_station(COUNT, Location, Manager_Name, Open_Year, Station_ID)
SELECT Location FROM gas_station ORDER BY Open_Year ASC NULLS LAST;
Find the location and all games score of the school that has Clemson as its team name.? Schema: - university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School) - basketball_match(ACC_Percent, All_Home, School_ID, Team_Name)
SELECT T2.All_Games, T1.Location FROM university AS T1 JOIN basketball_match AS T2 ON T1.School_ID = T2.School_ID WHERE Team_Name = 'Clemson';
Show the apartment numbers of apartments with unit status availability of both 0 and 1.? Schema: - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count) - View_Unit_Status(...)
SELECT DISTINCT T3.apt_number FROM (SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 0) AS T3 JOIN (SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 1) AS T4 ON T3.apt_number = T4.apt_number;
What are the first names and last names of the employees who live in Calgary city.? Schema: - Employee(BirthDate, City, FirstName, LastName, Phone)
SELECT FirstName, LastName FROM Employee WHERE City = 'Calgary';
Which fault log included the most number of faulty parts? List the fault log id, description and record time.? Schema: - Fault_Log(...) - Fault_Log_Parts(fault_status)
SELECT T1.fault_log_entry_id, T1.fault_description, T1.fault_log_entry_datetime FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id, T1.fault_description, T1.fault_log_entry_datetime ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the average and maximum number of tickets bought in all visits? Schema: - visit(...)
SELECT AVG(Num_of_Ticket) AS avg_num_of_tickets, MAX(Num_of_Ticket) AS max_num_of_tickets FROM visit;
Find all tips about " Vintner Grill " that received more than 9 likes? Schema: - tip(month, text) - business(business_id, city, full_address, name, rating, review_count, state)
SELECT T2."text" FROM tip AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T1.name = 'Vintner Grill' AND T2.likes > 9;
Show all cities where students live.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT DISTINCT city_code FROM Student;
What is the name of the bank branch with the greatest number of customers? Schema: - bank(SUM, bname, city, morn, no_of_customers, state)
SELECT bname FROM bank ORDER BY no_of_customers DESC NULLS LAST LIMIT 1;
what is the longest river in the state with the most major cities? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT river_name FROM river WHERE traverse = (SELECT state_name FROM city WHERE population > 150000 AND state_name IS NOT NULL GROUP BY state_name ORDER BY COUNT(city_name) DESC NULLS LAST LIMIT 1) ORDER BY LENGTH DESC NULLS LAST LIMIT 1;
What are the numbers of constructors for different nationalities? Schema: - constructors(nationality)
SELECT COUNT(*) AS num_constructors, nationality FROM constructors GROUP BY nationality;
What are the dates with a maximum temperature higher than 85? 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" FROM weather WHERE max_temperature_f > 85;
What are the document ids for the budget type code 'SF'? Schema: - Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID)
SELECT Document_ID FROM Documents_with_Expenses WHERE Budget_Type_Code = 'SF';
Which cities' temperature in March is lower than that in July or higher than that in Oct? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) - temperature(...)
SELECT T1.City FROM city AS T1 JOIN temperature AS T2 ON T1.City_ID = T2.City_ID WHERE T2.Mar < T2.Jul OR T2.Mar > T2.Oct;
Return the official native languages of countries who have players from Maryland or Duke colleges.? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) - match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team)
SELECT T1.Official_native_language FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.College = 'Maryland' OR T2.College = 'Duke';
For each id of a driver who participated in at most 30 races, how many races did they participate in? Schema: - drivers(forename, nationality, surname) - results(...) - races(date, name)
SELECT T1.driverId, COUNT(*) AS num_races FROM drivers AS T1 JOIN results AS T2 ON T1.driverId = T2.driverId JOIN races AS T3 ON T2.raceId = T3.raceId GROUP BY T1.driverId HAVING COUNT(*) <= 30;
What is the number of makers of care in France? Schema: - car_makers(...) - countries(...)
SELECT COUNT(*) AS num_makers FROM car_makers AS T1 JOIN countries AS T2 ON T1.CountryId = T2.CountryId WHERE T2.CountryName = 'france';
what is the area of the largest state? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT MAX(area) AS max_area FROM state;
How many airlines are from USA? Schema: - airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
SELECT COUNT(*) AS num_airlines FROM airlines WHERE Country = 'USA';
What is the label with the most albums? Schema: - Albums(COUNT, Label, Title)
SELECT Label FROM Albums WHERE Label IS NOT NULL GROUP BY Label ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the average age of female (sex is F) students? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT AVG(Age) AS avg_age FROM Student WHERE Sex = 'F';
How many storms occured in 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;
Show the type of school and the number of buses for each type.? Schema: - school_bus(Years_Working) - school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type)
SELECT T2.Type, COUNT(*) AS num_buses FROM school_bus AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T2.Type;
Find the enrollment date for all the tests that have "Pass" 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_enrolment FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = 'Pass';
What is the most common birth place of people? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
SELECT Birth_Place FROM people WHERE Birth_Place IS NOT NULL GROUP BY Birth_Place ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the name of department where has the smallest number of professors? Schema: - PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) - DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
SELECT T2.DEPT_NAME FROM PROFESSOR AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.DEPT_CODE, T2.DEPT_NAME ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
List each test result and its count in descending order of count.? Schema: - Student_Tests_Taken(date_test_taken, test_result)
SELECT test_result, COUNT(*) AS num_tests FROM Student_Tests_Taken WHERE test_result IS NOT NULL GROUP BY test_result ORDER BY num_tests DESC NULLS LAST;
where can we find a 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';
Give the title and credits for the course that is taught in the classroom with the greatest capacity.? Schema: - classroom(building, capacity, room_number) - section(COUNT, JO, Spr, T1, course_id, semester, year) - course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
SELECT T3.title, T3.credits FROM classroom AS T1 JOIN section AS T2 ON T1.building = T2.building AND T1.room_number = T2.room_number JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.capacity = (SELECT MAX(capacity) FROM classroom);
List the name of all customers sorted by their account balance in ascending order.? Schema: - customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id)
SELECT cust_name FROM customer ORDER BY acc_bal ASC NULLS LAST;
order all gas station locations by the opening year.? Schema: - gas_station(COUNT, Location, Manager_Name, Open_Year, Station_ID)
SELECT Location FROM gas_station ORDER BY Open_Year ASC NULLS LAST;
what is the elevation of death valley? Schema: - highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
SELECT lowest_elevation FROM highlow WHERE lowest_point = 'death valley';
Find the name and gender type of the dorms whose capacity is greater than 300 or less than 100.? Schema: - Dorm(dorm_name, gender, student_capacity)
SELECT dorm_name, gender FROM Dorm WHERE student_capacity > 300 OR student_capacity < 100;