question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
How many events are there for each party?
Schema:
- party_events(Event_Name)
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more)) | SELECT T2.Party_name, COUNT(*) AS num_events FROM party_events AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID, T2.Party_name; |
List the grapes and appelations of all wines.?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT Grape, Appelation FROM wine; |
return me the number of citations of " Making database systems usable " in each year .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT "year", SUM(citation_num) AS num_citations FROM publication WHERE title = 'Making database systems usable' GROUP BY "year"; |
Give the names of mountains in alphabetical order.?
Schema:
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more)) | SELECT Name FROM mountain ORDER BY Name ASC NULLS LAST; |
Find the average unit price of tracks from the Rock genre.?
Schema:
- Genre(Name)
- Track(Milliseconds, Name, UnitPrice) | SELECT AVG(T2.UnitPrice) AS avg_unit_price FROM Genre AS T1 JOIN Track AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Rock'; |
Show location and name for all stadiums with a capacity between 5000 and 10000.?
Schema:
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1) | SELECT Location, Name FROM stadium WHERE Capacity BETWEEN 5000 AND 10000; |
What are the course names, ordered by credits?
Schema:
- Course(CName, Credits, Days) | SELECT CName FROM Course ORDER BY Credits ASC NULLS LAST; |
What are the codes of template types that are not used for any document?
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 DISTINCT Template_Type_Code FROM Templates WHERE Template_Type_Code NOT IN (SELECT Template_Type_Code FROM Templates AS T1 JOIN Documents AS T2 ON T1.Template_ID = T2.Template_ID); |
How many customers in state of CA?
Schema:
- customers(Mart, city, company, country, email, first_name, last_name, phone, state) | SELECT COUNT(*) AS num_customers FROM customers WHERE state = 'CA'; |
what is the smallest city in alaska?
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 WHERE state_name = 'alaska') AND state_name = 'alaska'; |
How many singers are there?
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; |
What are the first and last names of the first-grade students who are NOT taught by teacher OTHA MOYER?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
- teachers(Classroom, FirstName, LastName) | SELECT DISTINCT T1.FirstName, T1.LastName FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T1.Grade = 1 AND NOT (T2.FirstName = 'OTHA' AND T2.LastName = 'MOYER'); |
Find the names of products that were bought by at least two distinct customers.?
Schema:
- Customer_Orders(customer_id, order_date, order_id, order_shipping_charges)
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT DISTINCT T3.product_name FROM Customer_Orders AS T1 JOIN Order_Items AS T2 ON T1.order_id = T2.order_id JOIN Products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id, T3.product_name HAVING COUNT(DISTINCT T1.customer_id) >= 2; |
Find the average number of bedrooms of all the apartments.?
Schema:
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count) | SELECT AVG(bedroom_count) AS avg_bedroom_count FROM Apartments; |
What are the names of the songs by the artist whose last name is "Heilo"?
Schema:
- Performance(...)
- Band(...)
- Songs(Title) | SELECT T3.Title FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T2.Lastname = 'Heilo'; |
Which payment method is used the most often?
Schema:
- Payments(Amount_Payment, COUNT, Date_Payment_Made, Payment_ID, Payment_Method_Code, V, amount_due, amount_paid, payment_date, payment_type_code) | SELECT Payment_Method_Code FROM Payments WHERE Payment_Method_Code IS NOT NULL GROUP BY Payment_Method_Code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Among all the claims, what is the settlement amount of the claim with the largest claim amount? List both the settlement amount and claim amount.?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled) | SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Claimed DESC NULLS LAST LIMIT 1; |
Find the name and id of the good with the highest average rank.?
Schema:
- item(title)
- review(i_id, rank, rating, text) | SELECT T1.title, T1.i_id FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id, T1.title, T1.i_id ORDER BY AVG(T2."rank") DESC NULLS LAST LIMIT 1; |
What is the name of the body builder with the greatest body weight?
Schema:
- body_builder(Clean_Jerk, Snatch, Total)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Weight DESC NULLS LAST LIMIT 1; |
What are the names of perpetrators whose country is not "China"?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- perpetrator(Country, Date, Injured, Killed, Location, Year) | SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country != 'China'; |
Who are the nominees who were nominated for either of the Tony Award or Cleavant Derricks awards?
Schema:
- musical(Award, COUNT, Name, Nom, Nominee, Result, T1) | SELECT Nominee FROM musical WHERE Award = 'Tony Award' OR Award = 'Cleavant Derricks'; |
What are names of stations that have average bike availability above 10 and are not located in San Jose city?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
- status(...) | SELECT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T1.name NOT IN (SELECT name FROM station WHERE city = 'San Jose') GROUP BY T2.station_id, T1.name HAVING AVG(bikes_available) > 10; |
Count the number of artists who have had volumes.?
Schema:
- volume(Artist_ID, Issue_Date, Song, Weeks_on_Top) | SELECT COUNT(DISTINCT Artist_ID) AS num_artists FROM volume; |
What are the last names that are used by customers and staff?
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 last_name FROM Customers WHERE last_name IN (SELECT last_name FROM Staff); |
through which states does the longest river in texas run?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT traverse FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river WHERE traverse = 'texas'); |
Select the average price of each manufacturer's products, showing the manufacturer's name.?
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 AVG(T1.Price) AS avg_price, T2.Name FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name; |
What are the titles of the cartoons sorted alphabetically?
Schema:
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by) | SELECT Title FROM Cartoon ORDER BY Title ASC NULLS LAST; |
Papers by Peter Mertens and Dina Barbian?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT T3.paperId 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 = 'Peter Mertens' AND T1.authorName = 'Dina Barbian'; |
Give the color description that is least common across products.?
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 GROUP BY T2.color_description ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
List all airline names and their abbreviations in "USA".?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name) | SELECT Airline, Abbreviation FROM airlines WHERE Country = 'USA'; |
How many accounts does each customer have? List the number and customer id.?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT COUNT(*) AS num_accounts, customer_id FROM Accounts GROUP BY customer_id; |
Find the number of accounts with a savings balance that is higher than the average savings balance.?
Schema:
- SAVINGS(SAV, balance) | SELECT COUNT(*) AS num_accounts FROM SAVINGS WHERE balance > (SELECT AVG(balance) FROM SAVINGS); |
What is the average unit price of tracks that belong to Jazz genre?
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'; |
What is the name of each teacher and what course they teach?
Schema:
- course_arrange(...)
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- teacher(Age, COUNT, D, Hometown, Name) | SELECT T3.Name, T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID; |
Return the title of the film with the highest high estimate?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
- film_market_estimation(High_Estimate, Low_Estimate, Type) | SELECT T1.Title FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID ORDER BY High_Estimate DESC NULLS LAST LIMIT 1; |
Which services have been used more than twice in first notification of loss? Return the service name.?
Schema:
- First_Notification_of_Loss(...)
- Services(Service_Type_Code, Service_name) | SELECT T2.Service_name FROM First_Notification_of_Loss AS T1 JOIN Services AS T2 ON T1.Service_ID = T2.Service_ID GROUP BY T1.Service_ID, T2.Service_name HAVING COUNT(*) > 2; |
Which major has the most students?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Major FROM Student WHERE Major IS NOT NULL GROUP BY Major ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the region and population of Angola?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT Population, Region FROM country WHERE Name = 'Angola'; |
Give the names and scores of wines made from white grapes.?
Schema:
- grapes(...)
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT T2.Name, T2.Score FROM grapes AS T1 JOIN wine AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'White'; |
Show the transaction type code that occurs the most frequently.?
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(*) DESC NULLS LAST LIMIT 1; |
How many accounts are there?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT COUNT(*) AS num_accounts FROM Accounts; |
name the longest river in us?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river); |
what is the highest point of the state with the smallest population density?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT highest_point FROM highlow WHERE state_name IN (SELECT state_name FROM state WHERE density = (SELECT MIN(density) FROM state)); |
How many pilots are there?
Schema:
- pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team) | SELECT COUNT(*) AS num_pilots FROM pilot; |
Count the number of accounts corresponding to each customer id.?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT COUNT(*) AS num_accounts, customer_id FROM Accounts GROUP BY customer_id; |
What is the unit of measuerment of the product category code "Herbs"?
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 name and description for location code x?
Schema:
- Ref_Locations(Location_Code, Location_Description, Location_Name) | SELECT Location_Name, Location_Description FROM Ref_Locations WHERE Location_Code = 'x'; |
What are the names of tourist attractions that can be reached by walk or is at address 660 Shea Crescent?
Schema:
- Locations(Address, Location_Name, Other_Details)
- 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 T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = '660 Shea Crescent' OR T2.How_to_Get_There = 'walk'; |
Which team has the oldest player?
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 1; |
What is the first name and age of every student who lives 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.Age FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid NOT 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'); |
How many likes does Kyle have?
Schema:
- Likes(student_id)
- Highschooler(COUNT, ID, grade, name) | SELECT COUNT(*) AS num_likes FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID WHERE T2.name = 'Kyle'; |
How many papers are in 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 last name of students who is either female (sex is F) and living in the city of code BAL or male (sex is M) and in age of below 20.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT DISTINCT LName FROM (SELECT LName FROM Student WHERE Sex = 'F' AND city_code = 'BAL' UNION ALL SELECT LName FROM Student WHERE Sex = 'M' AND Age < 20); |
What are the distinct types of mills that are built by American or Canadian architects?
Schema:
- mill(Moul, location, name, type)
- architect(gender, id, name, nationality) | SELECT DISTINCT T1.type FROM mill AS T1 JOIN architect AS T2 ON CAST(T1.architect_id AS TEXT) = T2.id WHERE T2.nationality = 'American' OR T2.nationality = 'Canadian'; |
where are some good arabic restaurants 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; |
What are the names of the climbers, ordered by points descending?
Schema:
- climber(Country, K, Name, Points) | SELECT Name FROM climber ORDER BY Points DESC NULLS LAST; |
What are the register ids of electoral registries that have the cross reference source system code 'Electoral' or 'Tax'?
Schema:
- Electoral_Register(...)
- CMI_Cross_References(source_system_code) | SELECT T1.electoral_register_id FROM Electoral_Register AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id WHERE T2.source_system_code = 'Electoral' OR T2.source_system_code = 'Tax'; |
What are the titles and studios of films that have been produced by a studio whose name contains "Universal"?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) | SELECT Title, Studio FROM film WHERE Studio LIKE '%Universal%'; |
For each customer status code, how many customers are classified that way?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT customer_status_code, COUNT(*) AS num_customers FROM Customers GROUP BY customer_status_code; |
Find the ids of all distinct customers who made order after some orders that were Cancelled.?
Schema:
- Customer_Orders(customer_id, order_date, order_id, order_shipping_charges) | SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date > (SELECT MIN(order_date) FROM Customer_Orders WHERE order_status_code = 'Cancelled'); |
What is the "active to date" of the latest contact channel used by "Tillman Ernser"?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Customer_Contact_Channels(DATEDIFF, DAY, active_from_date, active_to_date, channel_code, contact_number, diff) | SELECT MAX(T2.active_to_date) AS max_active_to_date FROM Customers AS T1 JOIN Customer_Contact_Channels AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = 'Tillman Ernser'; |
List the date of perpetrators in descending order of the number of people killed.?
Schema:
- perpetrator(Country, Date, Injured, Killed, Location, Year) | SELECT "Date" FROM perpetrator ORDER BY Killed DESC NULLS LAST; |
What are the names of wines with scores higher than 90?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT Name FROM wine WHERE Score > 90; |
Show names of actors in descending order of the year their musical is awarded.?
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 T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID ORDER BY T2."Year" DESC NULLS LAST; |
Show names and phones of customers who do not have address information.?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Customer_Address_History(...) | SELECT customer_name, customer_phone FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Customer_Address_History); |
Find the id and local authority of the station with has the highest average high temperature.?
Schema:
- weekly_weather(low_temperature, wind_speed_mph)
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT T2.id, T2.local_authority FROM weekly_weather AS T1 JOIN station AS T2 ON T1.station_id = T2.id GROUP BY T1.station_id, T2.id, T2.local_authority ORDER BY AVG(high_temperature) DESC NULLS LAST LIMIT 1; |
What are the emails of the professionals living in either the state of Hawaii or the state of Wisconsin?
Schema:
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street) | SELECT email_address FROM Professionals WHERE state = 'Hawaii' OR state = 'Wisconsin'; |
How many clubs does "Linda Smith" belong to?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn)
- Member_of_club(...)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_clubs FROM Club AS T1 JOIN Member_of_club AS T2 ON T1.ClubID = T2.ClubID JOIN Student AS T3 ON T2.StuID = T3.StuID WHERE T3.Fname = 'Linda' AND T3.LName = 'Smith'; |
List the grape, appelation and name of wines whose score is higher than 93 ordered by Name.?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT Grape, Appelation, Name FROM wine WHERE Score > 93 ORDER BY Name ASC NULLS LAST; |
What are the maximum price and score of wines in each year?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT MAX(Price) AS max_price, MAX(Score) AS max_score, "Year" FROM wine GROUP BY "Year"; |
What are the names of all the races that occurred in the year 2017?
Schema:
- races(date, name) | SELECT name FROM races WHERE "year" = 2017; |
What is the total amount of moeny paid by the customer Carole Bernhard?
Schema:
- Customer_Payments(payment_method_code)
- 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 SUM(T1.amount_payment) AS total_amount_paid FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Carole' AND T2.last_name = 'Bernhard'; |
What is the last name of the professor whose office is located in DRE 102, and when were they hired?
Schema:
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME)
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) | SELECT T1.EMP_LNAME, T1.EMP_HIREDATE FROM EMPLOYEE AS T1 JOIN PROFESSOR AS T2 ON T1.EMP_NUM = T2.EMP_NUM WHERE T2.PROF_OFFICE = 'DRE 102'; |
Return the names and classes of ships that do not have a captain?
Schema:
- Ship(Built_Year, COUNT, Class, Flag, Name, Type)
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT Name, Class FROM Ship WHERE Ship_ID NOT IN (SELECT Ship_ID FROM captain); |
Show the number of projects.?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT COUNT(*) AS num_projects FROM Projects; |
Return the decor of the room named "Recluse and defiance".?
Schema:
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT decor FROM Rooms WHERE roomName = 'Recluse and defiance'; |
Show the name and prominence of the mountains whose picture is not taken by a lens of brand 'Sigma'.?
Schema:
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
- photos(color, id, name)
- camera_lens(brand, name) | SELECT T1.name, T1.Prominence FROM mountain AS T1 LEFT JOIN (SELECT T1.id FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T3.brand = 'Sigma') AS T4 ON T1.id = T4.id WHERE T4.id IS NULL; |
What are the names, address roads, and cities of the branches ordered by opening year?
Schema:
- branch(Address_road, City, Name, Open_year, membership_amount) | SELECT Name, Address_road, City FROM branch ORDER BY Open_year ASC NULLS LAST; |
What are the monthly rentals of student addresses in Texas state?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- Student_Addresses(monthly_rental) | SELECT T2.monthly_rental FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id WHERE T1.state_province_county = 'Texas'; |
Find the three most expensive procedures.?
Schema:
- Procedures(Cost, Name) | SELECT Name FROM Procedures ORDER BY Cost ASC NULLS LAST LIMIT 3; |
Find the list of attribute data types possessed by more than 3 attribute definitions.?
Schema:
- Attribute_Definitions(attribute_data_type, attribute_name) | SELECT attribute_data_type FROM Attribute_Definitions WHERE attribute_data_type IS NOT NULL GROUP BY attribute_data_type HAVING COUNT(*) > 3; |
Find the id and color description of the products with at least 2 characteristics.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Ref_Colors(color_description)
- Product_Characteristics(...) | SELECT T1.product_id, T2.color_description FROM Products AS T1 JOIN Ref_Colors AS T2 ON T1.color_code = T2.color_code JOIN Product_Characteristics AS T3 ON T1.product_id = T3.product_id GROUP BY T1.product_id, T2.color_description HAVING COUNT(*) >= 2; |
Show all game names played by Linda Smith?
Schema:
- Plays_Games(GameID, Hours_Played, StuID)
- Video_Games(COUNT, Dest, GName, GType, onl)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT GName FROM Plays_Games AS T1 JOIN Video_Games AS T2 ON T1.GameID = T2.GameID JOIN Student AS T3 ON T3.StuID = T1.StuID WHERE T3.LName = 'Smith' AND T3.Fname = 'Linda'; |
What is the count of distinct employees with certificates?
Schema:
- certificate(eid) | SELECT COUNT(DISTINCT eid) AS num_employees FROM certificate; |
Show all male student ids who don't play football.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID) | SELECT StuID FROM Student WHERE Sex = 'M' AND StuID NOT IN (SELECT StuID FROM SportsInfo WHERE SportName = 'Football'); |
What are the code and description of the most frequent behavior incident type?
Schema:
- Behavior_Incident(NO, date_incident_end, date_incident_start, incident_type_code)
- Ref_Incident_Type(incident_type_code, incident_type_description) | SELECT T1.incident_type_code, T2.incident_type_description FROM Behavior_Incident AS T1 JOIN Ref_Incident_Type AS T2 ON T1.incident_type_code = T2.incident_type_code GROUP BY T1.incident_type_code, T2.incident_type_description ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the states of the colleges where students who tried out for the striker position attend?
Schema:
- College(M, cName, enr, state)
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT T1.state FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'striker'; |
What are the first and last names of the customers with the 10 cheapest invoices?
Schema:
- customers(Mart, city, company, country, email, first_name, last_name, phone, state)
- invoices(billing_city, billing_country, billing_state, total) | SELECT T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY total ASC NULLS LAST LIMIT 10; |
what are the capitals of the states that border 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 T2.capital FROM state AS T2 JOIN border_info AS T1 ON T2.state_name = T1.border WHERE T1.state_name = 'texas'; |
What are the names of customers who live in Colorado state?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Customer_Addresses(address_type_code)
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT T1.customer_name FROM Customers AS T1 JOIN Customer_Addresses AS T2 ON T1.customer_id = T2.customer_id JOIN Addresses AS T3 ON T2.address_id = T3.address_id WHERE T3.state_province_county = 'Colorado'; |
What is the title of the course that is a prerequisite for Mobile Computing?
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 = 'Mobile Computing'); |
How many teachers does the student named CHRISSY NABOZNY have?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
- teachers(Classroom, FirstName, LastName) | SELECT COUNT(*) AS num_teachers FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T1.FirstName = 'CHRISSY' AND T1.LastName = 'NABOZNY'; |
monte carlo simulation papers published after 2011?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.keyphraseName = 'monte carlo simulation' AND T3."year" > 2011; |
What papers were published in acl in 2012 about Parsing ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- venue(venueId, venueName) | SELECT DISTINCT T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.keyphraseName = 'Parsing' AND T3."year" = 2012 AND T4.venueName = 'acl'; |
What is the name of the 3 employees who get paid the least?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) | SELECT name FROM employee ORDER BY salary ASC NULLS LAST LIMIT 3; |
Please show the most common reigns of wrestlers.?
Schema:
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT Reign FROM wrestler WHERE Reign IS NOT NULL GROUP BY Reign ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Which problems were reported by the staff named Dameon Frami or Jolie Weber? Give me the ids of the problems.?
Schema:
- Problems(date_problem_reported, problem_id)
- 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 problem_id FROM (SELECT T1.problem_id FROM Problems AS T1 JOIN Staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = 'Dameon' AND T2.staff_last_name = 'Frami' UNION ALL SELECT T1.problem_id FROM Problems AS T1 JOIN Staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = 'Jolie' AND T2.staff_last_name = 'Weber'); |
What is the id of the problem log that is created most recently?
Schema:
- Problem_Log(log_entry_date, log_entry_description, problem_id, problem_log_id) | SELECT problem_log_id FROM Problem_Log ORDER BY log_entry_date DESC NULLS LAST LIMIT 1; |
How many accelerators are not compatible with the browsers listed ?
Schema:
- Web_client_accelerator(Client, Operating_system)
- accelerator_compatible_browser(...) | SELECT COUNT(*) AS num_accelerators FROM Web_client_accelerator WHERE id NOT IN (SELECT accelerator_id FROM accelerator_compatible_browser); |
Return the average and minimum ages across artists from the United States.?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT AVG(Age) AS avg_age, MIN(Age) AS min_age FROM artist WHERE Country = 'United States'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.