question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
Which cities have regional population above 10000000?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT City FROM city WHERE Regional_Population > 10000000; |
What is the season of the game which causes the player 'Walter Samuel' to get injured?
Schema:
- game(Date, Home_team, Season)
- injury_accident(Source) | SELECT T1.Season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.Player = 'Walter Samuel'; |
Find the number of pets whose weight is heavier than 10.?
Schema:
- Pets(PetID, PetType, pet_age, weight) | SELECT COUNT(*) AS num_pets FROM Pets WHERE weight > 10; |
What are the names of players whose training hours is between 500 and 1500?
Schema:
- Player(HS, pName, weight, yCard) | SELECT pName FROM Player WHERE HS BETWEEN 500 AND 1500; |
What is the smallest weight of the car produced with 8 cylinders on 1974 ?
Schema:
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year) | SELECT MIN(Weight) AS min_weight FROM cars_data WHERE Cylinders = 8 AND "Year" = 1974; |
What are the details and opening hours of the museums?
Schema:
- Museums(...)
- 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 T1.Museum_Details, T2.Opening_Hours FROM Museums AS T1 JOIN Tourist_Attractions AS T2 ON T1.Museum_ID = T2.Tourist_Attraction_ID; |
How many students are older than 20 in each dorm?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Lives_in(...)
- Dorm(dorm_name, gender, student_capacity) | SELECT COUNT(*) AS num_students, T3.dorm_name FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.Age > 20 GROUP BY T3.dorm_name; |
What is the name and rank of every company ordered by descending number of sales?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Company, "Rank" FROM company ORDER BY Sales_billion DESC NULLS LAST; |
What are the name of rooms booked by customers whose first name has "ROY" in part?
Schema:
- Reservations(Adults, CheckIn, FirstName, Kids, LastName)
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE FirstName LIKE '%ROY%'; |
What are the names of musicals who have no actors?
Schema:
- musical(Award, COUNT, Name, Nom, Nominee, Result, T1)
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT Name FROM musical WHERE Musical_ID NOT IN (SELECT Musical_ID FROM actor); |
List the name of tracks belongs to genre Rock and whose media type is MPEG audio file.?
Schema:
- genres(name)
- tracks(composer, milliseconds, name, unit_price)
- media_types(name) | SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = 'Rock' AND T3.name = 'MPEG audio file'; |
return me the number of 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 COUNT(DISTINCT T1.name) AS num_authors 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'; |
How many distinct incident type codes are there?
Schema:
- Behavior_Incident(NO, date_incident_end, date_incident_start, incident_type_code) | SELECT COUNT(DISTINCT incident_type_code) AS num_incident_types FROM Behavior_Incident; |
What are the full names and department ids for the lowest paid employees across all 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 different budget type codes, and how many documents are there for each?
Schema:
- Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID) | SELECT Budget_Type_Code, COUNT(*) AS num_documents FROM Documents_with_Expenses GROUP BY Budget_Type_Code; |
What are the paragraph texts for the document with the name 'Customer reviews'?
Schema:
- Paragraphs(COUNT, Document_ID, Other_Details, Paragraph_Text, T1)
- 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.Paragraph_Text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.Document_ID = T2.Document_ID WHERE T2.Document_Name = 'Customer reviews'; |
how many rivers in idaho?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT COUNT(river_name) AS num_rivers FROM river WHERE traverse = 'idaho'; |
What is the name of the person who is the oldest?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT name FROM Person WHERE age = (SELECT MAX(age) FROM Person); |
Who are Noah A Smith 's co-authors?
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'; |
What are the first names of students in room 108?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName) | SELECT FirstName FROM list WHERE Classroom = 108; |
What are the countries that have greater surface area than any country in Europe?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT Name FROM country WHERE SurfaceArea > (SELECT MIN(SurfaceArea) FROM country WHERE Continent = 'Europe'); |
Return the characteristic names of the 'sesame' product.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Product_Characteristics(...)
- Characteristics(characteristic_name) | SELECT T3.characteristic_name FROM Products AS T1 JOIN Product_Characteristics AS T2 ON T1.product_id = T2.product_id JOIN Characteristics AS T3 ON T2.characteristic_id = T3.characteristic_id WHERE T1.product_name = 'sesame'; |
What is the unit of measurement of product named "cumin"?
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 FROM Products AS T1 JOIN Ref_Product_Categories AS T2 ON T1.product_category_code = T2.product_category_code WHERE T1.product_name = 'cumin'; |
Show all ministers who do not belong to Progress Party.?
Schema:
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more)) | SELECT Minister FROM party WHERE Party_name != 'Progress Party'; |
How many documents can one grant have at most? List the grant id and number.?
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 grant_id, COUNT(*) AS num_documents FROM Documents WHERE grant_id IS NOT NULL GROUP BY grant_id ORDER BY num_documents DESC NULLS LAST LIMIT 1; |
Give me 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 are the names and descriptions of all the sections?
Schema:
- Sections(section_description, section_name) | SELECT section_name, section_description FROM Sections; |
How many documents were shipped by USPS?
Schema:
- Ref_Shipping_Agents(shipping_agent_code, shipping_agent_name)
- 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 Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = 'USPS'; |
Return the maximum and minimum number of cows across all farms.?
Schema:
- farm(Cows, Working_Horses) | SELECT MAX(Cows) AS max_cows, MIN(Cows) AS min_cows FROM farm; |
How many parties do we have?
Schema:
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more)) | SELECT COUNT(DISTINCT Party_name) AS num_parties FROM party; |
How many different types of rooms are there?
Schema:
- Room(BlockCode, RoomType, Unavailable) | SELECT COUNT(DISTINCT RoomType) AS num_room_types FROM Room; |
How many customers have an active value of 1?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) | SELECT COUNT(*) AS num_customers FROM customer WHERE active = '1'; |
Which department has the highest average student GPA, and what is the average gpa?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT T2.DEPT_NAME, AVG(T1.STU_GPA) AS avg_gpa FROM STUDENT AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.DEPT_CODE, T2.DEPT_NAME ORDER BY avg_gpa DESC NULLS LAST LIMIT 1; |
What is the average enrollment number?
Schema:
- College(M, cName, enr, state) | SELECT AVG(enr) AS avg_enr FROM College; |
What are the descriptions and names of the courses that have student enrollment bigger than 2?
Schema:
- Courses(course_description, course_name)
- Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) | SELECT T1.course_description, T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name, T1.course_description HAVING COUNT(*) > 2; |
How many stations does Mountain View city has?
Schema:
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT COUNT(*) AS num_stations FROM station WHERE city = 'Mountain View'; |
return me the number of papers by " H. V. Jagadish " .?
Schema:
- writes(...)
- author(...)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT COUNT(DISTINCT T3.title) AS num_papers FROM writes AS T2 JOIN author AS T1 ON T2.aid = T1.aid JOIN publication AS T3 ON T2.pid = T3.pid WHERE T1.name = 'H. V. Jagadish'; |
Find the total quantity of products associated with the orders in the "Cancelled" status.?
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) | SELECT SUM(TRY_CAST(T2.order_quantity AS DOUBLE)) AS total_quantity FROM Customer_Orders AS T1 JOIN Order_Items AS T2 ON T1.order_id = T2.order_id WHERE T1.order_status = 'Cancelled'; |
Give the total money requested by entrepreneurs who are taller than 1.85.?
Schema:
- entrepreneur(COUNT, Company, Investor, Money_Requested)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT SUM(T1.Money_Requested) AS total_money_requested FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 1.85; |
Show the id, name of each festival and the number of artworks it has nominated.?
Schema:
- nomination(...)
- artwork(COUNT, Name, Type)
- festival_detail(Chair_Name, Festival_Name, Location, T1, Year) | SELECT T1.Festival_ID, T3.Festival_Name, COUNT(*) AS num_artworks FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID GROUP BY T1.Festival_ID, T3.Festival_Name; |
List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born.?
Schema:
- department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name)
- management(temporary_acting)
- head(age, born_state, head_ID, name) | SELECT DISTINCT T4.born_state FROM (SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_ID = T2.department_ID JOIN head AS T3 ON T2.head_ID = T3.head_ID WHERE T1.name = 'Treasury') T4, (SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_ID = T2.department_ID JOIN head AS T3 ON T2.head_ID = T3.head_ID WHERE T1.name = 'Homeland Security') AS T5 WHERE T4.born_state = T5.born_state; |
Which employee received the biggest bonus? Give me the employee name.?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
- evaluation(Bonus) | SELECT T1.Name FROM employee AS T1 JOIN evaluation AS T2 ON CAST(T1.Employee_ID AS TEXT) = T2.Employee_ID ORDER BY T2.Bonus DESC NULLS LAST LIMIT 1; |
Show the most common country across members.?
Schema:
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) | SELECT Country FROM member_ WHERE Country IS NOT NULL GROUP BY Country ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the names of tourist attraction that Alison visited but Rosalind did not visit?
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 T1.Name FROM Tourist_Attractions AS T1, Visitors AS T2, Visits AS T3 WHERE T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID AND T2.Tourist_Details = 'Alison' AND T1.Name NOT IN (SELECT T1.Name FROM Tourist_Attractions AS T1, Visitors AS T2, Visits AS T3 WHERE T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID AND T2.Tourist_Details = 'Rosalind'); |
Find the number of distinct stages in claim processing.?
Schema:
- Claims_Processing_Stages(Claim_Status_Description, Claim_Status_Name) | SELECT COUNT(*) AS num_stages FROM Claims_Processing_Stages; |
What are the degrees conferred in "San Francisco State University" in 2001.?
Schema:
- Campuses(Campus, County, Franc, Location)
- degrees(Campus, Degrees, SUM, Year) | SELECT Degrees FROM Campuses AS T1 JOIN degrees AS T2 ON T1.Id = T2.Campus WHERE T1.Campus = 'San Francisco State University' AND T2."Year" = 2001; |
List the course name of courses sorted by credits.?
Schema:
- Course(CName, Credits, Days) | SELECT CName FROM Course ORDER BY Credits ASC NULLS LAST; |
Find the total amount of loans offered by each bank branch.?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state)
- loan(...) | SELECT SUM(amount) AS total_loan_amount, T1.bname FROM bank AS T1 JOIN loan AS T2 ON CAST(T1.branch_ID AS TEXT) = T2.branch_ID GROUP BY T1.bname; |
What are the nations that have more than two ships?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT Nationality FROM ship WHERE Nationality IS NOT NULL GROUP BY Nationality HAVING COUNT(*) > 2; |
what cities in wyoming have the highest number of citizens?
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'; |
What campuses are located in Los Angeles county and opened after 1950?
Schema:
- Campuses(Campus, County, Franc, Location) | SELECT Campus FROM Campuses WHERE County = 'Los Angeles' AND "Year" > 1950; |
What is the id and name of the employee with the highest salary?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) | SELECT eid, name FROM employee ORDER BY salary DESC NULLS LAST LIMIT 1; |
Who is the director of the tv series " House of Cards " from 2013 ?
Schema:
- director(Afghan, name, nationality)
- directed_by(...)
- tv_series(...) | SELECT T2.name FROM director AS T2 JOIN directed_by AS T1 ON T2.did = T1.did JOIN tv_series AS T3 ON T3.sid = T1.msid WHERE T3.release_year = 2013 AND T3.title = 'House of Cards'; |
Find the SSN and name of scientists who are assigned to the project with the longest hours.?
Schema:
- AssignedTo(Scientist)
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
- Scientists(Name) | SELECT T3.SSN, T3.Name FROM AssignedTo AS T1 JOIN Projects AS T2 ON T1.Project = T2.Code JOIN Scientists AS T3 ON T1.Scientist = T3.SSN WHERE T2.Hours = (SELECT MAX(Hours) FROM Projects); |
Find the average age of the students who have allergies with food and animal types.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Allergy(Allergy, COUNT, StuID)
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT AVG(Age) AS avg_age FROM Student WHERE StuID IN (SELECT DISTINCT T3.StuID FROM (SELECT T1.StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = 'food') T3, (SELECT T1.StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = 'animal') AS T4 WHERE T3.StuID = T4.StuID); |
What is the maximum Online Mendelian Inheritance in Man (OMIM) value of the enzymes?
Schema:
- enzyme(Chromosome, Location, OMIM, Porphyria, Product, name) | SELECT MAX(OMIM) AS max_omim FROM enzyme; |
how many different positions are there?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT COUNT(DISTINCT "Position") AS num_positions FROM player; |
How many students are older than average for each gender?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_students, Sex FROM Student WHERE Age > (SELECT AVG(Age) FROM Student) GROUP BY Sex; |
Show the prices of the products named "Dining" or "Trading Policy".?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT Product_Price FROM Products WHERE Product_Name = 'Dining' OR Product_Name = 'Trading Policy'; |
For each product, show its name and the number of times it was ordered.?
Schema:
- Orders(customer_id, date_order_placed, order_id)
- 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 T3.product_name, COUNT(*) AS num_orders FROM Orders AS T1 JOIN Order_Items AS T2 ON T1.order_id = T2.order_id JOIN Products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id, T3.product_name; |
Which services type had both successful and failure event details?
Schema:
- Services(Service_Type_Code, Service_name)
- Events(...) | SELECT DISTINCT Success.Service_Type_Code FROM (SELECT T1.Service_Type_Code FROM Services AS T1 JOIN Events AS T2 ON T1.Service_ID = T2.Service_ID WHERE T2.Event_Details = 'Success') AS Success JOIN (SELECT T1.Service_Type_Code FROM Services AS T1 JOIN Events AS T2 ON T1.Service_ID = T2.Service_ID WHERE T2.Event_Details = 'Fail') AS Fail ON Success.Service_Type_Code = Fail.Service_Type_Code; |
What are the maximum duration and resolution of songs grouped and ordered by languages?
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 MAX(TRY_CAST(T1.duration AS DOUBLE)) AS max_duration, MAX(T2.resolution) AS max_resolution, T2.languages FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.languages ORDER BY T2.languages ASC NULLS LAST; |
Find the list of page size which have more than 3 product listed?
Schema:
- product(COUNT, pages_per_minute_color, product) | SELECT max_page_size FROM product WHERE max_page_size IS NOT NULL GROUP BY max_page_size HAVING COUNT(*) > 3; |
What is the first, middle, and last name of the earliest school graduate?
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)) | SELECT first_name, middle_name, last_name FROM Students ORDER BY date_left ASC NULLS LAST LIMIT 1; |
most cited parsing papers?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...) | SELECT DISTINCT T4.citedPaperId, COUNT(T4.citedPaperId) AS num_cites FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN cite AS T4 ON T3.paperId = T4.citedPaperId WHERE T1.keyphraseName = 'parsing' GROUP BY T4.citedPaperId ORDER BY num_cites DESC NULLS LAST; |
Which film has the most copies in the inventory? List both 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 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.title, T1.film_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Please show the categories of the music festivals with count more than 1.?
Schema:
- music_festival(COUNT, Category, Date_of_ceremony, Result) | SELECT Category FROM music_festival WHERE Category IS NOT NULL GROUP BY Category HAVING COUNT(*) > 1; |
What are first and last names of players participating in all star game in 1998?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
- all_star(...) | SELECT name_first, name_last FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id WHERE "year" = 1998; |
Find the number of male (sex is 'M') students who have some food type allery.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Allergy(Allergy, COUNT, StuID)
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT COUNT(*) AS num_male_students FROM Student WHERE Sex = 'M' AND StuID IN (SELECT StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = 'food'); |
find id of the tv channels that from the countries where have more than two tv channels.?
Schema:
- TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name) | SELECT id FROM TV_Channel WHERE Country IS NOT NULL AND id IS NOT NULL GROUP BY Country, id HAVING COUNT(*) > 2; |
List the brands of lenses that took both a picture of mountains with range 'Toubkal Atlas' and a picture of mountains with range 'Lasta Massif'?
Schema:
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
- photos(color, id, name)
- camera_lens(brand, name) | SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1."Range" = 'Toubkal Atlas' OR T1."Range" = 'Lasta Massif' GROUP BY T3.brand HAVING COUNT(DISTINCT T1."Range") = 2; |
find the number of actors from Iran who played in " Jim Jarmusch " movies?
Schema:
- cast_(...)
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
- directed_by(...)
- director(Afghan, name, nationality) | SELECT COUNT(DISTINCT T1.name) AS num_actors FROM cast_ AS T4 JOIN actor AS T1 ON T4.aid = T1.aid JOIN movie AS T5 ON T5.mid = T4.msid JOIN directed_by AS T2 ON T5.mid = T2.msid JOIN director AS T3 ON T3.did = T2.did WHERE T1.nationality = 'Iran' AND T3.name = 'Jim Jarmusch'; |
For each product type, return the maximum and minimum price.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT product_type_code, MAX(product_price) AS max_price, MIN(product_price) AS min_price FROM Products GROUP BY product_type_code; |
Find the number of apartments that have no facility.?
Schema:
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
- Apartment_Facilities(...) | SELECT COUNT(*) AS num_apartments FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities); |
Count the number of clubs located at "HHH".?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn) | SELECT COUNT(*) AS num_clubs FROM Club WHERE ClubLocation = 'HHH'; |
Find the maximum and average capacity among rooms in each building.?
Schema:
- classroom(building, capacity, room_number) | SELECT MAX(capacity) AS max_capacity, AVG(capacity) AS avg_capacity, building FROM classroom GROUP BY building; |
What is the list of school locations sorted in ascending order of school enrollment?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type) | SELECT Location FROM school ORDER BY Enrollment ASC NULLS LAST; |
What are the mission codes, fates, and names of the ships involved?
Schema:
- mission(...)
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT T1.Code, T1.Fate, T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID; |
What is the average age for all people in the table?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT AVG(age) AS avg_age FROM Person; |
Find the names and total checking and savings balances of accounts whose savings balance is higher than the average savings balance.?
Schema:
- ACCOUNTS(name)
- CHECKING(balance)
- SAVINGS(SAV, balance) | SELECT T1.name, T2.balance + T3.balance AS total_balance FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid WHERE T3.balance > (SELECT AVG(balance) FROM SAVINGS); |
Count the number of items store 1 has in stock.?
Schema:
- inventory(COUNT, store_id) | SELECT COUNT(*) AS num_items FROM inventory WHERE store_id = 1; |
Find the id of instructors who didn't teach any courses?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary)
- teaches(ID, Spr, semester) | SELECT ID FROM instructor WHERE ID NOT IN (SELECT ID FROM teaches); |
return me the number of papers in PVLDB after 2000 in " University of Michigan " .?
Schema:
- organization(continent, homepage, name)
- author(...)
- writes(...)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name) | SELECT COUNT(DISTINCT T5.title) AS num_papers FROM organization AS T2 JOIN author AS T1 ON T2.oid = T1.oid JOIN writes AS T4 ON T4.aid = T1.aid JOIN publication AS T5 ON T4.pid = T5.pid JOIN journal AS T3 ON T5.jid = T3.jid WHERE T3.name = 'PVLDB' AND T2.name = 'University of Michigan' AND T5."year" > 2000; |
Find the number of distinct bed types available in this inn.?
Schema:
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT COUNT(DISTINCT bedType) AS num_bed_types FROM Rooms; |
Which course is enrolled in by the most students? Give me the course name.?
Schema:
- Courses(course_description, course_name)
- Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) | SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show the locations that have more than one railways.?
Schema:
- railway(Builder, COUNT, Location) | SELECT Location FROM railway WHERE Location IS NOT NULL GROUP BY Location HAVING COUNT(*) > 1; |
return me the number of papers published in the VLDB conference before 2000 .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- conference(homepage, name) | SELECT COUNT(DISTINCT T2.title) AS num_papers FROM publication AS T2 JOIN conference AS T1 ON T2.cid = CAST(T1.cid AS TEXT) WHERE T1.name = 'VLDB' AND T2."year" < 2000; |
what is the largest capital?
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 city_name FROM city WHERE population = (SELECT MAX(T1.population) FROM state AS T2 JOIN city AS T1 ON T2.capital = T1.city_name); |
Which apartments have unit status availability of both 0 and 1? Return their apartment numbers.?
Schema:
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
- View_Unit_Status(...) | SELECT DISTINCT T3.apt_number FROM (SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 0) AS T3 JOIN (SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 1) AS T4 ON T3.apt_number = T4.apt_number; |
Find the top 3 wineries with the greatest number of wines made of white color grapes.?
Schema:
- grapes(...)
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT T2.Winery FROM grapes AS T1 JOIN wine AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'White' GROUP BY T2.Winery ORDER BY COUNT(*) DESC NULLS LAST LIMIT 3; |
List of authors acl 2016?
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 T2."year" = 2016 AND T3.venueName = 'acl'; |
What is the address for the customer with id 10?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- Customer_Addresses(address_type_code) | SELECT T1.address_details FROM Addresses AS T1 JOIN Customer_Addresses AS T2 ON T1.address_id = T2.address_id WHERE T2.customer_id = 10; |
what is the river that cross over illinois?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE traverse = 'illinois'; |
Find the name of the target user with the lowest trust score.?
Schema:
- useracct(...)
- trust(...) | SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id ORDER BY trust ASC NULLS LAST LIMIT 1; |
how many parsing papers appeared in the proceeeding of ACL 2014 ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- venue(venueId, venueName) | SELECT DISTINCT COUNT(T3.paperId) AS num_papers FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.keyphraseName = 'parsing' AND T3."year" = 2014 AND T4.venueName = 'ACL'; |
What are the different government forms and what is the total population of each for government forms that have an average life expectancy greater than 72?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT SUM(Population) AS total_population, GovernmentForm FROM country WHERE GovernmentForm IS NOT NULL GROUP BY GovernmentForm HAVING AVG(LifeExpectancy) > 72; |
What is the interaction type of the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?
Schema:
- medicine_enzyme_interaction(interaction_type)
- medicine(FDA_approved, Trade_Name, name)
- enzyme(Chromosome, Location, OMIM, Porphyria, Product, name) | SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'; |
List lesson id of all lessons taught by staff with first name as Janessa, last name as Sawayn and nickname containing letter 's'.?
Schema:
- Lessons(lesson_status_code)
- Staff(COUNT, Name, Other_Details, date_joined_staff, date_left_staff, date_of_birth, email_address, first_name, gender, last_name, middle_name, nickname) | SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn' AND nickname LIKE '%s%'; |
Find employee with ID and name of the country presently where (s)he is working.?
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)
- countries(...) | SELECT T1.EMPLOYEE_ID, T4.COUNTRY_NAME 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 JOIN countries AS T4 ON T3.COUNTRY_ID = T4.COUNTRY_ID; |
where are some restaurants good for arabic food 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; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.