question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
What is the id of the pet owned by the student whose last name is 'Smith'?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Pet(...) | SELECT T2.PetID FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID WHERE T1.LName = 'Smith'; |
What are the names of all movies that were made after 2000 or reviewed by Brittany Harris?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year)
- Reviewer(Lew, name, rID) | SELECT DISTINCT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Brittany Harris' OR T2."year" > 2000; |
Return the type code of the template type that the most templates belong to.?
Schema:
- Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number) | SELECT Template_Type_Code FROM Templates WHERE Template_Type_Code IS NOT NULL GROUP BY Template_Type_Code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the first names for students who have an "a" in their first name?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT DISTINCT Fname FROM Student WHERE Fname LIKE '%a%'; |
How many medicines were not approved by the FDA?
Schema:
- medicine(FDA_approved, Trade_Name, name) | SELECT COUNT(*) AS num_medicines FROM medicine WHERE FDA_approved = 'No'; |
How many faculty lines are there in the university that conferred the most number of degrees in year 2002?
Schema:
- Campuses(Campus, County, Franc, Location)
- faculty(Faculty)
- degrees(Campus, Degrees, SUM, Year) | SELECT T2.Faculty FROM Campuses AS T1 JOIN faculty AS T2 ON T1.Id = T2.Campus JOIN degrees AS T3 ON T1.Id = T3.Campus AND T2."Year" = T3."Year" WHERE T2."Year" = 2002 ORDER BY T3.Degrees DESC NULLS LAST LIMIT 1; |
What is the age of student Linda Smith?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Age FROM Student WHERE Fname = 'Linda' AND LName = 'Smith'; |
Show the different countries and the number of members from each.?
Schema:
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) | SELECT Country, COUNT(*) AS num_members FROM member_ GROUP BY Country; |
Show the names of products and the number of events they are in.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Products_in_Events(...) | SELECT T1.Product_Name, COUNT(*) AS num_events FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name; |
give me 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; |
What is the list of distinct product names sorted 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; |
How many residents does each property have? List property id and resident count.?
Schema:
- Properties(property_name, property_type_code, room_count)
- Residents(M, date_moved_in, last_day_moved_in, other_details) | SELECT T1.property_id, COUNT(*) AS num_residents FROM Properties AS T1 JOIN Residents AS T2 ON T1.property_id = T2.property_id GROUP BY T1.property_id; |
What is the name of the shop that has the greatest quantity of devices in stock?
Schema:
- stock(Quantity)
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID, T2.Shop_Name ORDER BY SUM(T1.Quantity) DESC NULLS LAST LIMIT 1; |
What are the different dorm amenity names in alphabetical order?
Schema:
- Dorm_amenity(amenity_name) | SELECT amenity_name FROM Dorm_amenity ORDER BY amenity_name ASC NULLS LAST; |
What are the city name, id, and number of addresses corresponding to the city with the most addressed?
Schema:
- address(address, district, phone, postal_code)
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT T2.city, COUNT(*) AS num_addresses, T1.city_id FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id GROUP BY T1.city_id, T2.city ORDER BY num_addresses DESC NULLS LAST LIMIT 1; |
Find the emails of the user named "Mary".?
Schema:
- user_profiles(email, followers, name, partitionid) | SELECT email FROM user_profiles WHERE name = 'Mary'; |
Which paper is published in an institution in "USA" and have "Turon" as its second author?
Schema:
- Authors(fname, lname)
- Authorship(...)
- Papers(title)
- Inst(...) | SELECT T3.title FROM Authors AS T1 JOIN Authorship AS T2 ON T1.authID = T2.authID JOIN Papers AS T3 ON T2.paperID = T3.paperID JOIN Inst AS T4 ON T2.instID = T4.instID WHERE T4.country = 'USA' AND T2.authOrder = 2 AND T1.lname = 'Turon'; |
where is the highest point in texas?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT highest_point FROM highlow WHERE state_name = 'texas'; |
What are the name and primarily affiliated department name of each physician?
Schema:
- Physician(I, Name)
- Affiliated_With(Department, Physician, PrimaryAffiliation)
- Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2) | SELECT T1.Name, T3.Name FROM Physician AS T1 JOIN Affiliated_With AS T2 ON T1.EmployeeID = T2.Physician JOIN Department AS T3 ON T2.Department = T3.DepartmentID WHERE T2.PrimaryAffiliation = 1; |
Find the order dates of the orders with price above 1000.?
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 T1.Order_Date FROM Customer_Orders AS T1 JOIN Order_Items AS T2 ON T1.Order_ID = T2.Order_ID JOIN Products AS T3 ON CAST(T2.Product_ID AS TEXT) = T3.Product_ID WHERE T3.Product_Price > 1000; |
What are the average prices and cases of wines produced in the year of 2009 and made of Zinfandel grape?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT AVG(Price) AS avg_price, AVG(Cases) AS avg_cases FROM wine WHERE "Year" = 2009 AND Grape = 'Zinfandel'; |
What is the name of Ranjit Jhala 's Liquid Haskell paper ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- writes(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- author(...) | SELECT DISTINCT T3.title FROM paperKeyphrase AS T2 JOIN keyphrase AS T5 ON T2.keyphraseId = T5.keyphraseId JOIN writes AS T4 ON T4.paperId = T2.paperId JOIN paper AS T3 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T1.authorName LIKE 'Ranjit Jhala' AND T5.keyphraseName = 'Liquid Haskell'; |
How many captains are in each rank?
Schema:
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT COUNT(*) AS num_captains, "Rank" FROM captain GROUP BY "Rank"; |
which is the shortest river?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE LENGTH = (SELECT MIN(LENGTH) FROM river); |
Find the full name and id of the college that has the most baseball players.?
Schema:
- college(College_Location, Leader_Name)
- player_college(...) | SELECT T1.name_full, T1.college_id FROM college AS T1 JOIN player_college AS T2 ON T1.college_id = T2.college_id GROUP BY T1.name_full, T1.college_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show name, class, and date for all races.?
Schema:
- race(Class, Date, Name) | SELECT Name, Class, "Date" FROM race; |
How many budgets are above 3000 in year 2001 or before?
Schema:
- budget(Budgeted) | SELECT COUNT(*) AS num_budgets FROM budget WHERE Budgeted > 3000 AND "Year" <= 2001; |
Find the average height of the players who belong to the college called 'Yale University'.?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
- player_college(...)
- college(College_Location, Leader_Name) | SELECT AVG(T1.height) AS avg_height FROM player AS T1 JOIN player_college AS T2 ON T1.player_id = T2.player_id JOIN college AS T3 ON T3.college_id = T2.college_id WHERE T3.name_full = 'Yale University'; |
Show the positions of the players from the team with name "Ryley Goldner".?
Schema:
- match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team)
- team(Name) | SELECT T1."Position" FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = 'Ryley Goldner'; |
What was the topic of best paper in 2012 EMNLP-CoNLL ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...)
- paperKeyphrase(...)
- venue(venueId, venueName) | SELECT DISTINCT COUNT(DISTINCT T4.citingPaperId) AS num_citations, T1.keyphraseId, T2.paperId FROM paper AS T2 JOIN cite AS T4 ON T2.paperId = T4.citedPaperId JOIN paperKeyphrase AS T1 ON T2.paperId = T1.paperId JOIN venue AS T3 ON T3.venueId = T2.venueId WHERE T2."year" = 2012 AND T3.venueName = 'EMNLP-CoNLL' GROUP BY T2.paperId, T1.keyphraseId ORDER BY num_citations DESC NULLS LAST; |
Find the team of the player of the highest age.?
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; |
Return the the names of the drama workshop groups that are located in Feliciaberg city.?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- Drama_Workshop_Groups(COUNT, Currency_Code, Marketing_Region_Code, Store_Name) | SELECT T2.Store_Name FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = CAST(T2.Address_ID AS TEXT) WHERE T1.City_Town = 'Feliciaberg'; |
What is the name of the track that has had the greatest number of races?
Schema:
- race(Class, Date, Name)
- track(Location, Name, Seat, Seating, T1, Year_Opened) | SELECT T2.Name FROM race AS T1 JOIN track AS T2 ON T1.Track_ID = CAST(T2.Track_ID AS TEXT) GROUP BY T1.Track_ID, T2.Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Which owner has paid for the most treatments on his or her dogs? List the owner id and last name.?
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; |
Show the customer name, customer address city, date from, and date to for each customer address history.?
Schema:
- Customer_Address_History(...)
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT T2.customer_name, T3.city, T1.date_from, T1.date_to FROM Customer_Address_History AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id JOIN Addresses AS T3 ON T1.address_id = T3.address_id; |
Show the different headquarters and number of companies at each headquarter.?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Headquarters, COUNT(*) AS num_companies FROM company GROUP BY Headquarters; |
return me the authors of " Making database systems usable " .?
Schema:
- writes(...)
- author(...)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT T1.name FROM writes AS T2 JOIN author AS T1 ON T2.aid = T1.aid JOIN publication AS T3 ON T2.pid = T3.pid WHERE T3.title = 'Making database systems usable'; |
What are the names of the clubs that have players in the position of "Right Wing"?
Schema:
- club(Region, Start_year, name)
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2."Position" = 'Right Wing'; |
What are the names of poker players?
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.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID; |
who acted the role of " Mr. Bean "?
Schema:
- cast_(...)
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT T1.name FROM cast_ AS T2 JOIN actor AS T1 ON T2.aid = T1.aid WHERE T2.role = 'Mr. Bean'; |
Which models are lighter than 3500 but not built by the 'Ford Motor Company'?
Schema:
- model_list(Maker, Model)
- car_names(COUNT, Model)
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
- car_makers(...) | SELECT DISTINCT T1.Model FROM model_list AS T1 JOIN car_names AS T2 ON T1.Model = T2.Model JOIN cars_data AS T3 ON T2.MakeId = T3.Id JOIN car_makers AS T4 ON T1.Maker = T4.Id WHERE T3.Weight < 3500 AND T4.FullName != 'Ford Motor Company'; |
What are the types of film market estimations in year 1995?
Schema:
- film_market_estimation(High_Estimate, Low_Estimate, Type) | SELECT Type FROM film_market_estimation WHERE "Year" = 1995; |
Find the names of the candidates whose support percentage is lower than their oppose rate.?
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.Name FROM people AS T1 JOIN candidate AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Support_rate < T2.Oppose_rate; |
How many students are 18 years old?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_students FROM Student WHERE Age = 18; |
How many different instruments are used in the song "Le Pop"?
Schema:
- Instruments(COUNT, Instrument)
- Songs(Title) | SELECT COUNT(DISTINCT Instrument) AS num_instruments FROM Instruments AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Title = 'Le Pop'; |
who has papers at NIPS ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT T1.authorId FROM venue AS T3 JOIN paper AS T2 ON T3.venueId = T2.venueId JOIN writes AS T1 ON T1.paperId = T2.paperId WHERE T3.venueName = 'NIPS'; |
How many assets can each parts be used in? List the part name and the number.?
Schema:
- Parts(chargeable_amount, part_id)
- Asset_Parts(...) | SELECT T1.part_name, COUNT(*) AS num_assets FROM Parts AS T1 JOIN Asset_Parts AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name; |
What are the times of elimination for any instances in which the elimination was done by Punk or Orton?
Schema:
- Elimination(Benjam, Eliminated_By, Elimination_Move, T1, Team, Time) | SELECT "Time" FROM Elimination WHERE Eliminated_By = 'Punk' OR Eliminated_By = 'Orton'; |
Which rank is the most common among captains?
Schema:
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT "Rank" FROM captain GROUP BY "Rank" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the full names and salaries for any employees earning less than 6000?
Schema:
- employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) | SELECT FIRST_NAME, LAST_NAME, SALARY FROM employees WHERE SALARY < 6000; |
Count the number of storms in which at least 1 person died.?
Schema:
- storm(Damage_millions_USD, Dates_active, Name, Number_Deaths) | SELECT COUNT(*) AS num_storms FROM storm WHERE Number_Deaths > 0; |
What are the names of all the different reviewers who rates Gone with the Wind?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year)
- Reviewer(Lew, name, rID) | SELECT DISTINCT T3.name FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.title = 'Gone with the Wind'; |
papers brian curless wrote about convolution?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T1.authorId, T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T5 ON T2.keyphraseId = T5.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T1.authorName = 'brian curless' AND T5.keyphraseName = 'convolution'; |
What are the names, details and data types of the characteristics which are never used by any product?
Schema:
- Characteristics(characteristic_name)
- Product_Characteristics(...) | SELECT T1.characteristic_name, T1.other_characteristic_details, T1.characteristic_data_type FROM Characteristics AS T1 LEFT JOIN Product_Characteristics AS T2 ON T1.characteristic_id = T2.characteristic_id WHERE T2.characteristic_id IS NULL; |
display the employee number and job id for all employees whose salary is smaller than any salary of those employees whose job title is MK_MAN.?
Schema:
- employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) | SELECT EMPLOYEE_ID, JOB_ID FROM employees WHERE SALARY < (SELECT MIN(SALARY) FROM employees WHERE JOB_ID = 'MK_MAN'); |
Where is the best french 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'); |
What is the name and id of the staff who recorded the fault log but has not contacted any visiting engineers?
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)
- Fault_Log(...)
- Engineer_Visits(...) | SELECT T1.staff_name, T1.staff_id FROM Staff AS T1 JOIN Fault_Log AS T2 ON T1.staff_id = T2.recorded_by_staff_id LEFT JOIN Engineer_Visits AS T4 ON T1.staff_id = T4.contact_staff_id WHERE T4.contact_staff_id IS NULL GROUP BY T1.staff_name, T1.staff_id; |
Find the patient who most recently stayed in room 111.?
Schema:
- Stay(Patient, Room, StayStart) | SELECT Patient FROM Stay WHERE Room = 111 ORDER BY StayStart DESC NULLS LAST LIMIT 1; |
Most recent deep learning conference ?
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 the average prices of products, grouped by manufacturer code?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT AVG(Price) AS avg_price, Manufacturer FROM Products GROUP BY Manufacturer; |
what is the elevation of the highest point in the usa?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT MAX(highest_elevation) AS max_elevation FROM highlow; |
Sort the names of all counties in ascending order of population.?
Schema:
- county(County_name, Population, Zip_code) | SELECT County_name FROM county ORDER BY Population ASC NULLS LAST; |
What is the name of the album that has the track Ball to the Wall?
Schema:
- albums(I, title)
- tracks(composer, milliseconds, name, unit_price) | SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T2.name = 'Balls to the Wall'; |
Show the id of the employee named Ebba.?
Schema:
- Employees(COUNT, Date_of_Birth, Employee_ID, Employee_Name, Role_Code, employee_id, employee_name, role_code) | SELECT Employee_ID FROM Employees WHERE Employee_Name = 'Ebba'; |
What is the name of the customer who has the most orders?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Orders(customer_id, date_order_placed, order_id) | SELECT T1.customer_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id, T1.customer_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are airlines that have flights arriving at airport 'AHD'?
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 WHERE T2.DestAirport = 'AHD'; |
Count the number of accounts.?
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; |
How many people reviewed the restaurant " Texas de Brazil " in Dallas Texas ?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state)
- review(i_id, rank, rating, text)
- user_(name) | SELECT COUNT(DISTINCT T4.name) AS num_reviewers FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN review AS T3 ON T3.business_id = T1.business_id JOIN user_ AS T4 ON T4.user_id = T3.user_id WHERE T1.city = 'Dallas' AND T1.name = 'Texas de Brazil' AND T1.state = 'Texas' AND T2.category_name = 'restaurant'; |
what is the height of the highest point in the usa?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT MAX(highest_elevation) AS max_height FROM highlow; |
What conference does Daniella Coelho publish in ?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.venueId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'Daniella Coelho'; |
In which country does Roberto Almeida?
Schema:
- customers(Mart, city, company, country, email, first_name, last_name, phone, state) | SELECT country FROM customers WHERE first_name = 'Roberto' AND last_name = 'Almeida'; |
where is a restaurant in alameda ?
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 = 'alameda'; |
Please list the age and famous title of artists in descending order of age.?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT Famous_Title, Age FROM artist ORDER BY Age DESC NULLS LAST; |
return me the paper after 2000 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 AND T3."year" > 2000; |
How many eliminations did each team have?
Schema:
- Elimination(Benjam, Eliminated_By, Elimination_Move, T1, Team, Time) | SELECT Team, COUNT(*) AS num_eliminations FROM Elimination GROUP BY Team; |
How many type of jobs do they have?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT COUNT(DISTINCT job) AS num_jobs FROM Person; |
What is the id of the candidate who most recently completed their assement the course?
Schema:
- Candidate_Assessments(asessment_outcome_code, assessment_date, candidate_id) | SELECT candidate_id FROM Candidate_Assessments ORDER BY assessment_date DESC NULLS LAST LIMIT 1; |
When did the first staff member start working?
Schema:
- FROM(Country, Name, Year_Join)
- ASC(...) | SELECT date_from FROM Project_Staff ORDER BY date_from ASC NULLS LAST LIMIT 1; |
Find the total saving balance for each account name.?
Schema:
- ACCOUNTS(name)
- SAVINGS(SAV, balance) | SELECT SUM(T2.balance) AS total_saving_balance, T1.name FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid GROUP BY T1.name; |
Give the names of poker players who have earnings above 300000.?
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.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Earnings > 300000; |
What is all the information about the basketball match?
Schema:
- basketball_match(ACC_Percent, All_Home, School_ID, Team_Name) | SELECT * FROM basketball_match; |
What is Nancy Edwards's address?
Schema:
- employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) | SELECT address FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'; |
Who is the writer of the movie " The Truman Show "?
Schema:
- written_by(...)
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
- writer(...) | SELECT T2.name FROM written_by AS T3 JOIN movie AS T1 ON T3.msid = T1.mid JOIN writer AS T2 ON T3.wid = T2.wid WHERE T1.title = 'The Truman Show'; |
Give the ids of documents with expenses that have the budget code 'SF'.?
Schema:
- Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID) | SELECT Document_ID FROM Documents_with_Expenses WHERE Budget_Type_Code = 'SF'; |
Find the common login 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.login_name FROM Course_Authors_and_Tutors JOIN Students ON Course_Authors_and_Tutors.login_name = Students.login_name; |
How many students participated in tryouts for each college by descennding count?
Schema:
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT COUNT(*) AS num_students, cName FROM Tryout WHERE cName IS NOT NULL GROUP BY cName ORDER BY num_students DESC NULLS LAST; |
What is the last name of the musician who was in the most songs?
Schema:
- Performance(...)
- Band(...)
- Songs(Title) | SELECT T2.Lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE Lastname IS NOT NULL GROUP BY Lastname ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the distinct Advisor of students who have treasurer votes in the spring election cycle.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT T1.Advisor FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = 'Spring'; |
How many customers did not have any event?
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_Events(Customer_Event_ID, date_moved_in, property_id) | SELECT COUNT(*) AS num_customers FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Customer_Events); |
How many employees are there?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) | SELECT COUNT(*) AS num_employees FROM employee; |
return me the paper in Databases area with the most 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' ORDER BY T3.citation_num DESC NULLS LAST LIMIT 1; |
Return the average and minimum age of captains in each class.?
Schema:
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT AVG(TRY_CAST(age AS INT)) AS avg_age, MIN(TRY_CAST(age AS INT)) AS min_age, Class FROM captain GROUP BY Class; |
what is the height of the highest mountain in texas?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT MAX(DISTINCT highest_elevation) AS max_height FROM highlow WHERE state_name = 'texas'; |
What are the different role codes for users, and how many users have each?
Schema:
- Users(COUNT, password, role_code, user_log, user_name) | SELECT COUNT(*) AS num_users, role_code FROM Users GROUP BY role_code; |
Find the name of the activity that has the largest number of student participants.?
Schema:
- Activity(activity_name)
- Participates_in(...) | SELECT T1.activity_name FROM Activity AS T1 JOIN Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid, T1.activity_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Give the section titles of the document with the name "David CV".?
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))
- Document_Sections(...) | SELECT T2.section_title FROM Documents AS T1 JOIN Document_Sections AS T2 ON T1.document_code = T2.document_code WHERE T1.document_name = 'David CV'; |
What are the location and nickname of each school?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type)
- school_details(Div, Division, Nickname) | SELECT T1.Location, T2.Nickname FROM school AS T1 JOIN school_details AS T2 ON T1.School_ID = T2.School_ID; |
display those employees who contain a letter z to their first name and also display their last name, city.?
Schema:
- employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more))
- departments(DEPARTMENT_NAME, Market)
- locations(COUNTRY_ID) | SELECT T1.FIRST_NAME, T1.LAST_NAME, T3.CITY FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID JOIN locations AS T3 ON T2.LOCATION_ID = T3.LOCATION_ID WHERE T1.FIRST_NAME LIKE '%z%'; |
How many escape games exist in Madison?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT COUNT(DISTINCT T1.name) AS num_escape_games FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T1.city = 'Madison' AND T2.category_name = 'escape games'; |
Find the name of customer who has the highest amount of loans.?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id)
- loan(...) | SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_ID = T2.cust_ID GROUP BY T1.cust_name ORDER BY SUM(T2.amount) DESC NULLS LAST LIMIT 1; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.