question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
Find the name and location of the stadiums which some concerts happened in the years of both 2014 and 2015.?
Schema:
- concert(COUNT, Year)
- stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1) | SELECT T2.Name, T2.Location FROM concert AS T1 JOIN stadium AS T2 ON T1.Stadium_ID = T2.Stadium_ID WHERE T1."Year" = 2014 AND EXISTS (SELECT 1 FROM concert AS T3 JOIN stadium AS T4 ON T3.Stadium_ID = T4.Stadium_ID WHERE T3."Year" = 2015 AND T4.Name = T2.Name AND T4.Location = T2.Location); |
What are the different driver ids and nationalities of all drivers who had a laptime of more than 100000 milliseconds?
Schema:
- drivers(forename, nationality, surname)
- lapTimes(...) | SELECT DISTINCT T1.driverId, T1.nationality FROM drivers AS T1 JOIN lapTimes AS T2 ON T1.driverId = T2.driverId WHERE T2.milliseconds > 100000; |
Find the city and state of the bank branch named morningside.?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state) | SELECT city, state FROM bank WHERE bname = 'morningside'; |
Return the names of teams that have no match season record.?
Schema:
- team(Name)
- match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team) | SELECT Name FROM team WHERE Team_id NOT IN (SELECT Team FROM match_season); |
What is the average speed of roller coasters?
Schema:
- roller_coaster(DOUBLE, Height, LENGTH, Park, Speed, Status, TRY_CAST) | SELECT AVG(TRY_CAST(Speed AS DOUBLE)) AS avg_speed FROM roller_coaster; |
Count the number of customers.?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT COUNT(*) AS num_customers FROM Customers; |
how many papers has Christopher D. Manning published ?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT COUNT(DISTINCT T2.paperId) AS num_papers FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'Christopher D. Manning'; |
What is average number of students enrolled in Florida colleges?
Schema:
- College(M, cName, enr, state) | SELECT AVG(enr) AS avg_enr FROM College WHERE state = 'FL'; |
how many people live in the capital of texas?
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 population FROM city WHERE city_name = (SELECT capital FROM state WHERE state_name = 'texas'); |
How many businesses are there in the " Stone Meadows " neighbourhood in Madison ?
Schema:
- neighbourhood(...)
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT COUNT(DISTINCT T1.name) AS num_businesses FROM neighbourhood AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T1.city = 'Madison' AND T2.neighbourhood_name = 'Stone Meadows'; |
What is the description for the results whose project detail is 'sint'?
Schema:
- Research_Outcomes(...)
- Project_Outcomes(outcome_code)
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT T1.outcome_description FROM Research_Outcomes AS T1 JOIN Project_Outcomes AS T2 ON T1.outcome_code = T2.outcome_code JOIN Projects AS T3 ON T2.project_id = T3.project_id WHERE T3.project_details = 'sint'; |
Which committees have delegates from the Democratic party?
Schema:
- election(Committee, Date, Delegate, District, Vote_Percent, Votes)
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more)) | SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = 'Democratic'; |
Find the number of distinct room types available.?
Schema:
- Room(BlockCode, RoomType, Unavailable) | SELECT COUNT(DISTINCT RoomType) AS num_room_types FROM Room; |
How long is the total lesson time took by the customer named Rylan Goodwin?
Schema:
- Lessons(lesson_status_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 SUM(TRY_CAST(T1.lesson_time AS DOUBLE)) AS total_lesson_time FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Rylan' AND T2.last_name = 'Goodwin'; |
Find all actors born in " Austin " 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_city = 'Austin' AND birth_year > 1980; |
how big is new mexico?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT area FROM state WHERE state_name = 'new mexico'; |
What categories have two or more corresponding books that were made after 1989?
Schema:
- book_club(Author_or_Editor, Book_Title, COUNT, Category, Publ, Publisher, T1) | SELECT Category FROM book_club WHERE "Year" > 1989 AND Category IS NOT NULL GROUP BY Category HAVING COUNT(*) >= 2; |
What are the names of the albums that have more than 10 tracks?
Schema:
- albums(I, title)
- tracks(composer, milliseconds, name, unit_price) | SELECT T1.title FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.album_id GROUP BY T1.id, T1.title HAVING COUNT(T1.id) > 10; |
What is the average number of stars that each reviewer awards for a movie?
Schema:
- Rating(Rat, mID, rID, stars)
- Reviewer(Lew, name, rID) | SELECT T2.name, AVG(T1.stars) AS avg_stars FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name; |
Give the state that has the most customers.?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) | SELECT state FROM Customers WHERE state IS NOT NULL GROUP BY state ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
What are the email addresses and date of births for all customers who have a first name of 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'; |
List the dates of enrollment and completion of the student with family name "Zieme" and personal name "Bernie".?
Schema:
- Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id)
- 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 T1.date_of_enrolment, T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.family_name = 'Zieme' AND T2.personal_name = 'Bernie'; |
What are the names of the singers who performed in a concert in 2014?
Schema:
- singer_in_concert(...)
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
- concert(COUNT, Year) | SELECT T2.Name FROM singer_in_concert AS T1 JOIN singer AS T2 ON T1.Singer_ID = T2.Singer_ID JOIN concert AS T3 ON T1.concert_ID = T3.concert_ID WHERE T3."Year" = 2014; |
Which cmi cross reference id is not related to any parking taxes?
Schema:
- CMI_Cross_References(source_system_code)
- Parking_Fines(cmi_cross_ref_id, council_tax_id) | SELECT cmi_cross_ref_id FROM CMI_Cross_References WHERE cmi_cross_ref_id NOT IN(SELECT cmi_cross_ref_id FROM Parking_Fines); |
What are the names of conductors, sorted descending by the number of years they have worked?
Schema:
- conductor(Age, Name, Nationality, Year_of_Work) | SELECT Name FROM conductor ORDER BY Year_of_Work DESC NULLS LAST; |
Which programs are never broadcasted in the morning? Give me the names of the programs.?
Schema:
- program(Beij, Launch, Name, Origin, Owner)
- broadcast(Program_ID, Time_of_day) | SELECT DISTINCT Name FROM program WHERE Name NOT IN (SELECT T1.Name FROM program AS T1 JOIN broadcast AS T2 ON T1.Program_ID = T2.Program_ID WHERE T2.Time_of_day = 'Morning'); |
Find the id and forenames of drivers who participated both the races with name Australian Grand Prix and the races with name Chinese Grand Prix?
Schema:
- races(date, name)
- results(...)
- drivers(forename, nationality, surname) | 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 IN ('Australian Grand Prix', 'Chinese Grand Prix') GROUP BY T2.driverId, T3.forename HAVING COUNT(DISTINCT T1.name) = 2; |
Find the id and cell phone of the professionals who operate two or more types of treatments.?
Schema:
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street)
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT T1.professional_id, T1.cell_number FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id, T1.cell_number HAVING COUNT(*) >= 2; |
Show template ids, version numbers, and template type codes for all templates.?
Schema:
- Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number) | SELECT Template_ID, Version_Number, Template_Type_Code FROM Templates; |
What is the last name of the student who received an A in the class with the code 10018?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
- ENROLL(...) | SELECT T1.STU_LNAME FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM WHERE T2.ENROLL_GRADE = 'A' AND T2.CLASS_CODE = '10018'; |
Show last names for all student who are on scholarship.?
Schema:
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT T2.LName FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.OnScholarship = 'Y'; |
Which people severed as comptroller most frequently? Give me the name of the person and the frequency count.?
Schema:
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more)) | SELECT Comptroller, COUNT(*) AS num_comptrollers FROM party WHERE Comptroller IS NOT NULL GROUP BY Comptroller ORDER BY num_comptrollers DESC NULLS LAST LIMIT 1; |
What are the different film Directors?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) | SELECT DISTINCT Director FROM film; |
Find the list of distinct ranks for faculty.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT DISTINCT "Rank" FROM Faculty; |
What are the themes and years for exhibitions, sorted by ticket price descending?
Schema:
- exhibition(Theme, Ticket_Price, Year) | SELECT Theme, "Year" FROM exhibition ORDER BY Ticket_Price DESC NULLS LAST; |
What is the alphabetically ordered list of all distinct medications?
Schema:
- Medication(Name) | SELECT DISTINCT Name FROM Medication ORDER BY Name ASC NULLS LAST; |
What are the names of all females who are friends with Zach?
Schema:
- Person(M, age, city, eng, gender, job, name)
- PersonFriend(M, friend, name) | SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Zach' AND T1.gender = 'female'; |
Find all the payment dates for the payments with an amount larger than 10 and the payments handled by a staff person with the first name Elsa.?
Schema:
- payment(amount, payment_date)
- staff(...) | SELECT DISTINCT payment_date FROM (SELECT payment_date FROM payment WHERE amount > 10 UNION ALL SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa'); |
Show the names of roller coasters and names of country they are in.?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- roller_coaster(DOUBLE, Height, LENGTH, Park, Speed, Status, TRY_CAST) | SELECT T2.Name, T1.Name FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID; |
how many people live in seattle washington?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT population FROM city WHERE city_name = 'seattle' AND state_name = 'washington'; |
what are the collaborations of Peter Mertens and Dina Barbian ?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT T3.paperId 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 = 'Peter Mertens' AND T1.authorName = 'Dina Barbian'; |
What is the name of the movie that has been reviewed the most?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year) | SELECT T2.title, T1.mID FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID, T2.title ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many businesses has Michelle reviewed in 2010 ?
Schema:
- review(i_id, rank, rating, text)
- business(business_id, city, full_address, name, rating, review_count, state)
- user_(name) | SELECT COUNT(DISTINCT T1.name) AS num_businesses FROM review AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN user_ AS T3 ON T3.user_id = T2.user_id WHERE T2."year" = 2010 AND T3.name = 'Michelle'; |
What is the number of faculty lines in campus "Long Beach State University" in 2002?
Schema:
- faculty(Faculty)
- Campuses(Campus, County, Franc, Location) | SELECT Faculty FROM faculty AS T1 JOIN Campuses AS T2 ON T1.Campus = T2.Id WHERE T1."Year" = 2002 AND T2.Campus = 'Long Beach State University'; |
Find the name of players whose card is yes in the descending order of training hours.?
Schema:
- Player(HS, pName, weight, yCard) | SELECT pName FROM Player WHERE yCard = 'yes' ORDER BY HS DESC NULLS LAST; |
What is the maximum fastest lap speed in race named 'Monaco Grand Prix' in 2008 ?
Schema:
- races(date, name)
- results(...) | SELECT MAX(TRY_CAST(T2.fastestLapSpeed AS DOUBLE)) AS max_speed FROM races AS T1 JOIN results AS T2 ON T1.raceId = T2.raceId WHERE T1."year" = 2008 AND T1.name = 'Monaco Grand Prix'; |
What is the maximum fastest lap speed in the Monaco Grand Prix in 2008?
Schema:
- races(date, name)
- results(...) | SELECT MAX(TRY_CAST(T2.fastestLapSpeed AS DOUBLE)) AS max_speed FROM races AS T1 JOIN results AS T2 ON T1.raceId = T2.raceId WHERE T1."year" = 2008 AND T1.name = 'Monaco Grand Prix'; |
What is the name of the department that offers a course that has a description including the word "Statistics"?
Schema:
- COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT T2.DEPT_NAME FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE WHERE T1.CRS_DESCRIPTION LIKE '%Statistics%'; |
What papers have been written by both Peter Mertens and Dina Barbian ?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT T3.paperId 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 = 'Peter Mertens' AND T1.authorName = 'Dina Barbian'; |
Return the names of songs for which format is mp3 and resolution is below 1000.?
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 T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp3' AND T2.resolution < 1000; |
What are the names and grades for each high schooler?
Schema:
- Highschooler(COUNT, ID, grade, name) | SELECT name, grade FROM Highschooler; |
most recent papers by oren etzioni?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT T2.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 = 'oren etzioni' GROUP BY T2.paperId, T3."year" ORDER BY T3."year" DESC NULLS LAST; |
state the state with the largest area?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state); |
what is the capital of texas?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT capital FROM state WHERE state_name = 'texas'; |
How many students are not involved in any behavior incident?
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))
- Behavior_Incident(NO, date_incident_end, date_incident_start, incident_type_code) | SELECT COUNT(*) AS num_students FROM Students WHERE student_id NOT IN (SELECT student_id FROM Behavior_Incident); |
Find the cell mobile number of the candidates whose assessment code is "Fail"?
Schema:
- Candidates(...)
- Candidate_Assessments(asessment_outcome_code, assessment_date, candidate_id)
- People(first_name) | SELECT T3.cell_mobile_number FROM Candidates AS T1 JOIN Candidate_Assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN People AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = 'Fail'; |
Show the most common nationality for journalists.?
Schema:
- journalist(Age, COUNT, Name, Nationality, T1, Years_working) | SELECT Nationality FROM journalist WHERE Nationality IS NOT NULL GROUP BY Nationality ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
List the 3 highest salaries of the players in 2001?
Schema:
- salary(salary) | SELECT salary FROM salary WHERE "year" = 2001 ORDER BY salary DESC NULLS LAST LIMIT 3; |
What is the total salary paid by team Boston Red Stockings in 2010?
Schema:
- salary(salary)
- team(Name) | SELECT SUM(T1.salary) AS total_salary FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1."year" = 2010; |
How many professionals have performed any treatment to dogs?
Schema:
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT COUNT(DISTINCT professional_id) AS num_professionals FROM Treatments; |
papers on TAIL NIPS?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- venue(venueId, venueName) | 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 JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.keyphraseName = 'TAIL' AND T4.venueName = 'NIPS'; |
What is the location of the festival with the largest number of audience?
Schema:
- festival_detail(Chair_Name, Festival_Name, Location, T1, Year) | SELECT Location FROM festival_detail ORDER BY Num_of_Audience DESC NULLS LAST LIMIT 1; |
What are the headquarters without companies that are 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 DISTINCT T1.Headquarters FROM company AS T1 LEFT JOIN company AS T2 ON T1.Headquarters = T2.Headquarters AND T2.Main_Industry = 'Banking' WHERE T2.Headquarters IS NULL; |
what papers did chi publish ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T1.paperId FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T2.venueName = 'chi'; |
What are the names of all movies that received 3 or 4 stars?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year) | SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars IN (3, 4) GROUP BY T2.title HAVING COUNT(DISTINCT T1.stars) = 2; |
Journal Papers by mohammad rastegari?
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 = 'mohammad rastegari' AND T3.journalId >= 0; |
Return the last name of the staff member who handled the complaint with the earliest date raised.?
Schema:
- Staff(COUNT, Name, Other_Details, date_joined_staff, date_left_staff, date_of_birth, email_address, first_name, gender, last_name, middle_name, nickname)
- Complaints(complaint_status_code, complaint_type_code) | SELECT T1.last_name FROM Staff AS T1 JOIN Complaints AS T2 ON T1.staff_id = T2.staff_id ORDER BY T2.date_complaint_raised ASC NULLS LAST LIMIT 1; |
How many hours do the students spend studying in each department?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE) | SELECT SUM(STU_HRS) AS total_hours, DEPT_CODE FROM STUDENT GROUP BY DEPT_CODE; |
Find the last name and age of the student who has allergy to both milk and cat.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Allergy(Allergy, COUNT, StuID) | SELECT LName, Age FROM Student WHERE StuID IN (SELECT DISTINCT T1.StuID FROM (SELECT StuID FROM Has_Allergy WHERE Allergy = 'Milk') T1, (SELECT StuID FROM Has_Allergy WHERE Allergy = 'Cat') AS T2 WHERE T1.StuID = T2.StuID); |
List the names of all the distinct product names in alphabetical order?
Schema:
- Product(product_id, product_name) | SELECT DISTINCT product_name FROM Product ORDER BY product_name ASC NULLS LAST; |
What papers has Liwen Xiong written in 2015?
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; |
Which institution has the most papers? Find the name of the institution.?
Schema:
- Inst(...)
- Authorship(...)
- Papers(title) | SELECT T1.name FROM Inst AS T1 JOIN Authorship AS T2 ON T1.instID = T2.instID JOIN Papers AS T3 ON T2.paperID = T3.paperID GROUP BY T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the duration of the oldest actor?
Schema:
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT Duration FROM actor ORDER BY age DESC NULLS LAST LIMIT 1; |
How many department stores does the store chain South have?
Schema:
- Department_Stores(COUNT, dept_store_chain_id)
- Department_Store_Chain(...) | SELECT COUNT(*) AS num_department_stores FROM Department_Stores AS T1 JOIN Department_Store_Chain AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id WHERE T2.dept_store_chain_name = 'South'; |
What is the number of employees from each city?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) | SELECT COUNT(*) AS num_employees, City FROM employee GROUP BY City; |
Find the salary and manager number for those employees who is working under a manager.?
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 SALARY, MANAGER_ID FROM employees WHERE MANAGER_ID IS NOT NULL; |
Count the number of documents that do not have expenses.?
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 COUNT(*) AS num_documents FROM Documents WHERE Document_ID NOT IN (SELECT Document_ID FROM Documents_with_Expenses); |
What is id of the city that hosted events in the most recent year?
Schema:
- hosting_city(Host_City, Year) | SELECT Host_City FROM hosting_city ORDER BY "Year" DESC NULLS LAST LIMIT 1; |
How many flights land in Aberdeen or Abilene?
Schema:
- flights(DestAirport, FlightNo, SourceAirport)
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT COUNT(*) AS num_flights FROM flights AS T1 JOIN airports AS T2 ON T1.DestAirport = T2.AirportCode WHERE T2.City = 'Aberdeen' OR T2.City = 'Abilene'; |
What amenities does Smith Hall have in alphabetical order?
Schema:
- Dorm(dorm_name, gender, student_capacity)
- Has_amenity(dormid)
- Dorm_amenity(amenity_name) | SELECT T3.amenity_name FROM Dorm AS T1 JOIN Has_amenity AS T2 ON T1.dormid = T2.dormid JOIN Dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' ORDER BY T3.amenity_name ASC NULLS LAST; |
How many students are advised by each rank of faculty? List the rank and the number of students.?
Schema:
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT T1."Rank", COUNT(*) AS num_students FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1."Rank"; |
What are the descriptions for each color?
Schema:
- Ref_Colors(color_description) | SELECT color_description FROM Ref_Colors; |
What are the different main industries for all companies?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT DISTINCT Main_Industry FROM company; |
What are the distinct unit prices of all tracks?
Schema:
- Track(Milliseconds, Name, UnitPrice) | SELECT DISTINCT UnitPrice FROM Track; |
Please show the employee first names and ids of employees who serve at least 10 customers.?
Schema:
- Customer(Email, FirstName, LastName, State, lu)
- Employee(BirthDate, City, FirstName, LastName, Phone) | SELECT T1.FirstName, T1.SupportRepId FROM Customer AS T1 JOIN Employee AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.FirstName, T1.SupportRepId HAVING COUNT(*) >= 10; |
What is the id and name of the aircraft that can cover the maximum distance?
Schema:
- aircraft(Description, aid, d, distance, name) | SELECT aid, name FROM aircraft ORDER BY distance DESC NULLS LAST LIMIT 1; |
What are the first name and last name of the professionals who have done treatment with cost below average?
Schema:
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street)
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT DISTINCT T1.first_name, T1.last_name FROM Professionals AS T1 NATURAL JOIN Treatments AS T2 WHERE cost_of_treatment < (SELECT AVG(cost_of_treatment) FROM Treatments); |
find the number of escape games in Madison?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state) | SELECT COUNT(DISTINCT T1.name) AS num_escape_games FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T1.city = 'Madison' AND T2.category_name = 'escape games'; |
sharon goldwater 's papers?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT T2.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'sharon goldwater'; |
what is the state with the largest area?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state); |
List the dates of games by the home team name in descending order.?
Schema:
- game(Date, Home_team, Season) | SELECT "Date" FROM game ORDER BY Home_team DESC NULLS LAST; |
How many donors have endowment for school named "Glenn"?
Schema:
- endowment(School_id, amount, donator_name)
- School(County, Enrollment, Location, Mascot, School_name) | SELECT COUNT(DISTINCT T1.donator_name) AS num_donors FROM endowment AS T1 JOIN School AS T2 ON CAST(T1.School_id AS TEXT) = T2.School_id WHERE T2.School_name = 'Glenn'; |
Which breed do the most dogs have? Give me the breed name.?
Schema:
- Breeds(...)
- Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight) | SELECT T1.breed_name FROM Breeds AS T1 JOIN Dogs AS T2 ON T1.breed_code = T2.breed_code GROUP BY T1.breed_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Which customers have made at least two orders? Give me each customer name and number of orders made.?
Schema:
- Orders(customer_id, date_order_placed, order_id)
- 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.customer_name, COUNT(*) AS num_orders FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id, T2.customer_name HAVING COUNT(*) >= 2; |
Find all airlines that have flights from airport 'CVO' but not from 'APG'.?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT DISTINCT T1.Airline FROM airlines AS T1 JOIN flights AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'CVO' AND T1.Airline NOT IN (SELECT T1.Airline FROM airlines AS T1 JOIN flights AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport = 'APG'); |
What is the name and country of origin of the artist who released a song that has "love" in its title?
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.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.song_name LIKE '%love%'; |
What are the names of players who train between 500 and 1500 hours?
Schema:
- Player(HS, pName, weight, yCard) | SELECT pName FROM Player WHERE HS BETWEEN 500 AND 1500; |
where is the director of " The Past " from?
Schema:
- director(Afghan, name, nationality)
- directed_by(...)
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) | SELECT T2.birth_city FROM director AS T2 JOIN directed_by AS T1 ON T2.did = T1.did JOIN movie AS T3 ON T3.mid = T1.msid WHERE T3.title = 'The Past'; |
How many undergraduates are there at San Jose State?
Schema:
- discipline_enrollments(...)
- Campuses(Campus, County, Franc, Location) | SELECT SUM(T1.Undergraduate) AS num_undergraduates FROM discipline_enrollments AS T1 JOIN Campuses AS T2 ON T1.Campus = T2.Id WHERE T2.Campus = 'San Jose State University'; |
On what dates did the student whose personal name is "Karson" enroll in and complete the courses?
Schema:
- Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id)
- 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 T1.date_of_enrolment, T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = 'Karson'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.