question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
find all the restaurant in Pennsylvania?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT T1.name FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T1.state = 'Pennsylvania' AND T2.category_name = 'restaurant'; |
return me the number of papers by " H. V. Jagadish " after 2000 .?
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' AND T3."year" > 2000; |
Find the number of concerts happened in the stadium with the highest capacity .?
Schema:
- concert(COUNT, Year)
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1) | SELECT COUNT(*) AS num_concerts FROM concert WHERE Stadium_ID = (SELECT Stadium_ID FROM stadium ORDER BY Capacity DESC NULLS LAST LIMIT 1); |
Show all paragraph ids and texts for the document with name 'Welcome to NY'.?
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_ID, T1.Paragraph_Text FROM Paragraphs AS T1 JOIN Documents AS T2 ON T1.Document_ID = T2.Document_ID WHERE T2.Document_Name = 'Welcome to NY'; |
For each tourist attraction, return its name and the date when the tourists named Vincent or Vivian visited there.?
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, T3.Visit_Date 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 = 'Vincent' OR T2.Tourist_Details = 'Vivian'; |
What is the total and maximum duration for all trips with the bike id 636?
Schema:
- trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code) | SELECT SUM(duration) AS total_duration, MAX(duration) AS max_duration FROM trip WHERE bike_id = 636; |
Find the ids and names of stations from which at least 200 trips started.?
Schema:
- trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code) | SELECT start_station_id, start_station_name FROM trip WHERE start_station_id IS NOT NULL AND start_station_name IS NOT NULL GROUP BY start_station_id, start_station_name HAVING COUNT(*) >= 200; |
Count the number of different templates used for documents.?
Schema:
- Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more)) | SELECT COUNT(DISTINCT Template_ID) AS num_templates FROM Documents; |
What are flight numbers of flights departing from City "Aberdeen "?
Schema:
- flights(DestAirport, FlightNo, SourceAirport)
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT T1.FlightNo FROM flights AS T1 JOIN airports AS T2 ON T1.SourceAirport = T2.AirportCode WHERE T2.City = 'Aberdeen'; |
Find the name and address of the department that has the highest number of students.?
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, T2.DEPT_ADDRESS FROM STUDENT AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.DEPT_CODE, T2.DEPT_NAME, T2.DEPT_ADDRESS ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Count the number of different software platforms.?
Schema:
- device(COUNT, Carrier, Software_Platform) | SELECT COUNT(DISTINCT Software_Platform) AS num_platforms FROM device; |
What are the names of body builders whose total score is higher than 300?
Schema:
- body_builder(Clean_Jerk, Snatch, Total)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total > 300; |
return me the number of organizations in Databases area located in " North America " .?
Schema:
- domain_author(...)
- author(...)
- domain(...)
- organization(continent, homepage, name) | SELECT COUNT(DISTINCT T2.name) AS num_organizations FROM domain_author AS T4 JOIN author AS T1 ON T4.aid = T1.aid JOIN domain AS T3 ON T3.did = T4.did JOIN organization AS T2 ON T2.oid = T1.oid WHERE T3.name = 'Databases' AND T2.continent = 'North America'; |
Find the names of customers who either have an deputy policy or uniformed policy.?
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 DISTINCT T2.Customer_Details FROM Policies AS T1 JOIN Customers AS T2 ON T1.Customer_ID = T2.Customer_ID WHERE T1.Policy_Type_Code = 'Deputy' OR T1.Policy_Type_Code = 'Uniform'; |
Find all information about student addresses, and sort by monthly rental in descending order.?
Schema:
- Student_Addresses(monthly_rental) | SELECT * FROM Student_Addresses ORDER BY monthly_rental DESC NULLS LAST; |
What is the maximum miles per gallon of the car with 8 cylinders or produced before 1980 ?
Schema:
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year) | SELECT MAX(MPG) AS max_miles_per_gallon FROM cars_data WHERE Cylinders = 8 OR "Year" < 1980; |
What are the names of the customers and staff members?
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))
- 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 DISTINCT Customer_Details FROM (SELECT Customer_Details FROM Customers UNION ALL SELECT Staff_Details FROM Staff); |
return me the number of papers on PVLDB .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name) | SELECT COUNT(DISTINCT T2.title) AS num_papers FROM publication AS T2 JOIN journal AS T1 ON T2.jid = T1.jid WHERE T1.name = 'PVLDB'; |
Who cites Daniel A Reed the most?
Schema:
- writes(...)
- author(...)
- cite(...) | SELECT DISTINCT COUNT(T4.citingPaperId) AS num_cites, T3.authorId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN cite AS T4 ON T2.paperId = T4.citedPaperId JOIN writes AS T3 ON T3.paperId = T4.citingPaperId WHERE T1.authorName = 'Daniel A Reed' GROUP BY T3.authorId ORDER BY num_cites DESC NULLS LAST; |
What are the number of rooms for each bed type?
Schema:
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT bedType, COUNT(*) AS num_rooms FROM Rooms GROUP BY bedType; |
What are the names and id of courses having at most 2 sections?
Schema:
- Courses(course_description, course_name)
- Sections(section_description, section_name) | SELECT T1.course_name, T1.course_id FROM Courses AS T1 JOIN Sections AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_id, T1.course_name HAVING COUNT(*) <= 2; |
How many architects are female?
Schema:
- architect(gender, id, name, nationality) | SELECT COUNT(*) AS num_architects FROM architect WHERE gender = 'female'; |
What is the id and first name of all the drivers who participated in the Australian Grand Prix and the Chinese Grand Prix?
Schema:
- races(date, name)
- results(...)
- drivers(forename, nationality, surname) | SELECT DISTINCT Aus.driverId, Aus.forename FROM (SELECT T2.driverId, T3.forename FROM races AS T1 JOIN results AS T2 ON T1.raceId = T2.raceId JOIN drivers AS T3 ON T2.driverId = T3.driverId WHERE T1.name = 'Australian Grand Prix') AS Aus JOIN (SELECT T2.driverId, T3.forename FROM races AS T1 JOIN results AS T2 ON T1.raceId = T2.raceId JOIN drivers AS T3 ON T2.driverId = T3.driverId WHERE T1.name = 'Chinese Grand Prix') AS Chi ON Aus.driverId = Chi.driverId AND Aus.forename = Chi.forename; |
what state contains the highest point in the us?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT state_name FROM highlow WHERE highest_elevation = (SELECT MAX(highest_elevation) FROM highlow); |
report the total number of degrees granted between 1998 and 2002.?
Schema:
- Campuses(Campus, County, Franc, Location)
- degrees(Campus, Degrees, SUM, Year) | SELECT T1.Campus, SUM(T2.Degrees) AS total_degrees FROM Campuses AS T1 JOIN degrees AS T2 ON T1.Id = T2.Campus WHERE T2."Year" >= 1998 AND T2."Year" <= 2002 GROUP BY T1.Campus; |
what states have rivers running through them?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT traverse FROM river; |
list the first and last names, and the addresses of all employees in the ascending order of their birth date.?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) | SELECT Fname, Lname, Address FROM employee ORDER BY Bdate ASC NULLS LAST; |
What are the ids of courses offered in Fall of 2009 but not in Spring of 2010?
Schema:
- section(COUNT, JO, Spr, T1, course_id, semester, year) | SELECT course_id FROM section WHERE semester = 'Fall' AND "year" = 2009 AND course_id NOT IN (SELECT course_id FROM section WHERE semester = 'Spring' AND "year" = 2010); |
What are the African countries that have a population less than any country in Asia?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT Name FROM country WHERE Continent = 'Africa' AND Population < (SELECT MAX(Population) FROM country WHERE Continent = 'Asia'); |
How many conductors are there?
Schema:
- conductor(Age, Name, Nationality, Year_of_Work) | SELECT COUNT(*) AS num_conductors FROM conductor; |
Which professionals live in a city containing the substring 'West'? List his or her role, street, city and state.?
Schema:
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street) | SELECT role_code, street, city, state FROM Professionals WHERE city LIKE '%West%'; |
Find the name and price of the product that has been ordered the greatest number of times.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Regular_Order_Products(...) | SELECT T1.product_name, T1.product_price FROM Products AS T1 JOIN Regular_Order_Products AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_id, T1.product_name, T1.product_price ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find all details for each swimmer.?
Schema:
- swimmer(Name, Nationality, meter_100, meter_200, meter_300) | SELECT * FROM swimmer; |
Find the number of customers in the banks at New York City.?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state) | SELECT SUM(no_of_customers) AS total_customers FROM bank WHERE city = 'New York City'; |
What is the average song duration for the songs that are in mp3 format and whose resolution below 800?
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 AVG(TRY_CAST(T1.duration AS DOUBLE)) AS avg_duration FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp3' AND T2.resolution < 800; |
Show director with the largest number of show times in total.?
Schema:
- schedule(...)
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) | SELECT T2.Directed_by FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID GROUP BY T2.Directed_by ORDER BY SUM(T1.Show_times_per_day) DESC NULLS LAST LIMIT 1; |
List every album whose title starts with A in alphabetical order.?
Schema:
- albums(I, title) | SELECT title FROM albums WHERE title ILIKE 'A%' ORDER BY title ASC NULLS LAST; |
What are the login names used both by some course authors and some 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; |
List each birth place along with the number of people from there.?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT Birth_Place, COUNT(*) AS num_people FROM people GROUP BY Birth_Place; |
Show me Question Answering papers .?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.keyphraseName = 'Question Answering'; |
How many students are from each city, and which cities have more than one cities?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_students, city_code FROM Student WHERE city_code IS NOT NULL GROUP BY city_code HAVING COUNT(*) > 1; |
what is 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); |
What are the cities that do not have any branches with more than 100 members?
Schema:
- branch(Address_road, City, Name, Open_year, membership_amount) | SELECT DISTINCT City FROM branch WHERE City NOT IN (SELECT City FROM branch WHERE membership_amount > 100); |
What are the arriving date and the departing date of the dogs who have gone through a treatment?
Schema:
- 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 DISTINCT T1.date_arrived, T1.date_departed FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id = T2.dog_id; |
How many movies did " Shahab Hosseini " act in ?
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) | SELECT COUNT(DISTINCT T2.title) AS num_movies FROM cast_ AS T3 JOIN actor AS T1 ON T3.aid = T1.aid JOIN movie AS T2 ON T2.mid = T3.msid WHERE T1.name = 'Shahab Hosseini'; |
what is the population density of the largest state?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT density FROM state WHERE area = (SELECT MAX(area) FROM state); |
How many transactions correspond to each invoice number?
Schema:
- Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type) | SELECT invoice_number, COUNT(*) AS num_transactions FROM Financial_Transactions GROUP BY invoice_number; |
What are the first and last names of all customers with more than 2 payments?
Schema:
- Customer_Payments(payment_method_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 T2.first_name, T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id, T2.first_name, T2.last_name HAVING COUNT(*) > 2; |
Find the maximum and total number of followers of all users.?
Schema:
- user_profiles(email, followers, name, partitionid) | SELECT MAX(followers) AS max_followers, SUM(followers) AS total_followers FROM user_profiles; |
Which physicians have never taken any appointment? Find their names.?
Schema:
- Physician(I, Name)
- Appointment(AppointmentID, Start) | SELECT DISTINCT Name FROM Physician WHERE Name NOT IN (SELECT T2.Name FROM Appointment AS T1 JOIN Physician AS T2 ON T1.Physician = T2.EmployeeID); |
How many clubs are there?
Schema:
- club(Region, Start_year, name) | SELECT COUNT(*) AS num_clubs FROM club; |
Count the number of female Professors we have.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT COUNT(*) AS num_female_professors FROM Faculty WHERE Sex = 'F' AND "Rank" = 'Professor'; |
In which city do the most employees live and how many of them live there?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- 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.city, COUNT(*) AS num_employees FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.city ORDER BY num_employees DESC NULLS LAST LIMIT 1; |
What are the contestant numbers and names of the contestants who had at least two votes?
Schema:
- CONTESTANTS(contestant_name)
- VOTES(created, phone_number, state, vote_id) | SELECT T1.contestant_number, T1.contestant_name FROM CONTESTANTS AS T1 JOIN VOTES AS T2 ON T1.contestant_number = T2.contestant_number GROUP BY T1.contestant_number, T1.contestant_name HAVING COUNT(*) >= 2; |
Return the names of conductors that do not have the nationality "USA".?
Schema:
- conductor(Age, Name, Nationality, Year_of_Work) | SELECT Name FROM conductor WHERE Nationality != 'USA'; |
What are the names and budgets of departments with budgets greater than the average?
Schema:
- department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name) | SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department); |
What is the name of the artist, for each language, that has the most songs with a higher resolution than 500?
Schema:
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more)) | SELECT artist_name FROM song WHERE resolution > 500 AND languages IS NOT NULL AND artist_name IS NOT NULL GROUP BY languages, artist_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
what is the phone number of employees whose salary is in the range of 8000 and 12000?
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 PHONE_NUMBER FROM employees WHERE SALARY BETWEEN 8000 AND 12000; |
What are the names, headquarters and founders of the company with the highest revenue?
Schema:
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT Name, Headquarter, Founder FROM Manufacturers ORDER BY Revenue DESC NULLS LAST LIMIT 1; |
Provide the last name of the youngest student.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT LName FROM Student WHERE Age = (SELECT MIN(Age) FROM Student); |
what is the biggest city in the 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 population = (SELECT MAX(population) FROM city); |
How many continents speak Chinese?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- countrylanguage(COUNT, CountryCode, Engl, Language) | SELECT COUNT(DISTINCT Continent) AS num_continents FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" = 'Chinese'; |
What are the usernames and passwords of users that have the most common role?
Schema:
- Users(COUNT, password, role_code, user_log, user_name) | SELECT user_name, password FROM Users WHERE role_code IS NOT NULL AND user_name IS NOT NULL AND password IS NOT NULL GROUP BY role_code, user_name, password ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the language that was used most often in songs with resolution above 500?
Schema:
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more)) | SELECT artist_name FROM song WHERE resolution > 500 AND languages IS NOT NULL AND artist_name IS NOT NULL GROUP BY languages, artist_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
List each language and the number of TV Channels using it.?
Schema:
- TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name) | SELECT "Language", COUNT(*) AS num_channels FROM TV_Channel GROUP BY "Language"; |
List the snatch score and clean jerk score of body builders in ascending order of snatch score.?
Schema:
- body_builder(Clean_Jerk, Snatch, Total) | SELECT Snatch, Clean_Jerk FROM body_builder ORDER BY Snatch ASC NULLS LAST; |
What are the ids of documents which don't have expense budgets?
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))
- Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID) | SELECT Document_ID FROM Documents WHERE Document_ID NOT IN (SELECT Document_ID FROM Documents_with_Expenses); |
What are the ids of high school students who do not have friends?
Schema:
- Highschooler(COUNT, ID, grade, name)
- Friend(student_id) | SELECT ID FROM Highschooler WHERE ID NOT IN (SELECT student_id FROM Friend); |
what is the combined area of all 50 states?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT SUM(area) AS total_area FROM state; |
Find the first name and age of students who are living in the dorms that do not have amenity TV Lounge.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Lives_in(...)
- Has_amenity(dormid)
- Dorm_amenity(amenity_name) | SELECT T1.Fname, T1.Age FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid NOT IN (SELECT T3.dormid FROM Has_amenity AS T3 JOIN Dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge'); |
What are the names of nations where both English and French are official languages?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- countrylanguage(COUNT, CountryCode, Engl, Language) | SELECT T3.Name FROM (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" = 'English' AND T2.IsOfficial = 'T') AS T3 JOIN (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" = 'French' AND T2.IsOfficial = 'T') AS T4 ON T3.Name = T4.Name; |
papers published in 2015 by Liwen Xiong?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId 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 = 'Liwen Xiong' AND T3."year" = 2015; |
what is the best restaurant in bay area for american food ?
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'); |
List the date, theme and sales of the journal which did not have any of the listed editors serving on committee.?
Schema:
- journal(Theme, homepage, name)
- journal_committee(...) | SELECT T1."Date", T1.Theme, T1.Sales FROM journal AS T1 LEFT JOIN journal_committee AS T2 ON T1.Journal_ID = T2.Journal_ID WHERE T2.Journal_ID IS NULL; |
Return the types of film market estimations in 1995.?
Schema:
- film_market_estimation(High_Estimate, Low_Estimate, Type) | SELECT Type FROM film_market_estimation WHERE "Year" = 1995; |
How many papers were published in nature communications in 2015 ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(T1.paperId) AS num_papers FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T1."year" = 2015 AND T2.venueName = 'nature communications'; |
What is the unit price of the tune "Fast As a Shark"?
Schema:
- tracks(composer, milliseconds, name, unit_price) | SELECT unit_price FROM tracks WHERE name = 'Fast As a Shark'; |
What is the date, average temperature and mean humidity for the days with the 3 largest maximum gust speeds?
Schema:
- weather(AVG, COUNT, M, Ra, cloud_cover, date, diff, events, mean_humidity, mean_sea_level_pressure_inches, mean_temperature_f, mean_visibility_miles, ... (1 more)) | SELECT "date", mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC NULLS LAST LIMIT 3; |
What is the average capacity of the stadiums that were opened in year 2005?
Schema:
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1) | SELECT AVG(Capacity) AS avg_capacity FROM stadium WHERE Opening_year = 2005; |
List the date of each treatment, together with the first name of the professional who operated it.?
Schema:
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id)
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street) | SELECT T1.date_of_treatment, T2.first_name FROM Treatments AS T1 JOIN Professionals AS T2 ON T1.professional_id = T2.professional_id; |
Find the actors who played in the latest movie by " Quentin Tarantino "?
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 T1.name 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 T3.name = 'Quentin Tarantino' ORDER BY T5.release_year DESC NULLS LAST LIMIT 1; |
What are the names and locations of tracks that have had exactly 1 race?
Schema:
- race(Class, Date, Name)
- track(Location, Name, Seat, Seating, T1, Year_Opened) | SELECT T2.Name, T2.Location 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, T2.Location HAVING COUNT(*) = 1; |
Find the details of all the markets that are accessible by walk or bus.?
Schema:
- Street_Markets(...)
- 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.Market_Details FROM Street_Markets AS T1 JOIN Tourist_Attractions AS T2 ON T1.Market_ID = T2.Tourist_Attraction_ID WHERE T2.How_to_Get_There = 'walk' OR T2.How_to_Get_There = 'bus'; |
List the document type code, document name, and document description for the document with name 'Noel CV' or name 'King Book'.?
Schema:
- Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more)) | SELECT Document_Type_Code, Document_Name, Document_Description FROM Documents WHERE Document_Name = 'Noel CV' OR Document_Name = 'King Book'; |
Find the name of persons who are friends with Alice for the shortest years.?
Schema:
- PersonFriend(M, friend, name) | SELECT name FROM PersonFriend WHERE friend = 'Alice' AND "year" = (SELECT MIN("year") FROM PersonFriend WHERE friend = 'Alice'); |
Find the total hours of all projects.?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT SUM(Hours) AS total_hours FROM Projects; |
what river runs through the most states?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river GROUP BY (river_name) ORDER BY COUNT(DISTINCT traverse) DESC NULLS LAST LIMIT 1; |
Find distinct cities of addresses of people?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- People_Addresses(...) | SELECT DISTINCT T1.city FROM Addresses AS T1 JOIN People_Addresses AS T2 ON T1.address_id = T2.address_id; |
Which product has the most problems? Give me the number of problems and the product name.?
Schema:
- Product(product_id, product_name)
- Problems(date_problem_reported, problem_id) | SELECT COUNT(*) AS num_problems, T1.product_name FROM Product AS T1 JOIN Problems AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_name ORDER BY num_problems DESC NULLS LAST LIMIT 1; |
What is all the product data, as well as each product's manufacturer?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT * FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code; |
What is the mobile phone number of the student named Timmothy Ward ?
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 cell_mobile_number FROM Students WHERE first_name = 'Timmothy' AND last_name = 'Ward'; |
Which staff handled least number of payments? List the full name and the id.?
Schema:
- staff(...)
- payment(amount, payment_date) | SELECT T1.first_name, T1.last_name, T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id GROUP BY T1.first_name, T1.last_name, T1.staff_id ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
How many products are never booked with amount higher than 200?
Schema:
- Products_for_Hire(daily_hire_cost, product_description, product_name, product_type_code)
- Products_Booked(booked_count, product_id) | SELECT COUNT(*) AS num_products FROM Products_for_Hire WHERE product_id NOT IN (SELECT product_id FROM Products_Booked WHERE booked_amount > 200); |
How many male students (sex is 'M') are allergic to any type of food?
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'); |
Show each state and the number of addresses in each state.?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT state_province_county, COUNT(*) AS num_addresses FROM Addresses GROUP BY state_province_county; |
Return the average enrollment of universities founded before 1850.?
Schema:
- university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School) | SELECT AVG(Enrollment) AS avg_enrollment FROM university WHERE Founded < 1850; |
Return the description for the courses named "database".?
Schema:
- Courses(course_description, course_name) | SELECT course_description FROM Courses WHERE course_name = 'database'; |
What is the country that has the most perpetrators?
Schema:
- perpetrator(Country, Date, Injured, Killed, Location, Year) | SELECT Country, COUNT(*) AS num_perpetrators FROM perpetrator WHERE Country IS NOT NULL GROUP BY Country ORDER BY num_perpetrators DESC NULLS LAST LIMIT 1; |
Find the names of all races held in 2017.?
Schema:
- races(date, name) | SELECT name FROM races WHERE "year" = 2017; |
What are the product ids and color descriptions for products with two or more characteristics?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Ref_Colors(color_description)
- Product_Characteristics(...) | SELECT T1.product_id, T2.color_description FROM Products AS T1 JOIN Ref_Colors AS T2 ON T1.color_code = T2.color_code JOIN Product_Characteristics AS T3 ON T1.product_id = T3.product_id GROUP BY T1.product_id, T2.color_description HAVING COUNT(*) >= 2; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.