question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
Find the names of all the products whose stock number starts with "2".?
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 WHERE product_stock_number LIKE '2%'; |
Compute the average score of submissions.?
Schema:
- submission(Author, COUNT, College, Scores) | SELECT AVG(Scores) AS avg_score FROM submission; |
Find the names of all the employees whose the role name is "Editor".?
Schema:
- Employees(COUNT, Date_of_Birth, Employee_ID, Employee_Name, Role_Code, employee_id, employee_name, role_code)
- Roles(Role_Code, Role_Description, Role_Name, role_code, role_description) | SELECT T1.Employee_Name FROM Employees AS T1 JOIN Roles AS T2 ON T1.Role_Code = T2.Role_Code WHERE T2.Role_Name = 'Editor'; |
How many engineer visits are required at most for a single fault log? List the number and the log entry id.?
Schema:
- Fault_Log(...)
- Engineer_Visits(...) | SELECT COUNT(*) AS num_visits, T1.fault_log_entry_id FROM Fault_Log AS T1 JOIN Engineer_Visits AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY num_visits DESC NULLS LAST LIMIT 1; |
number of citizens in boulder?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT population FROM city WHERE city_name = 'boulder'; |
IN which year did city "Taizhou ( Zhejiang )" serve as a host city?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- hosting_city(Host_City, Year) | SELECT T2."Year" FROM city AS T1 JOIN hosting_city AS T2 ON T1.City_ID = T2.Host_City WHERE T1.City = 'Taizhou (Zhejiang)'; |
Find the names of procedures which physician John Wen was trained in.?
Schema:
- Physician(I, Name)
- Trained_In(...)
- Procedures(Cost, Name) | SELECT T3.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 T1.Name = 'John Wen'; |
What are the famous titles and ages of each artist, listed in descending order by age?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT Famous_Title, Age FROM artist ORDER BY Age DESC NULLS LAST; |
list all cartoon titles and their directors ordered by their air date?
Schema:
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by) | SELECT Title, Directed_by FROM Cartoon ORDER BY Original_air_date ASC NULLS LAST; |
What are the payment date of the payment with amount paid higher than 300 or with payment type is 'Check'?
Schema:
- Payments(Amount_Payment, COUNT, Date_Payment_Made, Payment_ID, Payment_Method_Code, V, amount_due, amount_paid, payment_date, payment_type_code) | SELECT payment_date FROM Payments WHERE amount_paid > 300 OR payment_type_code = 'Check'; |
Which catalog contents has price above 700 dollars? Show their catalog entry names and capacities.?
Schema:
- Catalog_Contents(capacity, catalog_entry_name, height, next_entry_id, price_in_dollars, price_in_euros, product_stock_number) | SELECT catalog_entry_name, capacity FROM Catalog_Contents WHERE price_in_dollars > 700; |
Return all the committees that have delegates from Democratic party.?
Schema:
- election(Committee, Date, Delegate, District, Vote_Percent, Votes)
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more)) | SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = 'Democratic'; |
number of people in boulder?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT population FROM city WHERE city_name = 'boulder'; |
papers from pldi 2015?
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'; |
What are the titles of films that are either longer than 100 minutes or rated PG other than those that cost more than 200 to replace?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) | SELECT title FROM film WHERE LENGTH > 100 OR rating = 'PG' AND title NOT IN (SELECT title FROM film WHERE replacement_cost > 200); |
Which vocal type has the band mate with first name "Marianne" played the most?
Schema:
- Vocals(COUNT, Type)
- Band(...) | SELECT Type FROM Vocals AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id WHERE Firstname = 'Marianne' AND Type IS NOT NULL GROUP BY Type ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the ids of orders which are shipped after 2000-01-01.?
Schema:
- Shipments(order_id, shipment_date, shipment_tracking_number) | SELECT order_id FROM Shipments WHERE shipment_date > '2000-01-01 00:00:00'; |
What are the unique ids of those departments where any manager is managing 4 or more employees.?
Schema:
- employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) | SELECT DISTINCT DEPARTMENT_ID FROM employees WHERE DEPARTMENT_ID IS NOT NULL AND MANAGER_ID IS NOT NULL GROUP BY DEPARTMENT_ID, MANAGER_ID HAVING COUNT(EMPLOYEE_ID) >= 4; |
List the teams of the players with the top 5 largest ages.?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT Team FROM player ORDER BY Age DESC NULLS LAST LIMIT 5; |
How many songs were released for each format?
Schema:
- files(COUNT, duration, f_id, formats) | SELECT COUNT(*) AS num_songs, formats FROM files GROUP BY formats; |
what are the average and maximum attendances of all events?
Schema:
- event(Date, Event_Attendance, Name, Venue, Year) | SELECT AVG(Event_Attendance) AS avg_attendance, MAX(Event_Attendance) AS max_attendance FROM event; |
How many artists are there?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT COUNT(*) AS num_artists FROM artist; |
What is the total number of singers?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT COUNT(*) AS num_singers FROM singer; |
Find the name and level of catalog structure with level between 5 and 10.?
Schema:
- Catalog_Structure(catalog_level_name, catalog_level_number) | SELECT catalog_level_name, catalog_level_number FROM Catalog_Structure WHERE catalog_level_number BETWEEN 5 AND 10; |
How many patients stay in room 112?
Schema:
- Stay(Patient, Room, StayStart) | SELECT COUNT(Patient) AS num_patients FROM Stay WHERE Room = 112; |
What are the ids of all aircrafts that can cover a distance of more than 1000?
Schema:
- aircraft(Description, aid, d, distance, name) | SELECT aid FROM aircraft WHERE distance > 1000; |
What is the name of the artist with the greatest number of albums?
Schema:
- Album(Title)
- Artist(Name) | SELECT T2.Name FROM Album AS T1 JOIN Artist AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Give average earnings of poker players who are taller than 200.?
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 AVG(T2.Earnings) AS avg_earnings FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Height > 200; |
Show the names of members and the decoration themes they have.?
Schema:
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
- round(...) | SELECT T1.Name, T2.Decoration_Theme FROM member_ AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID; |
Find all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona.?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT DISTINCT address_content FROM (SELECT address_content FROM Addresses WHERE city = 'East Julianaside' AND state_province_county = 'Texas' UNION ALL SELECT address_content FROM Addresses WHERE city = 'Gleasonmouth' AND state_province_county = 'Arizona'); |
Find the number of games taken place in city Atlanta in 2000.?
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" = 2000 AND T2.city = 'Atlanta'; |
What are the distinct last names of the students who have class 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.LName FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.Class_President_Vote; |
Which language is the most popular on the Asian continent?
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 T2."Language" FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Continent = 'Asia' GROUP BY T2."Language" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the names of members and their corresponding parties?
Schema:
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more)) | SELECT T1.Member_Name, T2.Party_name FROM member_ AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID; |
How many courses do the student whose id is 171 attend?
Schema:
- Courses(course_description, course_name)
- Student_Course_Attendance(course_id, date_of_attendance, student_id) | SELECT COUNT(*) AS num_courses FROM Courses AS T1 JOIN Student_Course_Attendance AS T2 ON T1.course_id = CAST(T2.course_id AS TEXT) WHERE T2.student_id = 171; |
Find the total revenue created by the companies whose headquarter is located at Austin.?
Schema:
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT SUM(Revenue) AS total_revenue FROM Manufacturers WHERE Headquarter = 'Austin'; |
Give me the average prices of wines that are produced by appelations in Sonoma County.?
Schema:
- appellations(Area, County)
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT AVG(T2.Price) AS avg_price FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Sonoma'; |
Show all date and share count of transactions.?
Schema:
- Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code) | SELECT date_of_transaction, share_count FROM Transactions; |
who has written the most papers on syntactic parsing ?
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 = 'syntactic parsing' GROUP BY T3.authorId ORDER BY num_papers DESC NULLS LAST; |
How many exhibitions has each artist had?
Schema:
- exhibition(Theme, Ticket_Price, Year)
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT T2.Name, COUNT(*) AS num_exhibitions FROM exhibition AS T1 JOIN artist AS T2 ON T1.Artist_ID = T2.Artist_ID GROUP BY T1.Artist_ID, T2.Name; |
Please give me a list of cities whose regional population is over 8000000 or under 5000000.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT DISTINCT City FROM (SELECT City FROM city WHERE Regional_Population > 10000000 UNION ALL SELECT City FROM city WHERE Regional_Population < 5000000); |
semantic parsing dataset?
Schema:
- paperDataset(...)
- dataset(...)
- paperKeyphrase(...)
- keyphrase(...) | SELECT DISTINCT T2.datasetId FROM paperDataset AS T3 JOIN dataset AS T2 ON T3.datasetId = T2.datasetId JOIN paperKeyphrase AS T1 ON T1.paperId = T3.paperId JOIN keyphrase AS T4 ON T1.keyphraseId = T4.keyphraseId WHERE T4.keyphraseName = 'semantic parsing'; |
What are the names of all students who tried out in alphabetical order?
Schema:
- Player(HS, pName, weight, yCard)
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT T1.pName FROM Player AS T1 JOIN Tryout AS T2 ON T1.pID = T2.pID ORDER BY T1.pName ASC NULLS LAST; |
Find the name of the department which has the highest average salary of professors.?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary) | SELECT dept_name FROM instructor WHERE dept_name IS NOT NULL GROUP BY dept_name ORDER BY AVG(salary) DESC NULLS LAST LIMIT 1; |
Return the unit of measure for 'Herb' products.?
Schema:
- Ref_Product_Categories(product_category_code, product_category_description, unit_of_measure) | SELECT unit_of_measure FROM Ref_Product_Categories WHERE product_category_code = 'Herbs'; |
What are the different types of vocals?
Schema:
- Vocals(COUNT, Type) | SELECT DISTINCT Type FROM Vocals; |
Find the number of items that did not receive any review.?
Schema:
- item(title)
- review(i_id, rank, rating, text) | SELECT COUNT(*) AS num_items FROM item WHERE i_id NOT IN (SELECT i_id FROM review); |
Retrieve the country that has published the most papers.?
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; |
How many customers are there of each gender?
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 gender, COUNT(*) AS num_customers FROM Customers GROUP BY gender; |
Find the count and code of the job has most employees.?
Schema:
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) | SELECT EMP_JOBCODE, COUNT(*) AS num_employees FROM EMPLOYEE WHERE EMP_JOBCODE IS NOT NULL GROUP BY EMP_JOBCODE ORDER BY num_employees DESC NULLS LAST LIMIT 1; |
How many people whose age is greater 30 and job is engineer?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT COUNT(*) AS num_people FROM Person WHERE age > 30 AND job = 'engineer'; |
Show the opening year in whcih at least two churches opened.?
Schema:
- church(Name, Open_Date, Organized_by) | SELECT Open_Date FROM church WHERE Open_Date IS NOT NULL GROUP BY Open_Date HAVING COUNT(*) >= 2; |
How many architects haven't built a mill before year 1850?
Schema:
- architect(gender, id, name, nationality)
- mill(Moul, location, name, type) | SELECT COUNT(*) AS num_architects FROM architect WHERE id NOT IN (SELECT CAST(architect_id AS TEXT) FROM mill WHERE built_year < 1850); |
How many schools are there?
Schema:
- School(County, Enrollment, Location, Mascot, School_name) | SELECT COUNT(*) AS num_schools FROM School; |
When does Michael Stonebraker publish the GIS Database paper ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T3."year" 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 = 'Michael Stonebraker' AND T5.keyphraseName = 'GIS Database'; |
How many available features are there in total?
Schema:
- Other_Available_Features(...) | SELECT COUNT(*) AS num_features FROM Other_Available_Features; |
Count the number of customers that have an email containing "gmail.com".?
Schema:
- Customer(Email, FirstName, LastName, State, lu) | SELECT COUNT(*) AS num_customers FROM Customer WHERE Email LIKE '%gmail.com%'; |
Find the product names that are colored 'white' but do not have unit of measurement "Handful".?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Ref_Product_Categories(product_category_code, product_category_description, unit_of_measure)
- Ref_Colors(color_description) | SELECT T1.product_name FROM Products AS T1 JOIN Ref_Product_Categories AS T2 ON T1.product_category_code = T2.product_category_code JOIN Ref_Colors AS T3 ON T1.color_code = T3.color_code WHERE T3.color_description = 'white' AND T2.unit_of_measure != 'Handful'; |
What are the first and last names of all students who are living in a dorm with a TV Lounge?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Lives_in(...)
- Has_amenity(dormid)
- Dorm_amenity(amenity_name) | SELECT T1.Fname, T1.LName FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM Has_amenity AS T3 JOIN Dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge'); |
What are the distinct president votes on 08/30/2015?
Schema:
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT President_Vote FROM Voting_record WHERE Registration_Date = '08/30/2015'; |
Which papers were written by authors from 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 dates that have the 5 highest cloud cover rates and what are the rates?
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", cloud_cover FROM weather ORDER BY cloud_cover DESC NULLS LAST LIMIT 5; |
Return the login names of the students whose family name is "Ward".?
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)) | SELECT login_name FROM Students WHERE family_name = 'Ward'; |
What are the ids and names of the web accelerators that are compatible with two or more browsers?
Schema:
- Web_client_accelerator(Client, Operating_system)
- accelerator_compatible_browser(...) | SELECT T1.id, T1.name FROM Web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id GROUP BY T1.id, T1.name HAVING COUNT(*) >= 2; |
which papers has sharon goldwater written ?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT T2.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'sharon goldwater'; |
Count the number of distinct store locations.?
Schema:
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT COUNT(DISTINCT Location) AS num_locations FROM shop; |
What are the name and ID of the product bought the most.?
Schema:
- 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 T2.product_details, T2.product_id FROM Order_Items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_details, T2.product_id ORDER BY SUM(TRY_CAST(T1.order_quantity AS DOUBLE)) ASC NULLS LAST LIMIT 1; |
Show the start dates and end dates of all the apartment bookings made by guests with gender code "Female".?
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 T1.booking_start_date, T1.booking_end_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = 'Female'; |
Find the number of characteristics that the product "flax" has.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Product_Characteristics(...)
- Characteristics(characteristic_name) | SELECT COUNT(*) AS num_characteristics FROM Products AS T1 JOIN Product_Characteristics AS T2 ON T1.product_id = T2.product_id JOIN Characteristics AS T3 ON T2.characteristic_id = T3.characteristic_id WHERE T1.product_name = 'flax'; |
What is the id of the patient who stayed in room 111 most recently?
Schema:
- Stay(Patient, Room, StayStart) | SELECT Patient FROM Stay WHERE Room = 111 ORDER BY StayStart DESC NULLS LAST LIMIT 1; |
What are the allergies and their types?
Schema:
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT Allergy, AllergyType FROM Allergy_Type; |
Find the average unit price of jazz tracks.?
Schema:
- Genre(Name)
- Track(Milliseconds, Name, UnitPrice) | SELECT AVG(UnitPrice) AS avg_unit_price FROM Genre AS T1 JOIN Track AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Jazz'; |
Which problems are reported before 1978-06-26? Give me the ids of the problems.?
Schema:
- Problems(date_problem_reported, problem_id) | SELECT problem_id FROM Problems WHERE date_problem_reported < DATE '1978-06-26'; |
What are the names of the schools with some players in the mid position but no goalies?
Schema:
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT cName FROM Tryout WHERE pPos = 'mid' AND cName NOT IN (SELECT cName FROM Tryout WHERE pPos = 'goalie'); |
What is the reviewer id of Daniel Lewis?
Schema:
- Reviewer(Lew, name, rID) | SELECT rID FROM Reviewer WHERE name = 'Daniel Lewis'; |
What are the code and description of the least frequent detention type ?
Schema:
- Detention(detention_summary, detention_type_code)
- Ref_Detention_Type(...) | SELECT T1.detention_type_code, T2.detention_type_description FROM Detention AS T1 JOIN Ref_Detention_Type AS T2 ON T1.detention_type_code = T2.detention_type_code GROUP BY T1.detention_type_code, T2.detention_type_description ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
return me the number of papers written by " H. V. Jagadish " in each year .?
Schema:
- writes(...)
- author(...)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT COUNT(DISTINCT T3.title) AS num_papers, T3."year" FROM writes AS T2 JOIN author AS T1 ON T2.aid = T1.aid JOIN publication AS T3 ON T2.pid = T3.pid WHERE T1.name = 'H. V. Jagadish' GROUP BY T3."year"; |
Find the name of songs that does not have a back vocal.?
Schema:
- Vocals(COUNT, Type)
- Songs(Title) | SELECT DISTINCT Title FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Title NOT IN (SELECT T2.Title FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Type = 'back'); |
How many leagues are there in England?
Schema:
- Country(...)
- League(...) | SELECT COUNT(*) AS num_leagues FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id WHERE T1.name = 'England'; |
what is the smallest city in the us?
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 MIN(population) FROM city); |
What are the department ids for which more than 10 employees had a commission?
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; |
List all the reviews which rated a business less than 1?
Schema:
- review(i_id, rank, rating, text) | SELECT "text" FROM review WHERE rating < 1; |
What are the names of the activities Mark Giuliano is involved in?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
- Faculty_Participates_in(FacID)
- Activity(activity_name) | SELECT T3.activity_name FROM Faculty AS T1 JOIN Faculty_Participates_in AS T2 ON T1.FacID = T2.FacID JOIN Activity AS T3 ON T3.actid = T2.actid WHERE T1.Fname = 'Mark' AND T1.Lname = 'Giuliano'; |
How many dorms have amenities?
Schema:
- Has_amenity(dormid) | SELECT COUNT(DISTINCT dormid) AS num_dorms FROM Has_amenity; |
Return the names of tracks that have no had any races.?
Schema:
- track(Location, Name, Seat, Seating, T1, Year_Opened)
- race(Class, Date, Name) | SELECT Name FROM track WHERE CAST(Track_ID AS TEXT) NOT IN (SELECT Track_ID FROM race); |
What is the most populace city that speaks English?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- countrylanguage(COUNT, CountryCode, Engl, Language) | SELECT T1.Name FROM city AS T1 JOIN countrylanguage AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2."Language" = 'English' ORDER BY T1.Population DESC NULLS LAST LIMIT 1; |
What is the name and date of the race that occurred most recently?
Schema:
- races(date, name) | SELECT name, "date" FROM races ORDER BY "date" DESC NULLS LAST LIMIT 1; |
Find the states where have some college students in tryout.?
Schema:
- College(M, cName, enr, state)
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT DISTINCT state FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName; |
What is the first, middle, and last name, along with the id and number of enrollments, for the student who enrolled the most in any program?
Schema:
- Students(cell_mobile_number, current_address_id, date_first_registered, date_left, date_of_latest_logon, email_address, family_name, first_name, last_name, login_name, middle_name, other_student_details, ... (1 more))
- Student_Enrolment(...) | SELECT T1.student_id, T1.first_name, T1.middle_name, T1.last_name, COUNT(*) AS num_enrollments FROM Students AS T1 JOIN Student_Enrolment AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id, T1.first_name, T1.middle_name, T1.last_name ORDER BY num_enrollments DESC NULLS LAST LIMIT 1; |
Give the color description for the product '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'; |
list papers published 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'; |
Where did sergey levine publish his last paper ?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.venueId, T3."year" 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 = 'sergey levine' GROUP BY T3.venueId, T3."year" ORDER BY T3."year" DESC NULLS LAST; |
How many different locations does each school have?
Schema:
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT COUNT(DISTINCT DEPT_ADDRESS) AS num_locations, SCHOOL_CODE FROM DEPARTMENT GROUP BY SCHOOL_CODE; |
How many cities are there in state "Colorado"?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT COUNT(*) AS num_cities FROM Addresses WHERE state_province_county = 'Colorado'; |
Find the number of classes in each school.?
Schema:
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
- COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT COUNT(*) AS num_classes, T3.SCHOOL_CODE FROM CLASS AS T1 JOIN COURSE AS T2 ON T1.CRS_CODE = T2.CRS_CODE JOIN DEPARTMENT AS T3 ON T2.DEPT_CODE = T3.DEPT_CODE GROUP BY T3.SCHOOL_CODE; |
Return the cities with more than 3 airports in the United States.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT city FROM airports WHERE country = 'United States' AND city IS NOT NULL GROUP BY city HAVING COUNT(*) > 3; |
Show the name, average attendance, total attendance for stadiums where no accidents happened.?
Schema:
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
- game(Date, Home_team, Season)
- injury_accident(Source) | SELECT T1.name, T1.Average_Attendance, T1.Total_Attendance FROM stadium AS T1 LEFT JOIN (SELECT T2.name, T2.Average_Attendance, T2.Total_Attendance FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id) AS T4 ON T1.name = T4.name AND T1.Average_Attendance = T4.Average_Attendance AND T1.Total_Attendance = T4.Total_Attendance WHERE T4.name IS NULL; |
Show the names of products and the number of events they are in, sorted by the number of events in descending order.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Products_in_Events(...) | SELECT T1.Product_Name, COUNT(*) AS num_events FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name ORDER BY num_events DESC NULLS LAST; |
Find the cities that have more than one employee under age 30.?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) | SELECT City FROM employee WHERE Age < 30 AND City IS NOT NULL GROUP BY City HAVING COUNT(*) > 1; |
what are some good restaurants in the bay area ?
Schema:
- location(...)
- restaurant(...)
- geographic(...) | SELECT T2.house_number, T1.name FROM location AS T2 JOIN restaurant AS T1 ON T1.id = T2.restaurant_id WHERE T1.city_name IN (SELECT city_name FROM geographic WHERE region = 'bay area') AND T1.rating > 2.5; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.