question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
List the document type code for the document with the id 2.?
Schema:
- Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more)) | SELECT document_type_code FROM Documents WHERE document_id = 2; |
What are the booking start and end dates of the apartments with type code "Duplex"?
Schema:
- Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code)
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count) | SELECT T1.booking_start_date, T1.booking_end_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_type_code = 'Duplex'; |
Find the name of dorms only for female (F gender).?
Schema:
- Dorm(dorm_name, gender, student_capacity) | SELECT dorm_name FROM Dorm WHERE gender = 'F'; |
Which paper has the most authors? Give me the paper title.?
Schema:
- Authorship(...)
- Papers(title) | SELECT T2.title FROM Authorship AS T1 JOIN Papers AS T2 ON T1.paperID = T2.paperID WHERE T1.authOrder = (SELECT MAX(authOrder) FROM Authorship); |
what rivers flow through states that border the state with the largest population?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
- border_info(T1, border, state_name)
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT river_name FROM river WHERE traverse IN (SELECT border FROM border_info WHERE state_name IN (SELECT state_name FROM state WHERE population = (SELECT MAX(population) FROM state))); |
Which allergy type has most number of allergies?
Schema:
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT AllergyType FROM Allergy_Type WHERE AllergyType IS NOT NULL GROUP BY AllergyType ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the name of the conductor who has worked the greatest number of years?
Schema:
- conductor(Age, Name, Nationality, Year_of_Work) | SELECT Name FROM conductor ORDER BY Year_of_Work DESC NULLS LAST LIMIT 1; |
Where is the best restaurant in san francisco for french food ?
Schema:
- restaurant(...)
- location(...) | SELECT T2.house_number, T1.name FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'san francisco' AND T1.food_type = 'french' AND T1.rating = (SELECT MAX(T1.rating) FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'san francisco' AND T1.food_type = 'french'); |
What are the start date and end date of each apartment booking?
Schema:
- Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code) | SELECT booking_start_date, booking_end_date FROM Apartment_Bookings; |
Which customer's name contains "Alex"? Find the full name.?
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_name FROM Customers WHERE customer_name LIKE '%Alex%'; |
Return the number of companies created by Andy.?
Schema:
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT COUNT(*) AS num_companies FROM Manufacturers WHERE Founder = 'Andy'; |
What is the name of the player with the largest number of votes?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT Player_name FROM player ORDER BY Votes DESC NULLS LAST LIMIT 1; |
What are the first names of all students that are not enrolled in courses?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Enrolled_in(Fname, Grade, LName, StuID, T2, T3, gradepoint) | SELECT Fname FROM Student WHERE StuID NOT IN (SELECT StuID FROM Enrolled_in); |
List all the distinct product names ordered by product id?
Schema:
- Product(product_id, product_name) | SELECT product_name FROM Product WHERE product_name IS NOT NULL AND product_id IS NOT NULL GROUP BY product_name, product_id ORDER BY product_id ASC NULLS LAST; |
Show all document ids and the number of paragraphs in each document. Order by document id.?
Schema:
- Paragraphs(COUNT, Document_ID, Other_Details, Paragraph_Text, T1) | SELECT Document_ID, COUNT(*) AS num_paragraphs FROM Paragraphs WHERE Document_ID IS NOT NULL GROUP BY Document_ID ORDER BY Document_ID ASC NULLS LAST; |
What is the air date of TV series with Episode "A Love of a Lifetime"?
Schema:
- TV_series(Air_Date, Episode, Rating, Share, Weekly_Rank) | SELECT Air_Date FROM TV_series WHERE Episode = 'A Love of a Lifetime'; |
Tell me the owner id and last name of the owner who spent the most on treatments of his or her dogs.?
Schema:
- Owners(email_address, first_name, last_name, state)
- Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT T1.owner_id, T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id JOIN Treatments AS T3 ON T2.dog_id = T3.dog_id GROUP BY T1.owner_id, T1.last_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many players are from each country?
Schema:
- players(COUNT, birth_date, country_code, first_name, hand, last_name) | SELECT COUNT(*) AS num_players, country_code FROM players GROUP BY country_code; |
What is the average age of students who are living in the dorm with the largest capacity?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Lives_in(...)
- Dorm(dorm_name, gender, student_capacity) | SELECT AVG(T1.Age) AS avg_age FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.student_capacity = (SELECT MAX(student_capacity) FROM Dorm); |
What are the famous titles of artists who do not have any volumes?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
- volume(Artist_ID, Issue_Date, Song, Weeks_on_Top) | SELECT Famous_Title FROM artist WHERE Artist_ID NOT IN(SELECT Artist_ID FROM volume); |
Find the ids of the problems that are reported by the staff whose last name is Bosco.?
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 T1.problem_id FROM Problems AS T1 JOIN Staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_last_name = 'Bosco'; |
List the email, cell phone and home phone of all the professionals.?
Schema:
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street) | SELECT email_address, cell_number, home_phone FROM Professionals; |
what state has the smallest area?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM state WHERE area = (SELECT MIN(area) FROM state); |
What are the addresses of customers living in Germany who have had an invoice?
Schema:
- Customer(Email, FirstName, LastName, State, lu)
- Invoice(BillingCountry) | SELECT DISTINCT T1.Address FROM Customer AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.Country = 'Germany'; |
List the most common type of Status across cities.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT Status FROM city WHERE Status IS NOT NULL GROUP BY Status ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the names of enzymes in the medicine named 'Amisulpride' that can serve as an 'inhibitor'?
Schema:
- enzyme(Chromosome, Location, OMIM, Porphyria, Product, name)
- medicine_enzyme_interaction(interaction_type)
- medicine(FDA_approved, Trade_Name, name) | SELECT T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id JOIN medicine AS T3 ON T2.medicine_id = T3.id WHERE T3.name = 'Amisulpride' AND T2.interaction_type = 'inhibitor'; |
What are the names of the five cities with the greatest proportion of white people?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT Name FROM city ORDER BY White DESC NULLS LAST LIMIT 5; |
return me the papers written by " H. V. Jagadish " and " Yunyao Li " on PVLDB .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name)
- writes(...)
- author(...) | SELECT T6.title FROM publication AS T6 JOIN journal AS T4 ON T6.jid = T4.jid JOIN writes AS T3 ON T3.pid = T6.pid JOIN writes AS T5 ON T5.pid = T6.pid JOIN author AS T1 ON T5.aid = T1.aid JOIN author AS T2 ON T3.aid = T2.aid WHERE T2.name = 'H. V. Jagadish' AND T1.name = 'Yunyao Li' AND T4.name = 'PVLDB'; |
What papers has written by sharon goldwater ?
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'; |
conferences that mention ImageNet?
Schema:
- paperDataset(...)
- dataset(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.venueId FROM paperDataset AS T2 JOIN dataset AS T1 ON T2.datasetId = T1.datasetId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.datasetName = 'ImageNet'; |
What are the different ages of editors? Show each age along with the number of editors of that age.?
Schema:
- editor(Age, COUNT, Name) | SELECT Age, COUNT(*) AS num_editors FROM editor GROUP BY Age; |
What is the average age for each gender?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT AVG(age) AS avg_age, gender FROM Person GROUP BY gender; |
Count the number of distinct channel owners.?
Schema:
- channel(Name, Owner, Rating_in_percent, Share_in_percent) | SELECT COUNT(DISTINCT Owner) AS num_owners FROM channel; |
Show names of technicians in ascending order of quality rank of the machine they are assigned.?
Schema:
- repair_assignment(...)
- machine(...)
- technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name) | SELECT T3.name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.Machine_ID = T2.Machine_ID JOIN technician AS T3 ON T1.technician_id = T3.technician_id ORDER BY T2.quality_rank ASC NULLS LAST; |
how high is the highest point of delaware?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT highest_elevation FROM highlow WHERE state_name = 'delaware'; |
Find the document type name of the document named "How to read a book".?
Schema:
- All_Documents(Date_Stored, Document_Name, Document_Type_Code)
- Ref_Document_Types(Document_Type_Code, Document_Type_Description, Document_Type_Name, document_type_code, document_type_description) | SELECT T2.Document_Type_Name FROM All_Documents AS T1 JOIN Ref_Document_Types AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code WHERE T1.Document_Name = 'How to read a book'; |
Show all main industry and total market value in each industry.?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Main_Industry, SUM(Market_Value) AS total_market_value FROM company GROUP BY Main_Industry; |
Find the number and time of the train that goes from Chennai to Guruvayur.?
Schema:
- train(Name, Service, Time, destination, name, origin, time, train_number) | SELECT train_number, "time" FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur'; |
Find the schools that were either founded after 1850 or public.?
Schema:
- university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School) | SELECT School FROM university WHERE Founded > 1850 OR Affiliation = 'Public'; |
Show the name and description of the role played by the employee named Ebba.?
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 T2.Role_Name, T2.Role_Description FROM Employees AS T1 JOIN Roles AS T2 ON T1.Role_Code = T2.Role_Code WHERE T1.Employee_Name = 'Ebba'; |
How many distinct transaction types are used in the transactions?
Schema:
- Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code) | SELECT COUNT(DISTINCT transaction_type_code) AS num_transaction_types FROM Transactions; |
What is the type description of the organization whose detail is listed as 'quo'?
Schema:
- Organisation_Types(...)
- Organisations(...) | SELECT T1.organisation_type_description FROM Organisation_Types AS T1 JOIN Organisations AS T2 ON T1.organisation_type = T2.organisation_type WHERE T2.organisation_details = 'quo'; |
What is the name, account type, and account balance corresponding to the customer with the highest credit score?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) | SELECT cust_name, acc_type, acc_bal FROM customer ORDER BY credit_score DESC NULLS LAST LIMIT 1; |
Find the common personal name of course authors and students.?
Schema:
- Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name)
- 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 DISTINCT Course_Authors_and_Tutors.personal_name FROM Course_Authors_and_Tutors JOIN Students ON Course_Authors_and_Tutors.personal_name = Students.personal_name; |
Return the name of the party with the most members.?
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 T2.Party_name FROM member_ AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID, T2.Party_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many films are there in each category? List the genre name, genre id and the count.?
Schema:
- film_category(...)
- category(...) | SELECT T2.name, T1.category_id, COUNT(*) AS num_films FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T2.name, T1.category_id; |
List the titles of books that are not published.?
Schema:
- book(Ela, Issues, Title, Writer)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT Title FROM book WHERE Book_ID NOT IN (SELECT Book_ID FROM publication); |
how many rivers run through the states bordering colorado?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
- border_info(T1, border, state_name) | SELECT COUNT(river_name) AS num_rivers FROM river WHERE traverse IN (SELECT border FROM border_info WHERE state_name = 'colorado'); |
Find the number of dog pets that are raised by female students (with sex F).?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Pet(...)
- Pets(PetID, PetType, pet_age, weight) | SELECT COUNT(*) AS num_dogs FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID JOIN Pets AS T3 ON T2.PetID = T3.PetID WHERE T1.Sex = 'F' AND T3.PetType = 'dog'; |
Who are the different directors of films which had market estimation in 1995?
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 DISTINCT T1.Director FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID WHERE T2."Year" = 1995; |
What are the names of the branches that have some members with a hometown in Louisville, Kentucky and also those from Hiram, Goergia?
Schema:
- membership_register_branch(...)
- branch(Address_road, City, Name, Open_year, membership_amount)
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) | SELECT T2.Name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.Branch_ID = T2.Branch_ID JOIN member_ AS T3 ON T1.Member_ID = T3.Member_ID WHERE T3.Hometown IN ('Louisville, Kentucky', 'Hiram, Georgia') GROUP BY T2.Name HAVING COUNT(DISTINCT T3.Hometown) = 2; |
What is the birth date of the poker player with the lowest earnings?
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 T1.Birth_Date FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Earnings ASC NULLS LAST LIMIT 1; |
How many trips started from Mountain View city and ended at Palo Alto city?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT COUNT(*) AS num_trips FROM station AS T1, trip AS T2, station AS T3, trip AS T4 WHERE T1.id = T2.start_station_id AND T2.id = T4.id AND T3.id = T4.end_station_id AND T1.city = 'Mountain View' AND T3.city = 'Palo Alto'; |
Count the number of people of each sex who have a weight higher than 85.?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT COUNT(*) AS num_people, Sex FROM people WHERE Weight > 85 GROUP BY Sex; |
Which of the airport names contains the word 'international'?
Schema:
- airport(Airport_Name, City, Country, Domestic_Passengers, International_Passengers, Transit_Passengers, id, name) | SELECT name FROM airport WHERE name LIKE '%international%'; |
What is the most frequently ordered product? Tell me the detail of the product?
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 FROM Order_Items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id, T2.product_details ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
When did the staff member with first name as Janessa and last name as Sawayn join the company?
Schema:
- 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 date_joined_staff FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'; |
How many different locations does the school with code BUS has?
Schema:
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT COUNT(DISTINCT DEPT_ADDRESS) AS num_locations FROM DEPARTMENT WHERE SCHOOL_CODE = 'BUS'; |
Show the names of players and names of their coaches in descending order of the votes of players.?
Schema:
- player_coach(...)
- coach(...)
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT T3.Player_name, T2.Coach_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID ORDER BY T3.Votes DESC NULLS LAST; |
Find the dates on which more than one revisions were made.?
Schema:
- Catalogs(COUNT, catalog_publisher, date_of_latest_revision) | SELECT date_of_latest_revision FROM Catalogs WHERE date_of_latest_revision IS NOT NULL GROUP BY date_of_latest_revision HAVING COUNT(*) > 1; |
What are the course names for courses taught on MTW?
Schema:
- Course(CName, Credits, Days) | SELECT CName FROM Course WHERE Days = 'MTW'; |
What is the name of the bank branch that has lent the greatest amount?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state)
- loan(...) | SELECT T1.bname FROM bank AS T1 JOIN loan AS T2 ON CAST(T1.branch_ID AS TEXT) = T2.branch_ID GROUP BY T1.bname ORDER BY SUM(T2.amount) DESC NULLS LAST LIMIT 1; |
return me the authors who have papers in PVLDB after 2010 .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name)
- writes(...)
- author(...) | SELECT T1.name FROM publication AS T4 JOIN journal AS T2 ON T4.jid = T2.jid JOIN writes AS T3 ON T3.pid = T4.pid JOIN author AS T1 ON T3.aid = T1.aid WHERE T2.name = 'PVLDB' AND T4."year" > 2010; |
How many students enrolled in class ACCT-211?
Schema:
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
- ENROLL(...) | SELECT COUNT(*) AS num_students FROM CLASS AS T1 JOIN ENROLL AS T2 ON T1.CLASS_CODE = T2.CLASS_CODE WHERE T1.CRS_CODE = 'ACCT-211'; |
What is the booking status code of the apartment with apartment number "Suite 634"?
Schema:
- Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code)
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count) | SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_number = 'Suite 634'; |
What are the last names of the author of the paper titled "Binders Unbound"?
Schema:
- Authors(fname, lname)
- Authorship(...)
- Papers(title) | SELECT T1.lname FROM Authors AS T1 JOIN Authorship AS T2 ON T1.authID = T2.authID JOIN Papers AS T3 ON T2.paperID = T3.paperID WHERE T3.title = 'Binders Unbound'; |
what is the highest point in the state with the smallest population?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT T2.highest_point FROM state AS T1 JOIN highlow AS T2 ON T1.state_name = T2.state_name WHERE T1.state_name IN (SELECT state_name FROM state WHERE population = (SELECT MIN(population) FROM state)); |
How many people are there of each nationality?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT Nationality, COUNT(*) AS num_people FROM people GROUP BY Nationality; |
How many wines are produced at Robert Biale winery?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT COUNT(*) AS num_wines FROM wine WHERE Winery = 'Robert Biale'; |
What are the types of vocals used in the song "Demon Kitty Rag"?
Schema:
- Vocals(COUNT, Type)
- Songs(Title) | SELECT COUNT(*) AS num_vocals FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Title = 'Demon Kitty Rag'; |
What is the maximum enrollment across all schools?
Schema:
- university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School) | SELECT MAX(Enrollment) AS max_enrollment FROM university; |
Which shops' number products is above the average? Give me the shop names.?
Schema:
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT Name FROM shop WHERE Number_products > (SELECT AVG(Number_products) FROM shop); |
What are the titles and directors of the movies whose star is greater than the average stars of the movies directed by James Cameron?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year) | SELECT T2.title, T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars > (SELECT AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = 'James Cameron'); |
When are the birthdays of customer who are classified as 'Good Customer' status?
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 date_of_birth FROM Customers WHERE customer_status_code = 'Good Customer'; |
Show all the locations where some cinemas were opened in both year 2010 and year 2011.?
Schema:
- cinema(COUNT, Capacity, Location, Name, Openning_year, T1, c) | SELECT DISTINCT T1.Location FROM cinema AS T1 JOIN cinema AS T2 ON T1.Location = T2.Location WHERE T1.Openning_year = 2010 AND T2.Openning_year = 2011; |
What is the count of aircrafts that have a distance between 1000 and 5000?
Schema:
- aircraft(Description, aid, d, distance, name) | SELECT COUNT(*) AS num_aircrafts FROM aircraft WHERE distance BETWEEN 1000 AND 5000; |
What are the id and name of the mountains that have at least 2 photos?
Schema:
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
- photos(color, id, name) | SELECT T1.id, T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id GROUP BY T1.id, T1.name HAVING COUNT(*) >= 2; |
Find the distinct locations that has a cinema.?
Schema:
- cinema(COUNT, Capacity, Location, Name, Openning_year, T1, c) | SELECT DISTINCT Location FROM cinema; |
List the title of all cartoons in alphabetical order.?
Schema:
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by) | SELECT Title FROM Cartoon ORDER BY Title ASC NULLS LAST; |
Which countries have more than two members?
Schema:
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) | SELECT Country FROM member_ WHERE Country IS NOT NULL GROUP BY Country HAVING COUNT(*) > 2; |
How many invoices were billed from each state?
Schema:
- invoices(billing_city, billing_country, billing_state, total) | SELECT billing_state, COUNT(*) AS num_invoices FROM invoices WHERE billing_country = 'USA' GROUP BY billing_state; |
List " James Bond " directors?
Schema:
- director(Afghan, name, nationality)
- directed_by(...)
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) | SELECT T2.name FROM director AS T2 JOIN directed_by AS T1 ON T2.did = T1.did JOIN movie AS T3 ON T3.mid = T1.msid WHERE T3.title = 'James Bond'; |
What are the id and first name of the student whose addresses have the highest average monthly rental?
Schema:
- Student_Addresses(monthly_rental)
- 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 T1.student_id, T2.first_name FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id, T2.first_name ORDER BY AVG(monthly_rental) DESC NULLS LAST LIMIT 1; |
Show all information on the airport that has the largest number of international passengers.?
Schema:
- airport(Airport_Name, City, Country, Domestic_Passengers, International_Passengers, Transit_Passengers, id, name) | SELECT * FROM airport ORDER BY International_Passengers DESC NULLS LAST LIMIT 1; |
what are the employee ids and job titles for employees in department 80?
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))
- jobs(JOB_TITLE, diff) | SELECT T1.EMPLOYEE_ID, T2.JOB_TITLE FROM employees AS T1 JOIN jobs AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T1.DEPARTMENT_ID = 80; |
What are the names of climbers who are not from the country of Switzerland?
Schema:
- climber(Country, K, Name, Points) | SELECT Name FROM climber WHERE Country != 'Switzerland'; |
Return the investor who have invested in the greatest number of entrepreneurs.?
Schema:
- entrepreneur(COUNT, Company, Investor, Money_Requested) | SELECT Investor FROM entrepreneur WHERE Investor IS NOT NULL GROUP BY Investor ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the languages used by the least number of TV Channels and how many channels use it?
Schema:
- TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name) | SELECT "Language", COUNT(*) AS num_channels FROM TV_Channel GROUP BY "Language" ORDER BY num_channels ASC NULLS LAST LIMIT 1; |
What is the most common type of ships?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT Type FROM ship WHERE Type IS NOT NULL GROUP BY Type ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show names of teachers that teach at least two courses.?
Schema:
- course_arrange(...)
- teacher(Age, COUNT, D, Hometown, Name) | SELECT T2.Name FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name HAVING COUNT(*) >= 2; |
what papers does oren etzioni cite?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...)
- writes(...)
- author(...) | SELECT DISTINCT T3.paperId FROM paper AS T3 JOIN cite AS T4 ON T3.paperId = T4.citingPaperId JOIN writes AS T2 ON T2.paperId = T4.citedPaperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'oren etzioni'; |
Return the minimum and maximum crime rates across all counties.?
Schema:
- county_public_safety(COUNT, Case_burden, Crime_rate, Location, Name, Police_force, Police_officers, Population, T1) | SELECT MIN(Crime_rate) AS min_crime_rate, MAX(Crime_rate) AS max_crime_rate FROM county_public_safety; |
Check the invoices record and compute the average quantities ordered with the payment method "MasterCard".?
Schema:
- Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code) | SELECT AVG(TRY_CAST(Order_Quantity AS DOUBLE)) AS avg_quantity FROM Invoices WHERE payment_method_code = 'MasterCard'; |
How many registed students do each course have? List course name and the number of their registered students?
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_Course_Registrations(COUNT, student_id)
- Courses(course_description, course_name) | SELECT T3.course_name, COUNT(*) AS num_students FROM Students AS T1 JOIN Student_Course_Registrations AS T2 ON T1.student_id = T2.student_id JOIN Courses AS T3 ON CAST(T2.course_id AS TEXT) = T3.course_id GROUP BY T2.course_id, T3.course_name; |
What are the distinct buildings with capacities of greater than 50?
Schema:
- classroom(building, capacity, room_number) | SELECT DISTINCT building FROM classroom WHERE capacity > 50; |
What are the ids of the problems reported after the date of any problems reported by Rylan Homenick?
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 T1.problem_id FROM Problems AS T1 JOIN Staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE date_problem_reported > (SELECT MAX(date_problem_reported) FROM Problems AS T3 JOIN Staff AS T4 ON T3.reported_by_staff_id = T4.staff_id WHERE T4.staff_first_name = 'Rylan' AND T4.staff_last_name = 'Homenick'); |
What are the different product names, and what is the sum of quantity ordered for each product? | SELECT T2.product_name, SUM(TRY_CAST(T1.product_quantity AS DECIMAL(19,2))) AS total_quantity FROM "Order_items" AS T1 JOIN "Products" AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name; |
What are the durations of the longest and the shortest tracks in milliseconds?
Schema:
- Track(Milliseconds, Name, UnitPrice) | SELECT MAX(Milliseconds) AS max_duration, MIN(Milliseconds) AS min_duration FROM Track; |
What are the names of students who have no friends?
Schema:
- Highschooler(COUNT, ID, grade, name)
- Friend(student_id) | SELECT name FROM Highschooler WHERE name NOT IN (SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID); |
List the description of all aircrafts.?
Schema:
- aircraft(Description, aid, d, distance, name) | SELECT Description FROM aircraft; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.