question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
Sort the information about course authors and tutors in alphabetical order of the personal name.?
Schema:
- Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name) | SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name ASC NULLS LAST; |
Show aircraft names and number of flights for each aircraft.?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more))
- aircraft(Description, aid, d, distance, name) | SELECT T2.name, COUNT(*) AS num_flights FROM flight AS T1 JOIN aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid, T2.name; |
Find the abbreviation and country of the airline that has fewest number of flights?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT T1.Abbreviation, T1.Country FROM airlines AS T1 JOIN flights AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline, T1.Abbreviation, T1.Country ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
newest deep learning papers?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId, T3."year" 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' ORDER BY T3."year" DESC NULLS LAST; |
What are distinct locations where tracks are located?
Schema:
- track(Location, Name, Seat, Seating, T1, Year_Opened) | SELECT DISTINCT Location FROM track; |
What are the names of students and their respective departments, ordered by number of credits from least to greatest?
Schema:
- student(COUNT, H, dept_name, name, tot_cred) | SELECT name, dept_name FROM student ORDER BY tot_cred ASC NULLS LAST; |
What is the name of the youngest editor?
Schema:
- editor(Age, COUNT, Name) | SELECT Name FROM editor ORDER BY Age ASC NULLS LAST LIMIT 1; |
Which buildings does "Emma" manage? Give me the short names of the buildings.?
Schema:
- Apartment_Buildings(building_address, building_description, building_full_name, building_manager, building_phone, building_short_name) | SELECT building_short_name FROM Apartment_Buildings WHERE building_manager = 'Emma'; |
which gender got the highest average uncertain ratio.?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_rate) | SELECT T1.Sex FROM people AS T1 JOIN candidate AS T2 ON T1.People_ID = T2.People_ID GROUP BY T1.Sex ORDER BY AVG(T2.Unsure_rate) DESC NULLS LAST LIMIT 1; |
papers on Question Answering experiments?
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 = 'Question Answering'; |
Find the claim id and the number of settlements made for the claim with the most recent settlement date.?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled)
- Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount) | SELECT T1.Claim_ID, COUNT(*) AS num_settlements FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID GROUP BY T1.Claim_ID, T1.Date_Claim_Settled ORDER BY T1.Date_Claim_Settled DESC NULLS LAST LIMIT 1; |
What are the products with the maximum page size A4 that also have a pages per minute color smaller than 5?
Schema:
- product(COUNT, pages_per_minute_color, product) | SELECT product FROM product WHERE max_page_size = 'A4' AND pages_per_minute_color < 5; |
where is the most populated area of wyoming?
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 MAX(population) FROM city WHERE state_name = 'wyoming') AND state_name = 'wyoming'; |
Which catalog contents have a product stock number that starts from "2"? Show the catalog entry names.?
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%'; |
List the method, date and amount of all the payments, in ascending order of date.?
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, Date_Payment_Made, Amount_Payment FROM Payments ORDER BY Date_Payment_Made ASC NULLS LAST; |
Show the first name and last name for all the instructors.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT Fname, Lname FROM Faculty WHERE "Rank" = 'Instructor'; |
For each grade 0 classroom, report the total number of students.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName) | SELECT Classroom, COUNT(*) AS num_students FROM list WHERE Grade = '0' GROUP BY Classroom; |
Which member names are shared among members in the party with the id 3 and the party with the id 1?
Schema:
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) | SELECT DISTINCT T1.Member_Name FROM member_ AS T1 JOIN member_ AS T2 ON T1.Member_Name = T2.Member_Name WHERE T1.Party_ID = 3 AND T2.Party_ID = 1; |
Who made the latest order?
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_Orders(customer_id, order_date, order_id, order_shipping_charges) | SELECT T1.customer_name FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.order_date DESC NULLS LAST LIMIT 1; |
who else was on the paper with Ameet Soni and Ras Bodik ?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT T5.authorId FROM writes AS T3 JOIN author AS T2 ON T3.authorId = T2.authorId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN writes AS T5 ON T5.paperId = T4.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T2.authorName = 'Ameet Soni' AND T1.authorName = 'Ras Bodik'; |
What are the names of all songs that are approximately 4 minutes long or are in English?
Schema:
- files(COUNT, duration, f_id, formats)
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more)) | SELECT DISTINCT song_name FROM (SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE '4:%' UNION ALL SELECT song_name FROM song WHERE languages = 'english'); |
What are the descriptions for all the math courses?
Schema:
- Courses(course_description, course_name) | SELECT course_description FROM Courses WHERE course_name = 'math'; |
What are the ids, scores, and dates of the games which caused at least two injury accidents?
Schema:
- game(Date, Home_team, Season)
- injury_accident(Source) | SELECT T1.id, T1.Score, T1."Date" FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id = T1.id GROUP BY T1.id, T1.Score, T1."Date" HAVING COUNT(*) >= 2; |
where are some good places for arabic 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; |
How many different types of sports do we offer?
Schema:
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID) | SELECT COUNT(DISTINCT SportName) AS num_sports FROM SportsInfo; |
Select the code of the product that is cheapest in each product category.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT Code, Name, MIN(Price) AS min_price FROM Products GROUP BY Name, Code; |
For each product which has problems, what are the number of problems and the product id?
Schema:
- Problems(date_problem_reported, problem_id)
- Product(product_id, product_name) | SELECT COUNT(*) AS num_problems, T2.product_id FROM Problems AS T1 JOIN Product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_id; |
What are the names of the high schoolers and how many friends does each have?
Schema:
- Friend(student_id)
- Highschooler(COUNT, ID, grade, name) | SELECT T2.name, COUNT(*) AS num_friends FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID GROUP BY T1.student_id, T2.name; |
What are the id and name of the stadium where the most injury 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.id, T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id, T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Which authors have submitted to more than one workshop?
Schema:
- Acceptance(...)
- submission(Author, COUNT, College, Scores) | SELECT T2.Author FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author HAVING COUNT(DISTINCT T1.Workshop_ID) > 1; |
How much did the the player with first name Len and last name Barker earn between 1985 to 1990 in total?
Schema:
- salary(salary)
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT SUM(T1.salary) AS total_earnings FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id WHERE T2.name_first = 'Len' AND T2.name_last = 'Barker' AND T1."year" BETWEEN 1985 AND 1990; |
Find the name of instructor who is the advisor of the student who has the highest number of total credits.?
Schema:
- advisor(s_ID)
- instructor(AVG, M, So, Stat, dept_name, name, salary)
- student(COUNT, H, dept_name, name, tot_cred) | SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_ID = T2.ID JOIN student AS T3 ON T1.s_ID = T3.ID ORDER BY T3.tot_cred DESC NULLS LAST LIMIT 1; |
What is the most common nationality of people?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT Nationality FROM people WHERE Nationality IS NOT NULL GROUP BY Nationality ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many papers did Mirella Lapata cite ?
Schema:
- writes(...)
- author(...)
- cite(...) | SELECT DISTINCT COUNT(T3.citedPaperId) AS num_papers FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN cite AS T3 ON T2.paperId = T3.citingPaperId WHERE T1.authorName = 'Mirella Lapata'; |
which course has most number of registered students?
Schema:
- Courses(course_description, course_name)
- Student_Course_Registrations(COUNT, student_id) | SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Registrations AS T2 ON T1.course_id = CAST(T2.course_id AS text) GROUP BY T1.course_id, T1.course_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the names of the different artists that have produced a song in English but have never receieved a rating higher than 8?
Schema:
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more)) | SELECT DISTINCT artist_name FROM song WHERE languages = 'english' AND artist_name NOT IN (SELECT artist_name FROM song WHERE rating > 8); |
Find the average number of checkins in restaurant " Barrio Cafe " per day?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state)
- checkin(...) | SELECT AVG(T3."count") AS avg_checkins, T3."day" FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN checkin AS T3 ON T3.business_id = T1.business_id WHERE T1.name = 'Barrio Cafe' AND T2.category_name = 'restaurant' GROUP BY T3."day"; |
Find the number of rooms with a king bed.?
Schema:
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT COUNT(*) AS num_rooms FROM Rooms WHERE bedType = 'King'; |
What are the names of the wrestlers, ordered descending by days held?
Schema:
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT Name FROM wrestler ORDER BY Days_held DESC NULLS LAST; |
What are the names of hosts who did not host any party in our record?
Schema:
- host(Age, COUNT, Name, Nationality)
- party_host(...) | SELECT Name FROM host WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host); |
return me the paper in Databases area with more than 200 citations .?
Schema:
- domain(...)
- domain_publication(...)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT T3.title FROM domain AS T2 JOIN domain_publication AS T1 ON T2.did = T1.did JOIN publication AS T3 ON T3.pid = T1.pid WHERE T2.name = 'Databases' AND T3.citation_num > 200; |
What is the name and country of origin of every singer who has a song with the word 'Hey' in its title?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT Name, Country FROM singer WHERE Song_Name LIKE '%Hey%'; |
What are the names of gymnasts?
Schema:
- gymnast(Floor_Exercise_Points, Horizontal_Bar_Points)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID; |
what keyphrases get most citations ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- cite(...) | SELECT DISTINCT COUNT(T3.citingPaperId) AS num_citations, T1.keyphraseName FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN cite AS T3 ON T2.paperId = T3.citedPaperId GROUP BY T1.keyphraseName ORDER BY num_citations DESC NULLS LAST; |
Which film is rented at a fee of 0.99 and has less than 3 in the inventory? List the film title and id.?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
- inventory(COUNT, store_id) | SELECT T1.title, T1.film_id FROM film AS T1 WHERE T1.rental_rate = 0.99 AND EXISTS (SELECT 1 FROM inventory AS T2 WHERE T1.film_id = T2.film_id GROUP BY T2.film_id HAVING COUNT(*) < 3); |
What are the ids of all students who don't play sports?
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 StuID NOT IN (SELECT StuID FROM SportsInfo); |
What are the first names and last names of students with address in Wisconsin state?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- 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 T2.first_name, T2.last_name FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.address_id WHERE T1.state_province_county = 'Wisconsin'; |
What are the different card types, and how many transactions have been made with each?
Schema:
- Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type)
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to) | SELECT T2.card_type_code, COUNT(*) AS num_transactions FROM Financial_Transactions AS T1 JOIN Customers_Cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code; |
Parsing papers from acl 2012?
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 nationality of " Kevin Spacey " ?
Schema:
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT nationality FROM actor WHERE name = 'Kevin Spacey'; |
What are the first name and gender of the students who have allergy to milk but can put up with cats?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Allergy(Allergy, COUNT, StuID) | SELECT Fname, Sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_Allergy WHERE Allergy = 'Milk' AND StuID NOT IN (SELECT StuID FROM Has_Allergy WHERE Allergy = 'Cat')); |
What are the ages of all music artists?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT Age FROM artist; |
List the names of all the channels owned by either CCTV or HBS?
Schema:
- channel(Name, Owner, Rating_in_percent, Share_in_percent) | SELECT Name FROM channel WHERE Owner = 'CCTV' OR Owner = 'HBS'; |
Return the names of shops, ordered by year of opening ascending.?
Schema:
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT Shop_Name FROM shop ORDER BY Open_Year ASC NULLS LAST; |
Find the captain rank that has some captains in both Cutter and Armed schooner classes.?
Schema:
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT "Rank" FROM captain WHERE Class = 'Cutter' AND "Rank" IN (SELECT "Rank" FROM captain WHERE Class = 'Armed schooner'); |
What are the names of all students taking a course who received an A or C?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
- ENROLL(...) | SELECT T1.STU_FNAME, T1.STU_LNAME FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM WHERE T2.ENROLL_GRADE = 'C' OR T2.ENROLL_GRADE = 'A'; |
what is the salary and name of the employee who has the most number of aircraft certificates?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
- certificate(eid) | SELECT T1.name, ANY_VALUE(T1.salary) AS salary FROM employee AS T1 JOIN certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid, T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many documents do we have?
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 COUNT(*) AS num_documents FROM Documents; |
What are the name and level of catalog structure with level number 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; |
List all the dates of enrollment and completion of students.?
Schema:
- Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) | SELECT date_of_enrolment, date_of_completion FROM Student_Course_Enrolment; |
Find all the instruments ever used by the musician with last name "Heilo"?
Schema:
- Instruments(COUNT, Instrument)
- Band(...) | SELECT Instrument FROM Instruments AS T1 JOIN Band AS T2 ON T1.BandmateId = T2.Id WHERE T2.Lastname = 'Heilo'; |
What is the average distance and average price for flights from Los Angeles.?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT AVG(distance) AS avg_distance, AVG(price) AS avg_price FROM flight WHERE origin = 'Los Angeles'; |
What is the average number of international passengers for an airport?
Schema:
- airport(Airport_Name, City, Country, Domestic_Passengers, International_Passengers, Transit_Passengers, id, name) | SELECT AVG(International_Passengers) AS avg_international_passengers FROM airport; |
What are the duration of the longest and shortest pop tracks in milliseconds?
Schema:
- Genre(Name)
- Track(Milliseconds, Name, UnitPrice) | SELECT MAX(Milliseconds) AS max_duration, MIN(Milliseconds) AS min_duration FROM Genre AS T1 JOIN Track AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Pop'; |
What is all the information on the airport with 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 is the highest point in the country?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT highest_point FROM highlow WHERE highest_elevation = (SELECT MAX(highest_elevation) FROM highlow); |
Find the name of route that has the highest number of deliveries.?
Schema:
- Delivery_Routes(route_name)
- Delivery_Route_Locations(...) | SELECT T1.route_name FROM Delivery_Routes AS T1 JOIN Delivery_Route_Locations AS T2 ON T1.route_id = T2.route_id GROUP BY T1.route_id, T1.route_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show the names of members whose country is "United States" or "Canada".?
Schema:
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) | SELECT Name FROM member_ WHERE Country = 'United States' OR Country = 'Canada'; |
What are the names of the members and branches at which they are registered sorted by year of registration?
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 T3.Name, 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 ORDER BY T1.Register_Year ASC NULLS LAST; |
Find all the albums in 2012.?
Schema:
- Albums(COUNT, Label, Title) | SELECT Title FROM Albums WHERE "Year" = 2012; |
Find the id of users who are followed by Mary and Susan.?
Schema:
- user_profiles(email, followers, name, partitionid)
- follows(f1) | SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name IN ('Mary', 'Susan') GROUP BY T2.f1 HAVING COUNT(DISTINCT T1.name) = 2; |
What is the total number of hours per week and number of games played by students under 20?
Schema:
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT SUM(HoursPerWeek) AS total_hours_per_week, SUM(GamesPlayed) AS num_games_played FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Age < 20; |
who 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 category code and typical price of 'cumin'.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT product_category_code, typical_buying_price FROM Products WHERE product_name = 'cumin'; |
What are the student ids for students over 20 years old?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT StuID FROM Student WHERE Age > 20; |
Where is the best french restaurant in san francisco ?
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'); |
How many flights arriving in Aberdeen city?
Schema:
- flights(DestAirport, FlightNo, SourceAirport)
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT COUNT(*) AS num_flights FROM flights AS T1 JOIN airports AS T2 ON T1.DestAirport = T2.AirportCode WHERE T2.City = 'Aberdeen'; |
List the name and the number of enrolled student for each course.?
Schema:
- Courses(course_description, course_name)
- Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) | SELECT T1.course_name, COUNT(*) AS num_enrolled_students FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name; |
What is the average and maximum number of total passengers for train stations in London or Glasgow?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT AVG(Total_Passengers) AS avg_total_passengers, MAX(Total_Passengers) AS max_total_passengers FROM station WHERE Location = 'London' OR Location = 'Glasgow'; |
What are the order ids and customer ids for orders that have been Cancelled, sorted by their order dates?
Schema:
- Customer_Orders(customer_id, order_date, order_id, order_shipping_charges) | SELECT order_id, customer_id FROM Customer_Orders WHERE order_status_code = 'Cancelled' ORDER BY order_date ASC NULLS LAST; |
What is the average and total transaction amount?
Schema:
- Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type) | SELECT AVG(transaction_amount) AS avg_transaction_amount, SUM(transaction_amount) AS total_transaction_amount FROM Financial_Transactions; |
Find the city with the largest population that uses 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; |
Give the flight numbers of flights landing at APG.?
Schema:
- flights(DestAirport, FlightNo, SourceAirport) | SELECT FlightNo FROM flights WHERE DestAirport = 'APG'; |
How many faculty members do we have for each rank and gender?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT "Rank", Sex, COUNT(*) AS num_faculty FROM Faculty GROUP BY "Rank", Sex; |
How many musicians play in the song "Flash"?
Schema:
- Performance(...)
- Band(...)
- Songs(Title) | SELECT COUNT(*) AS num_musicians FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = 'Flash'; |
What are the names of scientists who are assigned to any project?
Schema:
- AssignedTo(Scientist)
- Scientists(Name) | SELECT T2.Name FROM AssignedTo AS T1 JOIN Scientists AS T2 ON T1.Scientist = T2.SSN; |
List players' first name and last name who have weight greater than 220 or height shorter than 75.?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT name_first, name_last FROM player WHERE weight > 220 OR height < 75; |
What is the lowest grade of students who do not have any friends?
Schema:
- Highschooler(COUNT, ID, grade, name)
- Friend(student_id) | SELECT MIN(grade) AS min_grade FROM Highschooler WHERE ID NOT IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID); |
Find the busiest destination airport that runs most number of routes in China.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
- routes(...) | SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE T1.country = 'China' GROUP BY T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the number of students for each department.?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE) | SELECT COUNT(*) AS num_students, DEPT_CODE FROM STUDENT GROUP BY DEPT_CODE; |
How many faculty members participate in each activity? Return the activity names and the number of faculty members.?
Schema:
- Activity(activity_name)
- Faculty_Participates_in(FacID) | SELECT T1.activity_name, COUNT(*) AS num_faculty_members FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid, T1.activity_name; |
Find the number of web accelerators used for each Operating system.?
Schema:
- Web_client_accelerator(Client, Operating_system) | SELECT Operating_system, COUNT(*) AS num_accelerators FROM Web_client_accelerator GROUP BY Operating_system; |
What are the companies and main industries of all companies that are not headquartered in the United States?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Company, Main_Industry FROM company WHERE Headquarters != 'USA'; |
which poll source does the highest oppose rate come from?
Schema:
- candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_rate) | SELECT Poll_Source FROM candidate ORDER BY Oppose_rate DESC NULLS LAST LIMIT 1; |
what is the population of the capital of the largest state?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT population FROM city WHERE city_name = (SELECT capital FROM state WHERE area = (SELECT MAX(area) FROM state)); |
Which airlines have at least 10 flights?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT T1.Airline FROM airlines AS T1 JOIN flights AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline HAVING COUNT(*) > 10; |
Find the number of scientists involved for the projects that require more than 300 hours.?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
- AssignedTo(Scientist) | SELECT COUNT(*) AS num_scientists, T1.Name FROM Projects AS T1 JOIN AssignedTo AS T2 ON T1.Code = T2.Project WHERE T1.Hours > 300 GROUP BY T1.Name; |
What are the average score and average staff number of all shops?
Schema:
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT AVG(TRY_CAST(Num_of_staff AS INT)) AS avg_staff_number, AVG(Score) AS avg_score FROM shop; |
Find the name of bank branch that provided the greatest total amount of loans to customers with credit score is less than 100.?
Schema:
- loan(...)
- bank(SUM, bname, city, morn, no_of_customers, state)
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) | SELECT T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_ID = CAST(T2.branch_ID AS TEXT) JOIN customer AS T3 ON T1.cust_ID = T3.cust_ID WHERE T3.credit_score < 100 GROUP BY T2.bname ORDER BY SUM(T1.amount) DESC NULLS LAST LIMIT 1; |
Find the founder of the company whose name begins with the letter 'S'.?
Schema:
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT Founder FROM Manufacturers WHERE Name ILIKE 'S%'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.