question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
What are the rank, first name, and last name of the faculty members?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT "Rank", Fname, Lname FROM Faculty; |
Find the cities of businesses rated below 1.5?
Schema:
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT city FROM business WHERE rating < 1.5; |
conferences that Daniella Coelho has published in?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.venueId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'Daniella Coelho'; |
display the employee number and name( first name and last name ) for all employees who work in a department with any employee whose name contains a ’T’.?
Schema:
- employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) | SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME FROM employees WHERE DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM employees WHERE FIRST_NAME LIKE '%T%'); |
Find the "date became customers" of the customers whose ID is between 10 and 20.?
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 date_became_customer FROM Customers WHERE customer_id BETWEEN 10 AND 20; |
Find the name of students who took some course offered by Statistics department.?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- takes(COUNT, semester, year)
- student(COUNT, H, dept_name, name, tot_cred) | SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id = T2.course_id JOIN student AS T3 ON T2.ID = T3.ID WHERE T1.dept_name = 'Statistics'; |
How many reviews does " Acacia Cafe " have ?
Schema:
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT review_count FROM business WHERE name = 'Acacia Cafe'; |
What is the name of the high schooler who has the greatest number of friends?
Schema:
- Friend(student_id)
- Highschooler(COUNT, ID, grade, name) | SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID GROUP BY T1.student_id, T2.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What topic does Luke Zettlemoyer write about ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T1.keyphraseId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T5 ON T4.authorId = T5.authorId WHERE T5.authorName = 'Luke Zettlemoyer'; |
how many states border the largest state?
Schema:
- border_info(T1, border, state_name)
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT COUNT(border) AS num_borders FROM border_info WHERE state_name = (SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state)); |
Count the number of students who did not enroll in any course.?
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_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) | SELECT COUNT(*) AS num_students FROM Students WHERE student_id NOT IN (SELECT student_id FROM Student_Course_Enrolment); |
Return the different document ids along with the number of paragraphs corresponding to each, ordered by id.?
Schema:
- Paragraphs(COUNT, Document_ID, Other_Details, Paragraph_Text, T1) | SELECT Document_ID, COUNT(*) AS num_paragraphs FROM Paragraphs WHERE Document_ID IS NOT NULL GROUP BY Document_ID ORDER BY Document_ID ASC NULLS LAST; |
Find the numbers of different majors and cities.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(DISTINCT Major) AS num_majors, COUNT(DISTINCT city_code) AS num_cities FROM Student; |
Who acts " Olivia Pope " in the series Scandal ?
Schema:
- cast_(...)
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
- tv_series(...) | SELECT T1.name FROM cast_ AS T3 JOIN actor AS T1 ON T3.aid = T1.aid JOIN tv_series AS T2 ON T2. sid = T3.msid WHERE T3.role = 'Olivia Pope' AND T2.title = 'Scandal'; |
Show all investor details.?
Schema:
- Investors(Investor_details) | SELECT Investor_details FROM Investors; |
Give the name, population, and head of state for the country that has the largest area.?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT Name, Population, HeadOfState FROM country ORDER BY SurfaceArea DESC NULLS LAST LIMIT 1; |
Return ids of all the products that are supplied by supplier id 2 and are more expensive than the average price of all products.?
Schema:
- Product_Suppliers(COUNT, DOUBLE, TRY_CAST, product_id, supplier_id)
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT T1.product_id FROM Product_Suppliers AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 2 AND T2.product_price > (SELECT AVG(product_price) FROM Products); |
Find all actors from Italy born after 1980?
Schema:
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT name FROM actor WHERE birth_year > 1980 AND nationality = 'Italy'; |
How many distinct names are associated with all the photos?
Schema:
- Photos(Name) | SELECT COUNT(DISTINCT Name) AS num_names FROM Photos; |
Find the names of the campus which has more faculties in 2002 than every campus in Orange county.?
Schema:
- Campuses(Campus, County, Franc, Location)
- faculty(Faculty) | SELECT T1.Campus FROM Campuses AS T1 JOIN faculty AS T2 ON T1.Id = T2.Campus WHERE T2."Year" = 2002 AND Faculty > (SELECT MAX(Faculty) FROM Campuses AS T1 JOIN faculty AS T2 ON T1.Id = T2.Campus WHERE T2."Year" = 2002 AND T1.County = 'Orange'); |
what is the last name and gender of all students who played both Call of Destiny and Works of Widenius?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Plays_Games(GameID, Hours_Played, StuID)
- Video_Games(COUNT, Dest, GName, GType, onl) | SELECT LName, Sex FROM Student s WHERE EXISTS (SELECT 1 FROM Plays_Games pg JOIN Video_Games vg ON pg.GameID = vg.GameID WHERE vg.GName = 'Call of Destiny' AND s.StuID = pg.StuID) AND EXISTS (SELECT 1 FROM Plays_Games pg JOIN Video_Games vg ON pg.GameID = vg.GameID WHERE vg.GName = 'Works of Widenius' AND s.StuID = pg.StuID); |
List all pilot names in ascending alphabetical order.?
Schema:
- pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team) | SELECT Name FROM pilot ORDER BY Name ASC NULLS LAST; |
What is the total number of ratings that has more than 3 stars?
Schema:
- Rating(Rat, mID, rID, stars) | SELECT COUNT(*) AS num_ratings FROM Rating WHERE stars > 3; |
How many papers are there ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT COUNT(DISTINCT paperId) AS num_papers FROM paper; |
What is the average number of audience for festivals?
Schema:
- festival_detail(Chair_Name, Festival_Name, Location, T1, Year) | SELECT AVG(Num_of_Audience) AS avg_num_of_audience FROM festival_detail; |
What is the number of movies in which " Jennifer Aniston " acted after 2010 ?
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 = 'Jennifer Aniston' AND T2.release_year > 2010; |
How many advisors are there?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(DISTINCT Advisor) AS num_advisors FROM Student; |
Which trip started from the station with the largest dock count? Give me the trip id.?
Schema:
- trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code)
- station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) | SELECT T1.id FROM trip AS T1 JOIN station AS T2 ON T1.start_station_id = T2.id ORDER BY T2.dock_count DESC NULLS LAST LIMIT 1; |
How many templates do we have?
Schema:
- Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number) | SELECT COUNT(*) AS num_templates FROM Templates; |
Find the number of left handed winners who participated in the WTA Championships.?
Schema:
- matches_(COUNT, T1, loser_age, loser_name, minutes, tourney_name, winner_age, winner_hand, winner_name, winner_rank, winner_rank_points, year) | SELECT COUNT(DISTINCT winner_name) AS num_winners FROM matches_ WHERE tourney_name = 'WTA Championships' AND winner_hand = 'L'; |
return me the references of " Making database systems usable " .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT reference_num FROM publication WHERE title = 'Making database systems usable'; |
List email address and birthday of customer whose first name as Carole.?
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 email_address, date_of_birth FROM Customers WHERE first_name = 'Carole'; |
What are the names of actors who are not 20 years old?
Schema:
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT Name FROM actor WHERE age != 20; |
What are the headquarters with at least two companies in the banking industry?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Headquarters FROM company WHERE Main_Industry = 'Banking' AND Headquarters IS NOT NULL GROUP BY Headquarters HAVING COUNT(*) >= 2; |
How many airports haven't the pilot 'Thompson' driven an aircraft?
Schema:
- airport(Airport_Name, City, Country, Domestic_Passengers, International_Passengers, Transit_Passengers, id, name)
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT COUNT(*) AS num_airports FROM airport WHERE id NOT IN (SELECT airport_id FROM flight WHERE Pilot = 'Thompson'); |
Return all detention summaries.?
Schema:
- Detention(detention_summary, detention_type_code) | SELECT detention_summary FROM Detention; |
What are the names, classes, and ranks of all captains?
Schema:
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT Name, Class, "Rank" FROM captain; |
Find the policy types more than 4 customers use. Show their type code.?
Schema:
- Available_Policies(COUNT, Customer_Phone, Life, policy_type_code) | SELECT policy_type_code FROM Available_Policies WHERE policy_type_code IS NOT NULL GROUP BY policy_type_code HAVING COUNT(*) > 4; |
What are all the characteristic names of product "sesame"?
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'; |
Show student ids who are female and play football.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID) | SELECT DISTINCT T1.StuID FROM Student AS T1 JOIN SportsInfo AS T2 ON T1.StuID = T2.StuID WHERE T1.Sex = 'F' AND T2.SportName = 'Football'; |
What are the names of all airports whose elevation is between -50 and 50?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT name FROM airports WHERE elevation BETWEEN -50 AND 50; |
What movies have the same director as the movie " Revolutionary Road " ?
Schema:
- director(Afghan, name, nationality)
- directed_by(...)
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) | SELECT T3.title FROM director AS T5 JOIN directed_by AS T2 ON T5.did = T2.did JOIN directed_by AS T1 ON T5.did = T1.did JOIN movie AS T4 ON T4.mid = T2.msid JOIN movie AS T3 ON T3.mid = T1.msid WHERE T4.title = 'Revolutionary Road'; |
Which events have the number of notes between one and three? List the event id and the property id.?
Schema:
- Customer_Events(Customer_Event_ID, date_moved_in, property_id)
- Customer_Event_Notes(...) | SELECT T1.Customer_Event_ID, T1.property_id FROM Customer_Events AS T1 JOIN Customer_Event_Notes AS T2 ON T1.Customer_Event_ID = T2.Customer_Event_ID GROUP BY T1.Customer_Event_ID, T1.Customer_Event_ID, T1.property_id HAVING COUNT(*) BETWEEN 1 AND 3; |
Show the investors shared by entrepreneurs that requested more than 140000 and entrepreneurs that requested less than 120000.?
Schema:
- entrepreneur(COUNT, Company, Investor, Money_Requested) | SELECT DISTINCT Investor FROM entrepreneur WHERE Money_Requested > 140000 OR Money_Requested < 120000; |
Give the average price and case of wines made from Zinfandel grapes in the year 2009.?
Schema:
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT AVG(Price) AS avg_price, AVG(Cases) AS avg_cases FROM wine WHERE "Year" = 2009 AND Grape = 'Zinfandel'; |
how many rivers are in the state with the largest population?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT COUNT(T2.river_name) AS num_rivers FROM river AS T2 JOIN state AS T1 ON T1.state_name = T2.traverse WHERE T1.state_name = (SELECT state_name FROM state WHERE population = (SELECT MAX(population) FROM state)); |
Show the distinct leader names of colleges associated with members from country "Canada".?
Schema:
- college(College_Location, Leader_Name)
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) | SELECT DISTINCT T1.Leader_Name FROM college AS T1 JOIN member_ AS T2 ON T1.College_ID = T2.College_ID WHERE T2.Country = 'Canada'; |
Find number of products which Sony does not make.?
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 COUNT(DISTINCT Name) AS num_products FROM Products WHERE Name NOT IN (SELECT T1.Name FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code WHERE T2.Name = 'Sony'); |
What are the total number of the audiences who visited any of the festivals?
Schema:
- festival_detail(Chair_Name, Festival_Name, Location, T1, Year) | SELECT SUM(Num_of_Audience) AS total_audiences FROM festival_detail; |
List the camera lens names containing substring "Digital".?
Schema:
- camera_lens(brand, name) | SELECT name FROM camera_lens WHERE name LIKE '%Digital%'; |
What are the names of all European countries with at least 3 manufacturers?
Schema:
- countries(...)
- continents(...)
- car_makers(...) | SELECT T1.CountryName FROM countries AS T1 JOIN continents AS T2 ON T1.Continent = T2.ContId JOIN car_makers AS T3 ON T1.CountryId = T3.CountryId WHERE T2.Continent = 'europe' GROUP BY T1.CountryName HAVING COUNT(*) >= 3; |
Please list all songs in volumes in ascending alphabetical order.?
Schema:
- volume(Artist_ID, Issue_Date, Song, Weeks_on_Top) | SELECT Song FROM volume ORDER BY Song ASC NULLS LAST; |
What are the names of gymnasts, ordered by their heights ascending?
Schema:
- gymnast(Floor_Exercise_Points, Horizontal_Bar_Points)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Height ASC NULLS LAST; |
List all vehicle id?
Schema:
- Vehicles(vehicle_details, vehicle_id) | SELECT vehicle_id FROM Vehicles; |
Count the number of customers who have an account.?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT COUNT(DISTINCT customer_id) AS num_customers FROM Accounts; |
What are the names of customers who have both savings and checking accounts?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) | SELECT DISTINCT T1.cust_name FROM customer AS T1 JOIN customer AS T2 ON T1.cust_name = T2.cust_name WHERE T1.acc_type = 'saving' AND T2.acc_type = 'checking'; |
return me the number of papers written by " H. V. Jagadish " and " Divesh Srivastava " before 2000 .?
Schema:
- writes(...)
- author(...)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT COUNT(DISTINCT T5.title) AS num_papers FROM writes AS T3 JOIN author AS T2 ON T3.aid = T2.aid JOIN publication AS T5 ON T3.pid = T5.pid JOIN writes AS T4 ON T4.pid = T5.pid JOIN author AS T1 ON T4.aid = T1.aid WHERE T2.name = 'H. V. Jagadish' AND T1.name = 'Divesh Srivastava' AND T5."year" < 2000; |
What are the names of organizations, ordered by the date they were formed, ascending?
Schema:
- Organizations(date_formed, organization_name) | SELECT organization_name FROM Organizations ORDER BY date_formed ASC NULLS LAST; |
What is the zip code of the customer Carole Bernhard?
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))
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = 'Carole' AND T1.last_name = 'Bernhard'; |
How many staff live in state Georgia?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT COUNT(*) AS num_staff FROM Addresses WHERE state_province_county = 'Georgia'; |
Show the minister who took office after 1961 or before 1959.?
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 Took_office > 1961 OR Took_office < 1959; |
Show the race class and number of races in each class.?
Schema:
- race(Class, Date, Name) | SELECT Class, COUNT(*) AS num_races FROM race GROUP BY Class; |
List in alphabetic order all different amenities.?
Schema:
- Dorm_amenity(amenity_name) | SELECT amenity_name FROM Dorm_amenity ORDER BY amenity_name ASC NULLS LAST; |
Find all the policy type codes associated with 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'; |
What are the first names of all teachers who have taught a course and the corresponding course codes?
Schema:
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) | SELECT T2.EMP_FNAME, T1.CRS_CODE FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM; |
What are the names of documents that contain the substring "CV"?
Schema:
- Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more)) | SELECT document_name FROM Documents WHERE document_name LIKE '%CV%'; |
Show the location codes with at least 3 documents.?
Schema:
- Document_Locations(COUNT, Date_in_Location_From, Date_in_Locaton_To, Location_Code) | SELECT Location_Code FROM Document_Locations WHERE Location_Code IS NOT NULL GROUP BY Location_Code HAVING COUNT(*) >= 3; |
What is the average edispl of the cars of model volvo?
Schema:
- car_names(COUNT, Model)
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year) | SELECT AVG(T2.Edispl) AS avg_edispl FROM car_names AS T1 JOIN cars_data AS T2 ON T1.MakeId = T2.Id WHERE T1.Model = 'volvo'; |
what is the state that contains the highest point?
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); |
What is the name of the department with the student that has the lowest 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 FROM STUDENT AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE ORDER BY STU_GPA ASC NULLS LAST LIMIT 1; |
Find the title of all the albums of the artist "AC/DC".?
Schema:
- Album(Title)
- Artist(Name) | SELECT Title FROM Album AS T1 JOIN Artist AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'AC/DC'; |
How many courses are provided in each semester and year?
Schema:
- section(COUNT, JO, Spr, T1, course_id, semester, year) | SELECT COUNT(*) AS num_courses, semester, "year" FROM section GROUP BY semester, "year"; |
List the information of all instructors ordered by their salary in ascending order.?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary) | SELECT * FROM instructor ORDER BY salary ASC NULLS LAST; |
How many events did not have any participants?
Schema:
- Events(...)
- Participants_in_Events(COUNT, Event_ID, Participant_ID) | SELECT COUNT(*) AS num_events FROM Events WHERE Event_ID NOT IN (SELECT Event_ID FROM Participants_in_Events); |
What are the ids and names of the architects who built at least 3 bridges ?
Schema:
- architect(gender, id, name, nationality)
- bridge(Ra, length_feet, location, name) | SELECT T1.id, T1.name FROM architect AS T1 JOIN bridge AS T2 ON T1.id = CAST(T2.architect_id AS TEXT) GROUP BY T1.id, T1.name HAVING COUNT(*) >= 3; |
Find the average and total capacity of dorms for the students with gender X.?
Schema:
- Dorm(dorm_name, gender, student_capacity) | SELECT AVG(student_capacity) AS avg_capacity, SUM(student_capacity) AS total_capacity FROM Dorm WHERE gender = 'X'; |
Show the pair of male and female names in all weddings after year 2014?
Schema:
- wedding(...)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T2.Name, T3.Name FROM wedding AS T1 JOIN people AS T2 ON T1.Male_ID = T2.People_ID JOIN people AS T3 ON T1.Female_ID = T3.People_ID WHERE T1."Year" > 2014; |
What are the names of the tourist attractions that can be accessed by bus?
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 Name FROM Tourist_Attractions WHERE How_to_Get_There = 'bus'; |
How many orders does Luca Mancini have in his invoices?
Schema:
- customers(Mart, city, company, country, email, first_name, last_name, phone, state)
- invoices(billing_city, billing_country, billing_state, total) | SELECT COUNT(*) AS num_orders FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = 'Lucas' AND T1.last_name = 'Mancini'; |
Find the name of the customer who made the most orders.?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Orders(customer_id, date_order_placed, order_id) | SELECT T1.customer_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id, T1.customer_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show the flight number of flights with three lowest distances.?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT flno FROM flight ORDER BY distance ASC NULLS LAST LIMIT 3; |
what are the highest points of all the states?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT highest_point FROM highlow; |
Return the type name, type description, and date of creation for each document.?
Schema:
- Ref_Document_Types(Document_Type_Code, Document_Type_Description, Document_Type_Name, document_type_code, document_type_description)
- 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.Document_Type_Name, T1.Document_Type_Description, T2.Document_Date FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code; |
Find the maximum and minimum millisecond lengths of pop tracks.?
Schema:
- Genre(Name)
- Track(Milliseconds, Name, UnitPrice) | SELECT MAX(Milliseconds) AS max_milliseconds, MIN(Milliseconds) AS min_milliseconds FROM Genre AS T1 JOIN Track AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Pop'; |
List the name and gender for all artists who released songs in March.?
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 T1.artist_name, T1.gender FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.releasedate LIKE '%Mar%'; |
Find the first name and last name for the "CTO" of the club "Hopkins Student Enterprises"?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn)
- Member_of_club(...)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT T3.Fname, T3.LName FROM Club AS T1 JOIN Member_of_club AS T2 ON T1.ClubID = T2.ClubID JOIN Student AS T3 ON T2.StuID = T3.StuID WHERE T1.ClubName = 'Hopkins Student Enterprises' AND T2."Position" = 'CTO'; |
What are the names of representatives whose party is not "Republican"?
Schema:
- representative(JO, Lifespan, Name, Party, State, T1) | SELECT Name FROM representative WHERE Party != 'Republican'; |
Who are the advisors for students that live in a city with city code "BAL"?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Advisor FROM Student WHERE city_code = 'BAL'; |
What are the first names of all the students?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT DISTINCT Fname FROM Student; |
Find all the songs that do not have a lead vocal.?
Schema:
- Vocals(COUNT, Type)
- Songs(Title) | SELECT DISTINCT Title FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Title NOT IN (SELECT T2.Title FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Type = 'lead'); |
I want the papers on keyphrase0 by brian curless?
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'; |
how many female dependents are there?
Schema:
- dependent(Dependent_name, Relationship, Sex) | SELECT COUNT(*) AS num_female_dependents FROM dependent WHERE Sex = 'F'; |
Count the total number of bookings made.?
Schema:
- Bookings(Actual_Delivery_Date, COUNT, Order_Date, Planned_Delivery_Date, Status_Code) | SELECT COUNT(*) AS num_bookings FROM Bookings; |
Which allergy type is most common?
Schema:
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT AllergyType FROM Allergy_Type WHERE AllergyType IS NOT NULL GROUP BY AllergyType ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are characteristic names used at least twice across all products?
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 GROUP BY T3.characteristic_name HAVING COUNT(*) >= 2; |
What are the first and last names of the artist who perfomed the song "Badlands"?
Schema:
- Performance(...)
- Band(...)
- Songs(Title) | SELECT T2.Firstname, T2.Lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = 'Badlands'; |
Show cinema name, film title, date, and price for each record in schedule.?
Schema:
- schedule(...)
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
- cinema(COUNT, Capacity, Location, Name, Openning_year, T1, c) | SELECT T3.Name, T2.Title, T1."Date", T1.Price FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID; |
What are the product ids for the problems reported by Christop Berge with closure authorised by Ashley Medhurst?
Schema:
- Problems(date_problem_reported, problem_id)
- 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.product_id FROM Problems AS T1 JOIN Staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = 'Christop' AND T2.staff_last_name = 'Berge' AND EXISTS (SELECT 1 FROM Problems AS T3 JOIN Staff AS T4 ON T3.closure_authorised_by_staff_id = T4.staff_id WHERE T4.staff_first_name = 'Ashley' AND T4.staff_last_name = 'Medhurst' AND T1.product_id = T3.product_id); |
How many customers have an account?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT COUNT(DISTINCT customer_id) AS num_customers FROM Accounts; |
where is a good arabic restaurant on buchanan 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 T2.street_name = 'buchanan' 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.