question
stringlengths 43
589
| query
stringlengths 19
598
|
|---|---|
What are the different names and countries of origins for all artists whose song ratings are above 9?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
|
SELECT DISTINCT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.rating > 9;
|
What is the type of video game Call of Destiny.?
Schema:
- Video_Games(COUNT, Dest, GName, GType, onl)
|
SELECT GType FROM Video_Games WHERE GName = 'Call of Destiny';
|
What are the type codes of the policies used by the customer "Dayana Robel"?
Schema:
- Policies(COUNT, Policy_Type_Code)
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
|
SELECT Policy_Type_Code FROM Policies AS T1 JOIN Customers AS T2 ON T1.Customer_ID = T2.Customer_ID WHERE T2.Customer_Details = 'Dayana Robel';
|
For every student who is registered for some course, how many courses are they registered for?
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)
|
SELECT T1.student_id, COUNT(*) AS num_courses FROM Students AS T1 JOIN Student_Course_Registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id;
|
How many employees have salary between 100000 and 200000?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
|
SELECT COUNT(*) AS num_employees FROM employee WHERE salary BETWEEN 100000 AND 200000;
|
Find the name of the organization that has published the largest number of papers.?
Schema:
- Inst(...)
- Authorship(...)
- Papers(title)
|
SELECT T1.name FROM Inst AS T1 JOIN Authorship AS T2 ON T1.instID = T2.instID JOIN Papers AS T3 ON T2.paperID = T3.paperID GROUP BY T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
|
What campus started in year 1956, has more than 200 full time students, and more than 400 students enrolled?
Schema:
- Campuses(Campus, County, Franc, Location)
- enrollments(...)
|
SELECT T1.Campus FROM Campuses AS T1 JOIN enrollments AS T2 ON T1.Id = T2.Campus WHERE T2."Year" = 1956 AND TotalEnrollment_AY > 400 AND FTE_AY > 200;
|
What is the number of routes whose destinations are Italian airports?
Schema:
- routes(...)
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
|
SELECT COUNT(*) AS num_routes FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid WHERE T2.country = 'Italy';
|
How much does the most recent treatment cost?
Schema:
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id)
|
SELECT cost_of_treatment FROM Treatments ORDER BY date_of_treatment DESC NULLS LAST LIMIT 1;
|
What year did Ye Cao publish the most papers?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
|
SELECT DISTINCT COUNT(DISTINCT T3.paperId) AS num_papers, T3."year" FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName LIKE 'Ye Cao' GROUP BY T3."year" ORDER BY num_papers DESC NULLS LAST;
|
How many rooms in each building have a capacity of over 50?
Schema:
- classroom(building, capacity, room_number)
|
SELECT COUNT(*) AS num_rooms, building FROM classroom WHERE capacity > 50 GROUP BY building;
|
What are the ids of the students who registered course statistics by order of registration date?
Schema:
- Courses(course_description, course_name)
- Student_Course_Registrations(COUNT, student_id)
|
SELECT T2.student_id FROM Courses AS T1 JOIN Student_Course_Registrations AS T2 ON T1.course_id = CAST(T2.course_id AS TEXT) WHERE T1.course_name = 'statistics' ORDER BY T2.registration_date ASC NULLS LAST;
|
Find the names of all reviewers who rated 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';
|
Count the number of different languages in these films.?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
|
SELECT COUNT(DISTINCT language_id) AS num_languages FROM film;
|
What are the maximum price and score of wines for each year?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
|
SELECT MAX(Price) AS max_price, MAX(Score) AS max_score, "Year" FROM wine GROUP BY "Year";
|
What is the id and family name of the driver who has the longest laptime?
Schema:
- drivers(forename, nationality, surname)
- lapTimes(...)
|
SELECT T1.driverId, T1.surname FROM drivers AS T1 JOIN lapTimes AS T2 ON T1.driverId = T2.driverId ORDER BY T2.milliseconds DESC NULLS LAST LIMIT 1;
|
What are the states, account types, and credit scores for customers who have 0 loans?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id)
|
SELECT state, acc_type, credit_score FROM customer WHERE no_of_loans = 0;
|
give me the best american in the bay area ?
Schema:
- restaurant(...)
- geographic(...)
- location(...)
|
SELECT T3.house_number, T1.name FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name JOIN location AS T3 ON T1.id = T3.restaurant_id WHERE T2.region = 'bay area' AND T1.food_type = 'american' AND T1.rating = (SELECT MAX(T1.rating) FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name WHERE T2.region = 'bay area' AND T1.food_type = 'american');
|
Which classrooms are used by grade 4?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
|
SELECT DISTINCT Classroom FROM list WHERE Grade = 4;
|
Show all product sizes.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
|
SELECT DISTINCT product_size FROM Products;
|
How many heads of the departments are older than 56 ?
Schema:
- head(age, born_state, head_ID, name)
|
SELECT COUNT(*) AS num_heads FROM head WHERE age > 56;
|
Find the names of Japanese constructors that have once earned more than 5 points?
Schema:
- constructors(nationality)
- constructorStandings(constructorId)
|
SELECT T1.name FROM constructors AS T1 JOIN constructorStandings AS T2 ON T1.constructorId = T2.constructorId WHERE T1.nationality = 'Japanese' AND T2.points > 5;
|
Return the most frequent result across all musicals.?
Schema:
- musical(Award, COUNT, Name, Nom, Nominee, Result, T1)
|
SELECT "Result" FROM musical GROUP BY "Result" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
|
What are the names of all aircrafts that can cover more distances than average?
Schema:
- aircraft(Description, aid, d, distance, name)
|
SELECT name FROM aircraft WHERE distance > (SELECT AVG(distance) FROM aircraft);
|
Show publishers with a book published in 1989 and a book in 1990.?
Schema:
- book_club(Author_or_Editor, Book_Title, COUNT, Category, Publ, Publisher, T1)
|
SELECT DISTINCT T1.Publisher FROM book_club AS T1 JOIN book_club AS T2 ON T1.Publisher = T2.Publisher WHERE T1."Year" = 1989 AND T2."Year" = 1990;
|
How many restaurant are there in the Hazelwood district of Dallas ?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state)
- neighbourhood(...)
|
SELECT COUNT(DISTINCT T1.name) AS num_restaurants FROM category AS T3 JOIN business AS T1 ON T3.business_id = T1.business_id JOIN neighbourhood AS T2 ON T2.business_id = T1.business_id WHERE T1.city = 'Dallas' AND T3.category_name = 'restaurant' AND T2.neighbourhood_name = 'Hazelwood';
|
What are the delegate and name of the county they belong to, for each county?
Schema:
- county(County_name, Population, Zip_code)
- election(Committee, Date, Delegate, District, Vote_Percent, Votes)
|
SELECT T2.Delegate, T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District;
|
Show the name and the nationality of the oldest host.?
Schema:
- host(Age, COUNT, Name, Nationality)
|
SELECT Name, Nationality FROM host ORDER BY Age DESC NULLS LAST LIMIT 1;
|
find the package option of the tv channel that do not have any cartoon directed by Ben Jones.?
Schema:
- TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name)
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by)
|
SELECT Package_Option FROM TV_Channel WHERE id NOT IN (SELECT Channel FROM Cartoon WHERE Directed_by = 'Ben Jones');
|
List the industry shared by the most companies.?
Schema:
- Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name)
|
SELECT Industry FROM Companies WHERE Industry IS NOT NULL GROUP BY Industry ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
|
Find the entry names of the catalog with the attribute that have the most entries.?
Schema:
- Catalog_Contents(capacity, catalog_entry_name, height, next_entry_id, price_in_dollars, price_in_euros, product_stock_number)
- Catalog_Contents_Additional_Attributes(...)
|
SELECT T1.catalog_entry_name FROM Catalog_Contents AS T1 JOIN Catalog_Contents_Additional_Attributes AS T2 ON T1.catalog_entry_id = T2.catalog_entry_id WHERE T2.attribute_value = (SELECT attribute_value FROM Catalog_Contents_Additional_Attributes WHERE attribute_value IS NOT NULL GROUP BY attribute_value ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1);
|
Find the unit of measurement and product category code of product named "chervil".?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Ref_Product_Categories(product_category_code, product_category_description, unit_of_measure)
|
SELECT T2.unit_of_measure, T2.product_category_code FROM Products AS T1 JOIN Ref_Product_Categories AS T2 ON T1.product_category_code = T2.product_category_code WHERE T1.product_name = 'chervil';
|
What is the age of the tallest person?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
|
SELECT Age FROM people ORDER BY Height DESC NULLS LAST LIMIT 1;
|
What is the status code with the least number of customers?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
|
SELECT customer_status_code FROM Customers WHERE customer_status_code IS NOT NULL GROUP BY customer_status_code ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
|
What are the first names of the different drivers who won in position 1 as driver standing and had more than 20 points?
Schema:
- drivers(forename, nationality, surname)
- driverStandings(...)
|
SELECT DISTINCT T1.forename FROM drivers AS T1 JOIN driverStandings AS T2 ON T1.driverId = T2.driverId WHERE T2."position" = 1 AND T2.wins = 1 AND T2.points > 20;
|
What apartment type codes and apartment numbers do the buildings managed by "Kyle" have?
Schema:
- Apartment_Buildings(building_address, building_description, building_full_name, building_manager, building_phone, building_short_name)
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
|
SELECT T2.apt_type_code, T2.apt_number FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = 'Kyle';
|
Show all official native languages that contain the word "English".?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
|
SELECT Official_native_language FROM country WHERE Official_native_language LIKE '%English%';
|
What is average enrollment of colleges in the state FL?
Schema:
- College(M, cName, enr, state)
|
SELECT AVG(enr) AS avg_enrollment FROM College WHERE state = 'FL';
|
Show the id, the date of account opened, the account name, and other account detail for all accounts.?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
|
SELECT account_id, date_account_opened, account_name, other_account_details FROM Accounts;
|
What are the names of shops that have more than a single kind of device 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 HAVING COUNT(*) > 1;
|
How many players born in USA are right-handed batters? That is, have the batter value 'R'.?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
|
SELECT COUNT(*) AS num_players FROM player WHERE birth_country = 'USA' AND bats = 'R';
|
What are the ids and details for all organizations that have grants of more than 6000 dollars?
Schema:
- Grants(grant_amount, organisation_id)
- Organisations(...)
|
SELECT T2.organisation_id, T2.organisation_details FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY T2.organisation_id, T2.organisation_details HAVING SUM(T1.grant_amount) > 6000;
|
Show the industries shared by companies whose headquarters are "USA" and companies whose headquarters are "China".?
Schema:
- Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name)
|
SELECT DISTINCT T1.Industry FROM Companies AS T1 JOIN Companies AS T2 ON T1.Industry = T2.Industry WHERE T1.Headquarters = 'USA' AND T2.Headquarters = 'China';
|
Which transportation method is used the most often to get to tourist attractions?
Schema:
- Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more))
|
SELECT How_to_Get_There FROM Tourist_Attractions WHERE How_to_Get_There IS NOT NULL GROUP BY How_to_Get_There ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
|
which state is the smallest?
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);
|
How many car makers are there in france?
Schema:
- car_makers(...)
- countries(...)
|
SELECT COUNT(*) AS num_car_makers FROM car_makers AS T1 JOIN countries AS T2 ON T1.CountryId = T2.CountryId WHERE T2.CountryName = 'france';
|
How many universities have a campus fee higher than average?
Schema:
- csu_fees(CampusFee)
|
SELECT COUNT(*) AS num_universities FROM csu_fees WHERE CampusFee > (SELECT AVG(CampusFee) FROM csu_fees);
|
what is the longest river that flows through a state that borders tennessee?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
- border_info(T1, border, state_name)
|
SELECT river_name FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river WHERE traverse IN (SELECT border FROM border_info WHERE state_name = 'tennessee')) AND traverse IN (SELECT border FROM border_info WHERE state_name = 'tennessee');
|
Show the ids of students whose advisors are professors.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
|
SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor WHERE T1."Rank" = 'Professor';
|
return me the conference, which published " Making database systems usable " .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- conference(homepage, name)
|
SELECT T1.name FROM publication AS T2 JOIN conference AS T1 ON T2.cid = CAST(T1.cid AS TEXT) WHERE T2.title = 'Making database systems usable';
|
Find all the tips from a user who has written a review in 2012?
Schema:
- user_(name)
- review(i_id, rank, rating, text)
- tip(month, text)
|
SELECT T2."text" FROM user_ AS T3 JOIN review AS T1 ON T3.user_id = T1.user_id JOIN tip AS T2 ON T3.user_id = T2.user_id WHERE T1."year" = 2012;
|
list the card number of all members whose hometown address includes word "Kentucky".?
Schema:
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
|
SELECT Card_Number FROM member_ WHERE Hometown LIKE '%Kentucky%';
|
Return the hometown that is most common among 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.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
|
What are the titles of films and corresponding types of market estimations?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
- film_market_estimation(High_Estimate, Low_Estimate, Type)
|
SELECT T1.Title, T2.Type FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID;
|
Which grade is studying in classroom 103?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
|
SELECT DISTINCT Grade FROM list WHERE Classroom = 103;
|
Describe the section h.?
Schema:
- Sections(section_description, section_name)
|
SELECT section_description FROM Sections WHERE section_name = 'h';
|
Find the first name and last name and department id for those employees who earn such amount of salary which is the smallest salary of any of the departments.?
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, DEPARTMENT_ID FROM employees WHERE SALARY IN (SELECT MIN(SALARY) FROM employees GROUP BY DEPARTMENT_ID);
|
What are the booking start and end dates of the apartments with more than 2 bedrooms?
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.bedroom_count > 2;
|
Count the number of distinct artists who have volumes.?
Schema:
- volume(Artist_ID, Issue_Date, Song, Weeks_on_Top)
|
SELECT COUNT(DISTINCT Artist_ID) AS num_artists FROM volume;
|
What is the average minimum and price of the rooms for each different decor.?
Schema:
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
|
SELECT decor, AVG(basePrice) AS avg_price, MIN(basePrice) AS min_price FROM Rooms GROUP BY decor;
|
Show all video game types.?
Schema:
- Video_Games(COUNT, Dest, GName, GType, onl)
|
SELECT DISTINCT GType FROM Video_Games;
|
What are the distinct customers who have orders with status "On Road"? Give me the customer details?
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 DISTINCT T1.customer_details FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'On Road';
|
What is the count of customers that Steve Johnson supports?
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))
- customers(Mart, city, company, country, email, first_name, last_name, phone, state)
|
SELECT COUNT(*) AS num_customers FROM employees AS T1 JOIN customers AS T2 ON T2.support_rep_id = T1.id WHERE T1.first_name = 'Steve' AND T1.last_name = 'Johnson';
|
What papers has brian curless written 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 is the horsepower of the car with the largest accelerate?
Schema:
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
|
SELECT T1.Horsepower FROM cars_data AS T1 ORDER BY T1.Accelerate DESC NULLS LAST LIMIT 1;
|
Count the number of dogs of an age below the average.?
Schema:
- Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
|
SELECT COUNT(*) AS num_dogs FROM Dogs WHERE age < (SELECT AVG(age) FROM Dogs);
|
states bordering kentucky?
Schema:
- border_info(T1, border, state_name)
|
SELECT border FROM border_info WHERE state_name = 'kentucky';
|
Find the number of routes with destination airports in Italy.?
Schema:
- routes(...)
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
|
SELECT COUNT(*) AS num_routes FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid WHERE T2.country = 'Italy';
|
What are the attribute data types with more than 3 attribute definitions?
Schema:
- Attribute_Definitions(attribute_data_type, attribute_name)
|
SELECT attribute_data_type FROM Attribute_Definitions WHERE attribute_data_type IS NOT NULL GROUP BY attribute_data_type HAVING COUNT(*) > 3;
|
Find the name of the project for which a scientist whose name contains ‘Smith’ is assigned to.?
Schema:
- AssignedTo(Scientist)
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
- Scientists(Name)
|
SELECT T2.Name FROM AssignedTo AS T1 JOIN Projects AS T2 ON T1.Project = T2.Code JOIN Scientists AS T3 ON T1.Scientist = T3.SSN WHERE T3.Name LIKE '%Smith%';
|
Which problem log was created most recently? Give me the log id.?
Schema:
- Problem_Log(log_entry_date, log_entry_description, problem_id, problem_log_id)
|
SELECT problem_log_id FROM Problem_Log ORDER BY log_entry_date DESC NULLS LAST LIMIT 1;
|
What is the name of the organization that was formed most recently?
Schema:
- Organizations(date_formed, organization_name)
|
SELECT organization_name FROM Organizations ORDER BY date_formed DESC NULLS LAST LIMIT 1;
|
Which address has both members younger than 30 and members older than 40?
Schema:
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
|
SELECT DISTINCT T1.Address FROM (SELECT Address FROM member_ WHERE Age < 30) AS T1, (SELECT Address FROM member_ WHERE Age > 40) AS T2 WHERE T1.Address = T2.Address;
|
Find the number of routes from the United States to Canada.?
Schema:
- routes(...)
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
|
SELECT COUNT(*) AS num_routes FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country = 'Canada') AND src_apid IN (SELECT apid FROM airports WHERE country = 'United States');
|
What are the faculty ids of all the male faculty members?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
|
SELECT FacID FROM Faculty WHERE Sex = 'M';
|
Show all template type codes and the number of documents using each type.?
Schema:
- Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number)
- Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more))
|
SELECT T1.Template_Type_Code, COUNT(*) AS num_documents FROM Templates AS T1 JOIN Documents AS T2 ON T1.Template_ID = T2.Template_ID GROUP BY T1.Template_Type_Code;
|
what is the biggest city in the us?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
|
SELECT city_name FROM city WHERE population = (SELECT MAX(population) FROM city);
|
List the names of climbers in descending order of points.?
Schema:
- climber(Country, K, Name, Points)
|
SELECT Name FROM climber ORDER BY Points DESC NULLS LAST;
|
Return the order ids and details for orderes with two or more invoices.?
Schema:
- Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code)
- Orders(customer_id, date_order_placed, order_id)
|
SELECT T2.order_id, T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id GROUP BY T2.order_id, T2.order_details HAVING COUNT(*) > 2;
|
Show the city and the number of branches opened before 2010 for each city.?
Schema:
- branch(Address_road, City, Name, Open_year, membership_amount)
|
SELECT City, COUNT(*) AS num_branches FROM branch WHERE Open_year < 2010 GROUP BY City;
|
Count the number of total papers.?
Schema:
- Papers(title)
|
SELECT COUNT(*) AS num_papers FROM Papers;
|
where is massachusetts?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
|
SELECT country_name FROM state WHERE state_name = 'massachusetts';
|
Find the full names of faculties who are members of department with department number 520.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
- Member_of(...)
|
SELECT T1.Fname, T1.LName FROM Faculty AS T1 JOIN Member_of AS T2 ON T1.FacID = T2.FacID WHERE T2.DNO = 520;
|
co-authors of Noah A Smith?
Schema:
- writes(...)
- author(...)
|
SELECT DISTINCT T1.authorId FROM writes AS T3 JOIN author AS T2 ON T3.authorId = T2.authorId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T2.authorName = 'Noah A Smith';
|
List the number of invoices from the US, grouped by 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;
|
What is the last name and office of the professor from the history department?
Schema:
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME)
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
|
SELECT T1.EMP_LNAME, T2.PROF_OFFICE FROM EMPLOYEE AS T1 JOIN PROFESSOR AS T2 ON T1.EMP_NUM = T2.EMP_NUM JOIN DEPARTMENT AS T3 ON T2.DEPT_CODE = T3.DEPT_CODE WHERE T3.DEPT_NAME = 'History';
|
What is the name of each aircraft and how many flights does each one complete?
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 first names of students whose first names contain letter "a".?
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%';
|
List the name of playlist which has number of tracks greater than 100.?
Schema:
- playlist_tracks(...)
- playlists(name)
|
SELECT T2.name FROM playlist_tracks AS T1 JOIN playlists AS T2 ON T2.id = T1.playlist_id GROUP BY T1.playlist_id, T2.name HAVING COUNT(T1.track_id) > 100;
|
What are the first, middle, and last names of all staff?
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 first_name, middle_name, last_name FROM Staff;
|
give me the cities in usa?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
|
SELECT city_name FROM city WHERE country_name = 'united states';
|
What are the record companies that are used by both orchestras founded before 2003 and those founded after 2003?
Schema:
- orchestra(COUNT, Major_Record_Format, Record_Company, Year_of_Founded)
|
SELECT Record_Company FROM orchestra WHERE Year_of_Founded < 2003 AND Record_Company IN (SELECT Record_Company FROM orchestra WHERE Year_of_Founded > 2003);
|
What are the countries of markets and their corresponding years of market estimation?
Schema:
- film_market_estimation(High_Estimate, Low_Estimate, Type)
- market(Country, Number_cities)
|
SELECT T2.Country, T1."Year" FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID;
|
Return the type code of the template type with the description "Book".?
Schema:
- Ref_Template_Types(Template_Type_Code, Template_Type_Description)
|
SELECT Template_Type_Code FROM Ref_Template_Types WHERE Template_Type_Description = 'Book';
|
What are each professional's first name and description of the treatment they have performed?
Schema:
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street)
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id)
- Treatment_Types(...)
|
SELECT DISTINCT T1.first_name, T3.treatment_type_description FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id JOIN Treatment_Types AS T3 ON T2.treatment_type_code = T3.treatment_type_code;
|
What are the life spans of representatives from New York state or Indiana state?
Schema:
- representative(JO, Lifespan, Name, Party, State, T1)
|
SELECT Lifespan FROM representative WHERE State = 'New York' OR State = 'Indiana';
|
Show the maximum share count of transactions where the amount is smaller than 10000?
Schema:
- Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code)
|
SELECT MAX(TRY_CAST(share_count AS DOUBLE)) AS max_share_count FROM Transactions WHERE amount_of_transaction < 10000;
|
What are the names of the students who took classes in 2009 or 2010?
Schema:
- student(COUNT, H, dept_name, name, tot_cred)
- takes(COUNT, semester, year)
|
SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.ID = T2.ID WHERE "year" = 2009 OR "year" = 2010;
|
List the title of all cartoon directed by "Ben Jones" or "Brandon Vietti".?
Schema:
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by)
|
SELECT Title FROM Cartoon WHERE Directed_by = 'Ben Jones' OR Directed_by = 'Brandon Vietti';
|
return me the citations of " Making database systems usable " .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
|
SELECT citation_num FROM publication WHERE title = 'Making database systems usable';
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.