question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
list all the reviews by Niloofar?
Schema:
- user_(name)
- review(i_id, rank, rating, text) | SELECT T1."text" FROM user_ AS T2 JOIN review AS T1 ON T2.user_id = T1.user_id WHERE T2.name = 'Niloofar'; |
find the event names that have more than 2 records.?
Schema:
- party_events(Event_Name) | SELECT Event_Name FROM party_events WHERE Event_Name IS NOT NULL GROUP BY Event_Name HAVING COUNT(*) > 2; |
What are the first and last names of all students who are not living in the city HKG and order the results by age?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Fname, LName FROM Student WHERE city_code != 'HKG' ORDER BY Age ASC NULLS LAST; |
Display the first name and department name for each employee.?
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, T2.DEPARTMENT_NAME FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID; |
What is the TV Channel that shows the cartoon "The Rise of the Blue Beetle!"? List the TV Channel's series name.?
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 T1.series_name FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T2.Title = 'The Rise of the Blue Beetle!'; |
Show each student's first name and last name.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName) | SELECT DISTINCT FirstName, LastName FROM list; |
How many cards does customer Art Turcotte have?
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 COUNT(*) AS num_cards FROM Customers_Cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Art' AND T2.customer_last_name = 'Turcotte'; |
Which locations are shared by more than two wrestlers?
Schema:
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT Location FROM wrestler WHERE Location IS NOT NULL GROUP BY Location HAVING COUNT(*) > 2; |
What is the name and hours for the project which has the most scientists assigned to it?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
- AssignedTo(Scientist) | SELECT T1.Name, T1.Hours FROM Projects AS T1 JOIN AssignedTo AS T2 ON T1.Code = T2.Project GROUP BY T2.Project, T1.Name, T1.Hours ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the different locations of the school with the code BUS?
Schema:
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT COUNT(DISTINCT DEPT_ADDRESS) AS num_locations FROM DEPARTMENT WHERE SCHOOL_CODE = 'BUS'; |
What are the full names, departments, cities, and state provinces for each employee?
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)
- locations(COUNTRY_ID) | SELECT T1.FIRST_NAME, T1.LAST_NAME, T2.DEPARTMENT_NAME, T3.CITY, T3.STATE_PROVINCE FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID JOIN locations AS T3 ON T2.LOCATION_ID = T3.LOCATION_ID; |
What is the total count of teachers?
Schema:
- teacher(Age, COUNT, D, Hometown, Name) | SELECT COUNT(*) AS num_teachers FROM teacher; |
Return the names and ids of all products whose price is 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; |
What is the oldest age among the students?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT MAX(Age) AS max_age FROM Student; |
Find Alice's friends of friends.?
Schema:
- PersonFriend(M, friend, name)
- Person(M, age, city, eng, gender, job, name) | SELECT DISTINCT T4.name FROM PersonFriend AS T1 JOIN Person AS T2 ON T1.name = T2.name JOIN PersonFriend AS T3 ON T1.friend = T3.name JOIN PersonFriend AS T4 ON T3.friend = T4.name WHERE T2.name = 'Alice' AND T4.name != 'Alice'; |
How many museums were opened after 2013 or before 2008?
Schema:
- museum(Name, Open_Year) | SELECT COUNT(*) AS num_museums FROM museum WHERE Open_Year > 2013 OR Open_Year < 2008; |
How old is the doctor named Zach?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT age FROM Person WHERE job = 'doctor' AND name = 'Zach'; |
What are the names of all the songs whose album is under the label of "Universal Music Group"?
Schema:
- Albums(COUNT, Label, Title)
- Tracklists(...)
- Songs(Title) | SELECT T3.Title FROM Albums AS T1 JOIN Tracklists AS T2 ON T1.AId = T2.AlbumId JOIN Songs AS T3 ON T2.SongId = T3.SongId WHERE T1.Label = 'Universal Music Group'; |
Find the capacity and gender type of the dorm whose name has substring ‘Donor’.?
Schema:
- Dorm(dorm_name, gender, student_capacity) | SELECT student_capacity, gender FROM Dorm WHERE dorm_name LIKE '%Donor%'; |
On which day was the order placed whose shipment tracking number is 3452?
Schema:
- Orders(customer_id, date_order_placed, order_id)
- Shipments(order_id, shipment_date, shipment_tracking_number) | SELECT T1.date_order_placed FROM Orders AS T1 JOIN Shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.shipment_tracking_number = '3452'; |
return me the journals, which have more than 10 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' GROUP BY T2.name HAVING COUNT(DISTINCT T4.title) > 10; |
Show the colleges that have both authors with submission score larger than 90 and authors with submission score smaller than 80.?
Schema:
- submission(Author, COUNT, College, Scores) | SELECT College FROM submission WHERE Scores > 90 OR Scores < 80 AND College IS NOT NULL GROUP BY College HAVING COUNT(DISTINCT CASE WHEN Scores > 90 THEN 'High' WHEN Scores < 80 THEN 'Low' END) = 2; |
what are the populations of the states through which the mississippi river run?
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 population FROM state WHERE state_name IN (SELECT traverse FROM river WHERE river_name = 'mississippi'); |
papers citing Daniel Jurafsky?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...)
- writes(...)
- author(...) | SELECT DISTINCT T3.paperId FROM paper AS T3 JOIN cite AS T4 ON T3.paperId = T4.citingPaperId JOIN writes AS T2 ON T2.paperId = T4.citedPaperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'Daniel Jurafsky'; |
List the state in the US with the most invoices.?
Schema:
- invoices(billing_city, billing_country, billing_state, total) | SELECT billing_state, COUNT(*) AS num_invoices FROM invoices WHERE billing_country = 'USA' AND billing_state IS NOT NULL GROUP BY billing_state ORDER BY num_invoices DESC NULLS LAST LIMIT 1; |
What is the country in which the customer Carole Bernhard lived?
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.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = 'Carole' AND T1.last_name = 'Bernhard'; |
Count the number of times the team "Boston Red Stockings" lost in 2009 postseason.?
Schema:
- postseason(ties)
- team(Name) | SELECT COUNT(*) AS num_losses FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_loser = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1."year" = 2009; |
How many kinds of roles are there for the staff?
Schema:
- Project_Staff(COUNT, date_from, date_to, role_code) | SELECT COUNT(DISTINCT role_code) AS num_roles FROM Project_Staff; |
What are the invoice numbers created before 1989-09-03 or after 2007-12-25?
Schema:
- Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code) | SELECT invoice_number FROM Invoices WHERE invoice_date < '1989-09-03 23:59:59' OR invoice_date > '2007-12-25 00:00:00'; |
Return the full name of the customer who made the first 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; |
Find the classroom that the most students use.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName) | SELECT Classroom FROM list WHERE Classroom IS NOT NULL GROUP BY Classroom ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the tracks that Dean Peeters bought?
Schema:
- tracks(composer, milliseconds, name, unit_price)
- invoice_lines(...)
- invoices(billing_city, billing_country, billing_state, total)
- customers(Mart, city, company, country, email, first_name, last_name, phone, state) | SELECT T1.name FROM tracks AS T1 JOIN invoice_lines AS T2 ON T1.id = T2.track_id JOIN invoices AS T3 ON T3.id = T2.invoice_id JOIN customers AS T4 ON T4.id = T3.customer_id WHERE T4.first_name = 'Daan' AND T4.last_name = 'Peeters'; |
Show the apartment numbers of apartments with bookings that have status code both "Provisional" and "Confirmed"?
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; |
List document id of documents status is done and document type is Paper and the document is shipped by shipping agent named USPS.?
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))
- Ref_Shipping_Agents(shipping_agent_code, shipping_agent_name) | SELECT DISTINCT document_id FROM Documents LEFT JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE document_status_code = 'done' AND document_type_code = 'Paper' AND (Ref_Shipping_Agents.shipping_agent_name = 'USPS' OR Ref_Shipping_Agents.shipping_agent_name IS NULL); |
Return the money rank of the poker player with the greatest height.?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- poker_player(Best_Finish, Earnings, Final_Table_Made, Money_Rank) | SELECT T2.Money_Rank FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Height DESC NULLS LAST LIMIT 1; |
Show the names of counties that have at least two delegates.?
Schema:
- county(County_name, Population, Zip_code)
- election(Committee, Date, Delegate, District, Vote_Percent, Votes) | SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District GROUP BY T1.County_Id, T1.County_name HAVING COUNT(*) >= 2; |
What are the student ids of students who don't have any allergies?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Allergy(Allergy, COUNT, StuID) | SELECT StuID FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_Allergy); |
Return the owner id, first name and last name of the owner who has the most dogs.?
Schema:
- Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
- Owners(email_address, first_name, last_name, state) | SELECT T1.owner_id, T2.first_name, T2.last_name FROM Dogs AS T1 JOIN Owners AS T2 ON T1.owner_id = T2.owner_id GROUP BY T1.owner_id, T2.first_name, T2.last_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the names of products whose availability equals to 1?
Schema:
- View_Product_Availability(...)
- Products_for_Hire(daily_hire_cost, product_description, product_name, product_type_code) | SELECT T2.product_name FROM View_Product_Availability AS T1 JOIN Products_for_Hire AS T2 ON T1.product_id = T2.product_id WHERE T1.available_yn = '1'; |
what is the population of the capital of the smallest state?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT population FROM city WHERE city_name = (SELECT capital FROM state WHERE area = (SELECT MIN(area) FROM state)); |
Tell me the the date when the first claim was made.?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled) | SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC NULLS LAST LIMIT 1; |
what is the highest point in states bordering colorado?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
- border_info(T1, border, state_name) | SELECT highest_point FROM highlow WHERE state_name IN (SELECT border FROM border_info WHERE state_name = 'colorado') ORDER BY highest_elevation DESC NULLS LAST LIMIT 1; |
What are the job ids corresponding to jobs with average salary above 8000?
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 JOB_ID FROM employees WHERE JOB_ID IS NOT NULL GROUP BY JOB_ID HAVING AVG(SALARY) > 8000; |
Find the names of all the customers and staff members.?
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))
- 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 DISTINCT Customer_Details FROM (SELECT Customer_Details FROM Customers UNION ALL SELECT Staff_Details FROM Staff); |
Find the name of the product that has the smallest capacity.?
Schema:
- Catalog_Contents(capacity, catalog_entry_name, height, next_entry_id, price_in_dollars, price_in_euros, product_stock_number) | SELECT catalog_entry_name FROM Catalog_Contents ORDER BY capacity ASC NULLS LAST LIMIT 1; |
What are the ids and names for each of the 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_ID, Document_Name FROM Documents; |
What is the name of the department and office location for the professor with the last name of Heffington?
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 T3.DEPT_NAME, 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 T1.EMP_LNAME = 'Heffington'; |
what is the capital of the state with the largest population?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT capital FROM state WHERE population = (SELECT MAX(population) FROM state); |
How many universities have a campus fee greater than the average?
Schema:
- csu_fees(CampusFee) | SELECT COUNT(*) AS num_universities FROM csu_fees WHERE CampusFee > (SELECT AVG(CampusFee) FROM csu_fees); |
What are the addresses of the course authors who teach either "operating system" or "data structure" course.?
Schema:
- Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name)
- Courses(course_description, course_name) | SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = 'operating system' OR T2.course_name = 'data structure'; |
Which company was started by the entrepreneur with the greatest height?
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 T1.Company FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Height DESC NULLS LAST LIMIT 1; |
Find the names of patients who are not using the medication of Procrastin-X.?
Schema:
- Patient(...)
- Prescribes(...)
- Medication(Name) | SELECT DISTINCT Name FROM Patient WHERE Name NOT IN (SELECT T1.Name FROM Patient AS T1 JOIN Prescribes AS T2 ON T2.Patient = T1.SSN JOIN Medication AS T3 ON T2.Medication = T3.Code WHERE T3.Name = 'Procrastin-X'); |
Show the ids for projects with at least 2 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 Project_ID FROM Documents WHERE Project_ID IS NOT NULL GROUP BY Project_ID HAVING COUNT(*) >= 2; |
Show the shop addresses ordered by their opening year.?
Schema:
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT Address FROM shop ORDER BY Open_Year ASC NULLS LAST; |
Find the last names of all the teachers that teach GELL TAMI.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
- teachers(Classroom, FirstName, LastName) | SELECT T2.LastName FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T1.FirstName = 'GELL' AND T1.LastName = 'TAMI'; |
Show the name of technicians aged either 36 or 37?
Schema:
- technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name) | SELECT name FROM technician WHERE Age = 36 OR Age = 37; |
Find the number of pets for each student who has any pet and student id.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Pet(...) | SELECT COUNT(*) AS num_pets, T1.StuID FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID; |
What are the ids and names of the battles that led to more than 10 people killed in total.?
Schema:
- battle(Baldw, bulgarian_commander, date, latin_commander, name, result)
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage)
- death(injured) | SELECT T1.id, T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle JOIN death AS T3 ON T2.id = T3.caused_by_ship_id GROUP BY T1.id, T1.name HAVING SUM(T3.killed) > 10; |
How many products are there for each manufacturer?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT COUNT(*) AS num_products, T2.Name FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name; |
How many distinct artists have volumes?
Schema:
- volume(Artist_ID, Issue_Date, Song, Weeks_on_Top) | SELECT COUNT(DISTINCT Artist_ID) AS num_artists FROM volume; |
What are the population and life expectancies in Brazil?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT Population, LifeExpectancy FROM country WHERE Name = 'Brazil'; |
List the name and assets of each company in ascending order of company name.?
Schema:
- Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name) | SELECT name, Assets_billion FROM Companies ORDER BY name ASC NULLS LAST; |
List the cities which have more than 2 airports sorted by the number of airports.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT city FROM airports WHERE city IS NOT NULL GROUP BY city HAVING COUNT(*) > 2 ORDER BY COUNT(*) ASC NULLS LAST; |
What are the different stage positions for all musicians whose first name is "Solveig"?
Schema:
- Performance(...)
- Band(...) | SELECT DISTINCT T1.StagePosition FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id WHERE Firstname = 'Solveig'; |
What are the phone numbers for each employee?
Schema:
- Employee(BirthDate, City, FirstName, LastName, Phone) | SELECT Phone FROM Employee; |
papers published in the last year?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT paperId FROM paper WHERE "year" = (SELECT MAX("year") FROM paper); |
Return the number of United Airlines flights leaving from AHD Airport.?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT COUNT(*) AS num_flights FROM airlines AS T1 JOIN flights AS T2 ON T2.Airline = T1.uid WHERE T1.Airline = 'United Airlines' AND T2.SourceAirport = 'AHD'; |
What are the names of workshop groups in which services with product name "film" 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 WHERE T2.Product_Name = 'film'; |
Count the number of voting records for each election cycle.?
Schema:
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT Election_Cycle, COUNT(*) AS num_voting_records FROM Voting_record GROUP BY Election_Cycle; |
List all restaurant types.?
Schema:
- Restaurant_Type(ResTypeDescription, ResTypeID, ResTypeName) | SELECT ResTypeName FROM Restaurant_Type; |
give me a good place in the yosemite and mono lake area for french food ?
Schema:
- restaurant(...)
- geographic(...)
- location(...) | SELECT T3.house_number, T1.name FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name JOIN location AS T3 ON T1.id = T3.restaurant_id WHERE T2.region = 'yosemite and mono lake area' AND T1.food_type = 'french' AND T1.rating > 2.5; |
What is average and maximum salary of all employees.?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) | SELECT AVG(salary) AS avg_salary, MAX(salary) AS max_salary FROM employee; |
Show the maximum and minimum share count of 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, MAX(TRY_CAST(share_count AS DOUBLE)) AS max_share_count, MIN(TRY_CAST(share_count AS DOUBLE)) AS min_share_count FROM Transactions GROUP BY transaction_type_code; |
Find the number of bands.?
Schema:
- Band(...) | SELECT COUNT(*) AS num_bands FROM Band; |
Compute the average price 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 AVG(Price) AS avg_price FROM Products; |
Find the number of distinct projects.?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT COUNT(DISTINCT Name) AS num_projects FROM Projects; |
What are the different template type codes, and how many documents use each type?
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, COUNT(*) AS num_documents FROM Templates AS T1 JOIN Documents AS T2 ON T1.Template_ID = T2.Template_ID GROUP BY T1.Template_Type_Code; |
Show all cities where at least one customer lives in but no performer lives in.?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Performers(Customer_Name, Customer_Phone) | SELECT DISTINCT T1.City_Town FROM Addresses AS T1 JOIN Customers AS T2 ON T1.Address_ID = CAST(T2.Address_ID AS TEXT) WHERE T1.City_Town NOT IN (SELECT T1.City_Town FROM Addresses AS T1 JOIN Performers AS T2 ON T1.Address_ID = CAST(T2.Address_ID AS TEXT)); |
How many degrees were conferred at San Jose State University in 2000?
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 Jose State University' AND T2."Year" = 2000; |
Find the max, average, and minimum gpa of all students in each department.?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE) | SELECT MAX(STU_GPA) AS max_gpa, AVG(STU_GPA) AS avg_gpa, MIN(STU_GPA) AS min_gpa, DEPT_CODE FROM STUDENT GROUP BY DEPT_CODE; |
What are all the policy types of the customer named "Dayana Robel"?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Customers_Policies(...)
- Available_Policies(COUNT, Customer_Phone, Life, policy_type_code) | SELECT DISTINCT T3.policy_type_code FROM Customers AS T1 JOIN Customers_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID JOIN Available_Policies AS T3 ON T2.Policy_ID = T3.Policy_ID WHERE T1.Customer_name = 'Dayana Robel'; |
What is the name of each continent and how many car makers are there in each one?
Schema:
- continents(...)
- countries(...)
- car_makers(...) | SELECT T1.Continent, COUNT(*) AS num_car_makers FROM continents AS T1 JOIN countries AS T2 ON T1.ContId = T2.Continent JOIN car_makers AS T3 ON T2.CountryId = T3.CountryId GROUP BY T1.Continent; |
Show all locations with only 1 station.?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT Location FROM station WHERE Location IS NOT NULL GROUP BY Location HAVING COUNT(*) = 1; |
Find the city with post code 255.?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT city FROM Addresses WHERE zip_postcode = '255'; |
Who are the prominent researchers in Neutralizing Antibody in 2012 ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT COUNT(T4.paperId) AS num_papers, T3.authorId FROM paperKeyphrase AS T1 JOIN keyphrase AS T2 ON T1.keyphraseId = T2.keyphraseId JOIN paper AS T4 ON T4.paperId = T1.paperId JOIN writes AS T3 ON T3.paperId = T4.paperId WHERE T2.keyphraseName = 'Neutralizing Antibody' AND T4."year" = 2012 GROUP BY T3.authorId ORDER BY num_papers DESC NULLS LAST; |
For each country, what is the average elevation of that country's airports?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT AVG(elevation) AS avg_elevation, country FROM airports GROUP BY country; |
what is the largest state?
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); |
Find the title of course whose prerequisite is course Differential Geometry.?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- prereq(...) | SELECT title FROM course WHERE course_id IN (SELECT T1.course_id FROM prereq AS T1 JOIN course AS T2 ON T1.prereq_id = T2.course_id WHERE T2.title = 'Differential Geometry'); |
Who is the advisor of student with ID 1004?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Advisor FROM Student WHERE StuID = 1004; |
Show the id, name of each editor and the number of journal committees they are on.?
Schema:
- editor(Age, COUNT, Name)
- journal_committee(...) | SELECT T1.Editor_ID, T1.Name, COUNT(*) AS num_journal_committees FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.Editor_ID, T1.Name; |
Show the number of documents with document type code CV or BK.?
Schema:
- All_Documents(Date_Stored, Document_Name, Document_Type_Code) | SELECT COUNT(*) AS num_documents FROM All_Documents WHERE Document_Type_Code = 'CV' OR Document_Type_Code = 'BK'; |
What is the full name of the staff member who has rented a film to a customer with the first name April and the last name Burns?
Schema:
- staff(...)
- rental(...)
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) | SELECT DISTINCT T1.first_name, T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id = T2.staff_id JOIN customer AS T3 ON T2.customer_id = T3.customer_id WHERE T3.first_name = 'APRIL' AND T3.last_name = 'BURNS'; |
Count the number of different countries that climbers are from.?
Schema:
- climber(Country, K, Name, Points) | SELECT COUNT(DISTINCT Country) AS num_countries FROM climber; |
Show the 3 counties with the smallest population.?
Schema:
- county(County_name, Population, Zip_code) | SELECT County_name FROM county ORDER BY Population ASC NULLS LAST LIMIT 3; |
Return the detail of the location named "UK Gallery".?
Schema:
- Locations(Address, Location_Name, Other_Details) | SELECT Other_Details FROM Locations WHERE Location_Name = 'UK Gallery'; |
return me the conference, which 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)
- conference(homepage, name) | SELECT T2.name FROM publication_keyword AS T4 JOIN keyword AS T1 ON T4.kid = T1.kid JOIN publication AS T3 ON T3.pid = T4.pid JOIN conference AS T2 ON T3.cid = CAST(T2.cid AS TEXT) WHERE T1.keyword = 'Relational Database' GROUP BY T2.name ORDER BY COUNT(DISTINCT T3.title) DESC NULLS LAST LIMIT 1; |
Which distinct car models are the produced after 1980?
Schema:
- model_list(Maker, Model)
- car_names(COUNT, Model)
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year) | SELECT DISTINCT T1.Model FROM model_list AS T1 JOIN car_names AS T2 ON T1.Model = T2.Model JOIN cars_data AS T3 ON T2.MakeId = T3.Id WHERE T3."Year" > 1980; |
What are the names of patients who are not taking the medication of Procrastin-X.?
Schema:
- Patient(...)
- Prescribes(...)
- Medication(Name) | SELECT DISTINCT Name FROM Patient WHERE Name NOT IN (SELECT T1.Name FROM Patient AS T1 JOIN Prescribes AS T2 ON T2.Patient = T1.SSN JOIN Medication AS T3 ON T2.Medication = T3.Code WHERE T3.Name = 'Procrastin-X'); |
brian curless 's papers on convolution?
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'; |
Find the country that the most papers are affiliated with.?
Schema:
- Inst(...)
- Authorship(...)
- Papers(title) | SELECT T1.country FROM Inst AS T1 JOIN Authorship AS T2 ON T1.instID = T2.instID JOIN Papers AS T3 ON T2.paperID = T3.paperID GROUP BY T1.country ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.