question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
What are the price ranges of hotels?
Schema:
- Hotels(hotel_id, other_hotel_details, pets_allowed_yn, price_range, star_rating_code) | SELECT price_range FROM Hotels; |
Find the id of the order whose shipment tracking number is "3452".?
Schema:
- Shipments(order_id, shipment_date, shipment_tracking_number) | SELECT order_id FROM Shipments WHERE shipment_tracking_number = '3452'; |
For each type, what is the average tonnage?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT Type, AVG(Tonnage) AS avg_tonnage FROM ship GROUP BY Type; |
Return the id of the department with the fewest staff assignments.?
Schema:
- Staff_Department_Assignments(COUNT, date_assigned_to, department_id, job_title_code, staff_id) | SELECT department_id FROM Staff_Department_Assignments WHERE department_id IS NOT NULL GROUP BY department_id ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
Count the number of orchestras that have CD or DVD as their record format.?
Schema:
- orchestra(COUNT, Major_Record_Format, Record_Company, Year_of_Founded) | SELECT COUNT(*) AS num_orchestras FROM orchestra WHERE Major_Record_Format = 'CD' OR Major_Record_Format = 'DVD'; |
What is the name of the winner who has won the most matches, and how many rank points does this player have?
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, SUM(winner_rank_points) AS total_rank_points FROM matches_ WHERE winner_name IS NOT NULL GROUP BY winner_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
salem is the capital of which 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 capital = 'salem'; |
List the name and the number of stations for all the cities that have at least 15 stations.?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT city, COUNT(*) AS num_stations FROM station WHERE city IS NOT NULL GROUP BY city HAVING COUNT(*) >= 15; |
How many weddings are there in year 2016?
Schema:
- wedding(...) | SELECT COUNT(*) AS num_weddings FROM wedding WHERE "Year" = 2016; |
Show all template type codes and descriptions.?
Schema:
- Ref_Template_Types(Template_Type_Code, Template_Type_Description) | SELECT Template_Type_Code, Template_Type_Description FROM Ref_Template_Types; |
what is the smallest state that borders texas?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
- border_info(T1, border, state_name) | SELECT state_name FROM state WHERE area = (SELECT MIN(area) FROM state WHERE state_name IN (SELECT border FROM border_info WHERE state_name = 'texas')) AND state_name IN (SELECT border FROM border_info WHERE state_name = 'texas'); |
List the names of all courses ordered by their titles and credits.?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) | SELECT title FROM course ORDER BY title, credits ASC NULLS LAST; |
Show the names of sponsors of players whose residence is either "Brandon" or "Birtle".?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT Sponsor_name FROM player WHERE Residence = 'Brandon' OR Residence = 'Birtle'; |
get the details of employees who manage a 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 DISTINCT * FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID WHERE T1.EMPLOYEE_ID = T2.MANAGER_ID; |
How many professors have a Ph.D. in each department?
Schema:
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) | SELECT COUNT(*) AS num_professors, DEPT_CODE FROM PROFESSOR WHERE PROF_HIGH_DEGREE = 'Ph.D.' GROUP BY DEPT_CODE; |
What are the id of students who registered course 301?
Schema:
- Student_Course_Attendance(course_id, date_of_attendance, student_id) | SELECT student_id FROM Student_Course_Attendance WHERE course_id = 301; |
What are the nationalities that are shared by at least two people?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT Nationality FROM people WHERE Nationality IS NOT NULL GROUP BY Nationality HAVING COUNT(*) >= 2; |
Find the average weight for each pet type.?
Schema:
- Pets(PetID, PetType, pet_age, weight) | SELECT AVG(weight) AS avg_weight, PetType FROM Pets GROUP BY PetType; |
Find the number of employees hired in each shop; show the shop name as well.?
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; |
Find the first names and offices of all instructors who have taught some course and the course description and the department name.?
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)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT T2.EMP_FNAME, T4.PROF_OFFICE, T3.CRS_DESCRIPTION, T5.DEPT_NAME 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 JOIN DEPARTMENT AS T5 ON T4.DEPT_CODE = T5.DEPT_CODE; |
What are all the distinct last names of all the engineers?
Schema:
- Maintenance_Engineers(COUNT, T1, engineer_id, first_name, last_name) | SELECT DISTINCT last_name FROM Maintenance_Engineers; |
Find the city that hosted some events in the most recent year. What is the id of this city?
Schema:
- hosting_city(Host_City, Year) | SELECT Host_City FROM hosting_city ORDER BY "Year" DESC NULLS LAST LIMIT 1; |
What are the names of all the Japanese constructors that have earned more than 5 points?
Schema:
- constructors(nationality)
- constructorStandings(constructorId) | SELECT T1.name FROM constructors AS T1 JOIN constructorStandings AS T2 ON T1.constructorId = T2.constructorId WHERE T1.nationality = 'Japanese' AND T2.points > 5; |
What is maximum and minimum RAM size of phone produced by company named "Nokia Corporation"?
Schema:
- chip_model(Launch_year, Model_name, RAM_MiB, WiFi)
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) | SELECT MAX(T1.RAM_MiB) AS max_ram_size, MIN(T1.RAM_MiB) AS min_ram_size FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T2.Company_name = 'Nokia Corporation'; |
Give the names of countries with English and French as official 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 T3.Name FROM (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" = 'English' AND T2.IsOfficial = 'T') AS T3 JOIN (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" = 'French' AND T2.IsOfficial = 'T') AS T4 ON T3.Name = T4.Name; |
What is the title of the prerequisite class of International Finance course?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- prereq(...) | SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.title = 'International Finance'); |
What is the name, address, and number of students in the departments that have the 3 most students?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT T2.DEPT_NAME, T2.DEPT_ADDRESS, COUNT(*) AS num_students FROM STUDENT AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.DEPT_CODE, T2.DEPT_NAME, T2.DEPT_ADDRESS ORDER BY num_students DESC NULLS LAST LIMIT 3; |
In 1980, how many cars were made?
Schema:
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year) | SELECT COUNT(*) AS num_cars FROM cars_data WHERE "Year" = 1980; |
What is the average attendance of stadiums with capacity percentage higher than 100%?
Schema:
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1) | SELECT Average_Attendance FROM stadium WHERE Capacity_Percentage > 100; |
Find the names of stadiums which have never had any event.?
Schema:
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
- event(Date, Event_Attendance, Name, Venue, Year) | SELECT Name FROM stadium WHERE ID NOT IN (SELECT Stadium_ID FROM event); |
List the distinct carriers of phones with memories bigger than 32.?
Schema:
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) | SELECT DISTINCT Carrier FROM phone WHERE Memory_in_G > 32; |
Who are the players from UCLA?
Schema:
- match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team) | SELECT Player FROM match_season WHERE College = 'UCLA'; |
papers in chi?
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 T2.venueName = 'chi'; |
Please show the different record companies and the corresponding number of orchestras.?
Schema:
- orchestra(COUNT, Major_Record_Format, Record_Company, Year_of_Founded) | SELECT Record_Company, COUNT(*) AS num_orchestras FROM orchestra GROUP BY Record_Company; |
What are the names of all wines produced in 2008?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT Name FROM wine WHERE "Year" = '2008'; |
Find the name of people whose age is greater than any engineer sorted by their age.?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT name FROM Person WHERE age > (SELECT MIN(age) FROM Person WHERE job = 'engineer') ORDER BY age ASC NULLS LAST; |
Show the names of people that are on affirmative side of debates with number of audience bigger than 200.?
Schema:
- debate_people(...)
- debate(Date, Venue)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T3.Name FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID WHERE T2.Num_of_Audience > 200; |
return me all the papers 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) | SELECT T4.title FROM organization AS T2 JOIN author AS T1 ON T2.oid = T1.oid JOIN writes AS T3 ON T3.aid = T1.aid JOIN publication AS T4 ON T3.pid = T4.pid WHERE T2.name = 'University of Michigan'; |
Which airline has abbreviation 'UAL'?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name) | SELECT Airline FROM airlines WHERE Abbreviation = 'UAL'; |
What is the number of professors who are in the Accounting or Biology departments?
Schema:
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT COUNT(*) AS num_professors FROM PROFESSOR AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE WHERE T2.DEPT_NAME = 'Accounting' OR T2.DEPT_NAME = 'Biology'; |
How many companies are in either "Banking" industry or "Conglomerate" industry?
Schema:
- Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name) | SELECT COUNT(*) AS num_companies FROM Companies WHERE Industry = 'Banking' OR Industry = 'Conglomerate'; |
How many accounts are there for each customer id?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT customer_id, COUNT(*) AS num_accounts FROM Accounts GROUP BY customer_id; |
Which physicians are affiliated with either Surgery or Psychiatry department? Give me their names.?
Schema:
- Physician(I, Name)
- Affiliated_With(Department, Physician, PrimaryAffiliation)
- Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2) | SELECT T1.Name FROM Physician AS T1 JOIN Affiliated_With AS T2 ON T1.EmployeeID = T2.Physician JOIN Department AS T3 ON T2.Department = T3.DepartmentID WHERE T3.Name = 'Surgery' OR T3.Name = 'Psychiatry'; |
Does brian curless do 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'; |
where is the ohio river?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT traverse FROM river WHERE river_name = 'ohio'; |
What are the ids of the courses that are registered or attended by the student whose id is 121?
Schema:
- Student_Course_Registrations(COUNT, student_id)
- Student_Course_Attendance(course_id, date_of_attendance, student_id) | SELECT DISTINCT course_id FROM (SELECT course_id FROM Student_Course_Registrations WHERE student_id = 121 UNION ALL SELECT course_id FROM Student_Course_Attendance WHERE student_id = 121); |
What is the most common interaction type between enzymes and medicine? And how many are there?
Schema:
- medicine_enzyme_interaction(interaction_type) | SELECT interaction_type, COUNT(*) AS num_interactions FROM medicine_enzyme_interaction WHERE interaction_type IS NOT NULL GROUP BY interaction_type ORDER BY num_interactions DESC NULLS LAST LIMIT 1; |
Find the model of the car whose weight is below the average weight.?
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 WHERE T2.Weight < (SELECT AVG(Weight) FROM cars_data); |
What is the number of checkins for " Cafe Zinho " on Friday?
Schema:
- checkin(...)
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT T2."count" FROM checkin AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T1.name = 'Cafe Zinho' AND T2."day" = 'Friday'; |
What is zip code of customer with first name as Carole and last name as Bernhard?
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.zip_postcode 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'; |
Find the name of amenities Smith Hall dorm have.?
Schema:
- Dorm(dorm_name, gender, student_capacity)
- Has_amenity(dormid)
- Dorm_amenity(amenity_name) | SELECT T3.amenity_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 T1.dorm_name = 'Smith Hall'; |
When is the last day any resident moved in?
Schema:
- Residents(M, date_moved_in, last_day_moved_in, other_details) | SELECT MAX(date_moved_in) AS last_day_moved_in FROM Residents; |
Find the first and last name of all the students of age 18 who have vice president votes.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT T1.Fname, T1.LName FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.Vice_President_Vote WHERE T1.Age = 18; |
how many rivers does idaho have?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT COUNT(river_name) AS num_rivers FROM river WHERE traverse = 'idaho'; |
what states border kentucky?
Schema:
- border_info(T1, border, state_name) | SELECT border FROM border_info WHERE state_name = 'kentucky'; |
For each type, how many ships are there?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT Type, COUNT(*) AS num_ships FROM ship GROUP BY Type; |
where are some good arabics in mountain view ?
Schema:
- restaurant(...)
- location(...) | SELECT T2.house_number, T1.name FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'mountain view' AND T1.food_type = 'arabic' AND T1.rating > 2.5; |
Count the number of films.?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) | SELECT COUNT(*) AS num_films FROM film; |
which states border the longest river in the usa?
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 LENGTH = (SELECT MAX(LENGTH) FROM river)); |
who writes papers with Noah A Smith ?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT T1.authorId FROM writes AS T3 JOIN author AS T2 ON T3.authorId = T2.authorId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T2.authorName = 'Noah A Smith'; |
Show the transaction type code that occurs the fewest times.?
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 FROM Transactions WHERE transaction_type_code IS NOT NULL GROUP BY transaction_type_code ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
Count the number of students the teacher 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'; |
What are the names of the workshop groups that have bookings with status code "stop"?
Schema:
- Bookings(Actual_Delivery_Date, COUNT, Order_Date, Planned_Delivery_Date, Status_Code)
- Drama_Workshop_Groups(COUNT, Currency_Code, Marketing_Region_Code, Store_Name) | SELECT T2.Store_Name FROM Bookings AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Workshop_Group_ID = CAST(T2.Workshop_Group_ID AS TEXT) WHERE T1.Status_Code = 'stop'; |
How many Patent outcomes are generated from all the projects?
Schema:
- Project_Outcomes(outcome_code) | SELECT COUNT(*) AS num_patent_outcomes FROM Project_Outcomes WHERE outcome_code = 'Patent'; |
Find the first names of the teachers that teach first grade.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
- teachers(Classroom, FirstName, LastName) | SELECT DISTINCT T2.FirstName FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE Grade = 1; |
What is the earliest date of a transcript release, and what details can you tell me?
Schema:
- Transcripts(other_details, transcript_date) | SELECT transcript_date, other_details FROM Transcripts ORDER BY transcript_date ASC NULLS LAST LIMIT 1; |
What is the full name of each student who is not allergic to any type of food.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Allergy(Allergy, COUNT, StuID)
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT Fname, LName FROM Student WHERE StuID NOT IN (SELECT T1.StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = 'food'); |
What are the guest first name, start date, and end date of each apartment booking?
Schema:
- Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code)
- Guests(date_of_birth, gender_code, guest_first_name, guest_last_name) | SELECT T2.guest_first_name, T1.booking_start_date, T1.booking_end_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id; |
What are the first names of the students who live in Haiti permanently or have the cell phone number 09700166582 ?
Schema:
- Students(cell_mobile_number, current_address_id, date_first_registered, date_left, date_of_latest_logon, email_address, family_name, first_name, last_name, login_name, middle_name, other_student_details, ... (1 more))
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT T1.first_name FROM Students AS T1 JOIN Addresses AS T2 ON T1.permanent_address_id = T2.address_id WHERE T2.country = 'Haiti' OR T1.cell_mobile_number = '09700166582'; |
What keywords are in papers by Luke Zettlemoyer ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T1.keyphraseId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T5 ON T4.authorId = T5.authorId WHERE T5.authorName = 'Luke Zettlemoyer'; |
How many students are enrolled in college?
Schema:
- College(M, cName, enr, state) | SELECT SUM(enr) AS num_students FROM College; |
What is the first name, GPA, and phone number of the students with the top 5 GPAs?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE) | SELECT STU_GPA, STU_PHONE, STU_FNAME FROM STUDENT ORDER BY STU_GPA DESC NULLS LAST LIMIT 5; |
What are the times of elimination for wrestlers with over 50 days held?
Schema:
- Elimination(Benjam, Eliminated_By, Elimination_Move, T1, Team, Time)
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT T1."Time" FROM Elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = CAST(T2.Wrestler_ID AS TEXT) WHERE TRY_CAST(T2.Days_held AS INT) > 50; |
how many ACL 2012 papers have more than 7 citations ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...)
- venue(venueId, venueName) | SELECT DISTINCT (T1.paperId), COUNT(T3.citingPaperId) AS num_citations FROM paper AS T1 JOIN cite AS T3 ON T1.paperId = T3.citedPaperId JOIN venue AS T2 ON T2.venueId = T1.venueId WHERE T1."year" = 2012 AND T2.venueName = 'ACL' GROUP BY T1.paperId HAVING COUNT(T3.citingPaperId) > 7; |
Find the details of all the distinct customers who have orders with status "On Road".?
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))
- Orders(customer_id, date_order_placed, order_id) | SELECT DISTINCT T1.customer_details FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'On Road'; |
What are the carriers of devices that are in stock in more than a single shop?
Schema:
- stock(Quantity)
- device(COUNT, Carrier, Software_Platform) | SELECT T2.Carrier FROM stock AS T1 JOIN device AS T2 ON T1.Device_ID = T2.Device_ID GROUP BY T1.Device_ID, T2.Carrier HAVING COUNT(*) > 1; |
Find the number of students whose city code is NYC and who have class senator votes in the spring election cycle.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT COUNT(*) AS num_students FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.city_code = 'NYC' AND T2.Election_Cycle = 'Spring'; |
List the company name and rank for all companies in the decreasing order of their sales.?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Company, "Rank" FROM company ORDER BY Sales_billion DESC NULLS LAST; |
What are the names, countries, and ages for every singer in descending order of age?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT Name, Country, Age FROM singer ORDER BY Age DESC NULLS LAST; |
How much does the most expensive charge type costs?
Schema:
- Charges(charge_amount, charge_type) | SELECT MAX(charge_amount) AS max_charge_amount FROM Charges; |
Show all different home cities.?
Schema:
- driver(Age, Home_city, Name, Party) | SELECT DISTINCT Home_city FROM driver; |
How many tasks are there?
Schema:
- Tasks(...) | SELECT COUNT(*) AS num_tasks FROM Tasks; |
What are the details and ways to get to tourist attractions related to royal family?
Schema:
- Royal_Family(...)
- Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more)) | SELECT T1.Royal_Family_Details, T2.How_to_Get_There FROM Royal_Family AS T1 JOIN Tourist_Attractions AS T2 ON T1.Royal_Family_ID = T2.Tourist_Attraction_ID; |
What are the ids and details of all accounts?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT Account_ID, Account_Details FROM Accounts; |
What is the first name of the band mate who perfomed in the most songs?
Schema:
- Performance(...)
- Band(...)
- Songs(Title) | SELECT T2.Firstname FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE Firstname IS NOT NULL GROUP BY Firstname ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the title of the course that is offered by more than one department.?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) | SELECT title FROM course WHERE title IS NOT NULL GROUP BY title HAVING COUNT(*) > 1; |
Which unique cities are in Asian countries where Chinese is the official language ?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- countrylanguage(COUNT, CountryCode, Engl, Language)
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT DISTINCT T3.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode JOIN city AS T3 ON T1.Code = T3.CountryCode WHERE T2.IsOfficial = 'T' AND T2."Language" = 'Chinese' AND T1.Continent = 'Asia'; |
Find the number of products with category "Spices" and typically sold above 1000.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT COUNT(*) AS num_products FROM Products WHERE product_category_code = 'Spices' AND TRY_CAST(typical_buying_price AS DOUBLE) > 1000; |
how many papers about deep learning ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(DISTINCT T3.paperId) AS num_papers 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 = 'deep learning'; |
Find the number of phones for each accreditation type.?
Schema:
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) | SELECT Accreditation_type, COUNT(*) AS num_phones FROM phone GROUP BY Accreditation_type; |
Find all the papers published by the institution "Google".?
Schema:
- Papers(title)
- Authorship(...)
- Inst(...) | SELECT DISTINCT T1.title FROM Papers AS T1 JOIN Authorship AS T2 ON T1.paperID = T2.paperID JOIN Inst AS T3 ON T2.instID = T3.instID WHERE T3.name = 'Google'; |
What are the ids of the faculty members who do not advise any student.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT FacID FROM Faculty WHERE FacID NOT IN (SELECT Advisor FROM Student); |
How many actors have appeared in each musical?
Schema:
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
- musical(Award, COUNT, Name, Nom, Nominee, Result, T1) | SELECT T2.Name, COUNT(*) AS num_actors FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID, T2.Name; |
keyphrases used by Luke Zettlemoyer .?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T1.keyphraseId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T5 ON T4.authorId = T5.authorId WHERE T5.authorName = 'Luke Zettlemoyer'; |
Show the names of singers and the total sales of their songs.?
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 T1.Name, SUM(T2.Sales) AS total_sales FROM singer AS T1 JOIN song AS T2 ON T1.Singer_ID = T2.Singer_ID GROUP BY T1.Name; |
How many departments are in the division AS?
Schema:
- Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2) | SELECT COUNT(*) AS num_departments FROM Department WHERE Division = 'AS'; |
Show the names of pilots and models of aircrafts they have flied with.?
Schema:
- pilot_record(...)
- aircraft(Description, aid, d, distance, name)
- pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team) | SELECT T3.Pilot_name, T2.Model FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID; |
what is the smallest city in the largest 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 city_name FROM city WHERE population = (SELECT MIN(population) FROM city WHERE state_name IN (SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state))) AND state_name IN (SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state)); |
How many students have cat allergies?
Schema:
- Has_Allergy(Allergy, COUNT, StuID) | SELECT COUNT(*) AS num_students FROM Has_Allergy WHERE Allergy = 'Cat'; |
Find the name, address, number of students in the departments that have the top 3 highest number of students.?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT T2.DEPT_NAME, T2.DEPT_ADDRESS, COUNT(*) AS num_students FROM STUDENT AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.DEPT_CODE, T2.DEPT_NAME, T2.DEPT_ADDRESS ORDER BY num_students DESC NULLS LAST LIMIT 3; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.