question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
List all program origins in the alphabetical order.?
Schema:
- program(Beij, Launch, Name, Origin, Owner) | SELECT Origin FROM program ORDER BY Origin ASC NULLS LAST; |
How many students are there in total?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT COUNT(*) AS num_students FROM Student; |
What is the id and name of the browser that is compatible with the most web accelerators?
Schema:
- browser(id, market_share, name)
- accelerator_compatible_browser(...) | SELECT T1.id, T1.name FROM browser AS T1 JOIN accelerator_compatible_browser AS T2 ON T1.id = T2.browser_id GROUP BY T1.id, T1.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the number of movies featuring " Shahab Hosseini " ?
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'; |
Count the number of patients who stayed in room 112.?
Schema:
- Stay(Patient, Room, StayStart) | SELECT COUNT(Patient) AS num_patients FROM Stay WHERE Room = 112; |
what is the lowest point in the united states?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT lowest_point FROM highlow WHERE lowest_elevation = (SELECT MIN(lowest_elevation) FROM highlow); |
Find the number of different airports which are the destinations of the American Airlines.?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- routes(...) | SELECT COUNT(DISTINCT dst_apid) AS num_airports FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid WHERE T1.name = 'American Airlines'; |
what are the lakes in states bordering texas?
Schema:
- lake(lake_name, state_name)
- border_info(T1, border, state_name) | SELECT lake_name FROM lake WHERE state_name IN (SELECT border FROM border_info WHERE state_name = 'texas'); |
What are the ids of all trips that had a duration as long as the average trip duration in the zip code 94103?
Schema:
- trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code) | SELECT id FROM trip WHERE duration >= (SELECT AVG(duration) FROM trip WHERE zip_code = 94103); |
which is the smallest state?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM state WHERE area = (SELECT MIN(area) FROM state); |
Find the number of different products that are produced by companies at different headquarter cities.?
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 T1.Name) AS num_products, T2.Headquarter FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter; |
What is the position that is most common among players in match seasons?
Schema:
- match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team) | SELECT "Position" FROM match_season GROUP BY "Position" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the top 10 customers' first and last names with the highest gross sales, and also what are the sales?
Schema:
- customers(Mart, city, company, country, email, first_name, last_name, phone, state)
- invoices(billing_city, billing_country, billing_state, total) | SELECT T1.first_name, T1.last_name, SUM(T2.total) AS total_sales FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id, T1.first_name, T1.last_name ORDER BY total_sales DESC NULLS LAST LIMIT 10; |
List the nations that have more than two ships.?
Schema:
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT Nationality FROM ship WHERE Nationality IS NOT NULL GROUP BY Nationality HAVING COUNT(*) > 2; |
What are the names of the physician who prescribed the highest dose?
Schema:
- Physician(I, Name)
- Prescribes(...) | SELECT T1.Name FROM Physician AS T1 JOIN Prescribes AS T2 ON T1.EmployeeID = T2.Physician ORDER BY T2.Dose DESC NULLS LAST LIMIT 1; |
Show the ids of all employees who have destroyed a document.?
Schema:
- Documents_to_be_Destroyed(Destroyed_by_Employee_ID, Destruction_Authorised_by_Employee_ID) | SELECT DISTINCT Destroyed_by_Employee_ID FROM Documents_to_be_Destroyed; |
Authors of papers on sensor fusion?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- writes(...)
- author(...) | SELECT DISTINCT T1.authorName FROM paperKeyphrase AS T2 JOIN keyphrase AS T4 ON T2.keyphraseId = T4.keyphraseId JOIN writes AS T3 ON T3.paperId = T2.paperId JOIN author AS T1 ON T3.authorId = T1.authorId WHERE T4.keyphraseName LIKE 'sensor fusion'; |
when were most NIPS papers published ?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(T1.paperId) AS num_papers, T1."year" FROM venue AS T2 JOIN paper AS T1 ON T2.venueId = T1.venueId WHERE T2.venueName = 'NIPS' GROUP BY T1."year" ORDER BY num_papers DESC NULLS LAST; |
List the names of perpetrators in descending order of the year.?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- perpetrator(Country, Date, Injured, Killed, Location, Year) | SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2."Year" DESC NULLS LAST; |
What are the speeds of the longest roller coaster?
Schema:
- roller_coaster(DOUBLE, Height, LENGTH, Park, Speed, Status, TRY_CAST) | SELECT Speed FROM roller_coaster ORDER BY LENGTH DESC NULLS LAST LIMIT 1; |
What are the codes corresponding to document types for which there are less than 3 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 Document_Type_Code FROM Documents WHERE Document_Type_Code IS NOT NULL GROUP BY Document_Type_Code HAVING COUNT(*) < 3; |
Count the number of products in the category 'Seeds'.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT COUNT(*) AS num_products FROM Products WHERE product_category_code = 'Seeds'; |
what is the lowest point in iowa?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT lowest_point FROM highlow WHERE state_name = 'iowa'; |
papers in semantic parsing for each year?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(T3.paperId) AS num_papers, T3."year" 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 = 'semantic parsing' GROUP BY T3."year" ORDER BY T3."year" DESC NULLS LAST; |
What papers were published at CVPR in 2016 about Class consistent multi-modal fusion with binary features applied to RGB-D Object Dataset ?
Schema:
- paperDataset(...)
- dataset(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- venue(venueId, venueName) | SELECT DISTINCT T3.paperId FROM paperDataset AS T2 JOIN dataset AS T1 ON T2.datasetId = T1.datasetId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.datasetName = 'RGB-D Object Dataset' AND T3.title = 'Class consistent multi-modal fusion with binary features' AND T3."year" = 2016 AND T4.venueName = 'CVPR'; |
what is the highest mountain in us?
Schema:
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more)) | SELECT mountain_name FROM mountain WHERE mountain_altitude = (SELECT MAX(mountain_altitude) FROM mountain); |
What are the names of all the playlists?
Schema:
- playlists(name) | SELECT name FROM playlists; |
How many distinct countries are the climbers from?
Schema:
- climber(Country, K, Name, Points) | SELECT COUNT(DISTINCT Country) AS num_countries FROM climber; |
What are the first names of all students who got a grade C in a class?
Schema:
- STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
- ENROLL(...) | SELECT DISTINCT STU_FNAME FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM WHERE ENROLL_GRADE = 'C'; |
List the names and the locations that the enzymes can make an effect.?
Schema:
- enzyme(Chromosome, Location, OMIM, Porphyria, Product, name) | SELECT name, Location FROM enzyme; |
which states border the state with the smallest area?
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 border FROM border_info WHERE state_name = (SELECT state_name FROM state WHERE area = (SELECT MIN(area) FROM state)); |
How many kids stay in the rooms reserved by ROY SWEAZY?
Schema:
- Reservations(Adults, CheckIn, FirstName, Kids, LastName) | SELECT Kids FROM Reservations WHERE FirstName = 'ROY' AND LastName = 'SWEAZY'; |
What is the name of all tracks in the Rock genre?
Schema:
- genres(name)
- tracks(composer, milliseconds, name, unit_price) | SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = 'Rock'; |
acl 2016 authors?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT T1.authorId FROM venue AS T3 JOIN paper AS T2 ON T3.venueId = T2.venueId JOIN writes AS T1 ON T1.paperId = T2.paperId WHERE T2."year" = 2016 AND T3.venueName = 'acl'; |
monte carlo simulation papers later than 2011?
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 = 'monte carlo simulation' AND T3."year" > 2011; |
Find the locations where have both tracks with more than 90000 seats and tracks with less than 70000 seats.?
Schema:
- track(Location, Name, Seat, Seating, T1, Year_Opened) | SELECT DISTINCT T1.Location FROM (SELECT Location FROM track WHERE Seating > 90000) T1, (SELECT Location FROM track WHERE Seating < 70000) AS T2 WHERE T1.Location = T2.Location; |
What are the different regions of clubs in ascending alphabetical order?
Schema:
- club(Region, Start_year, name) | SELECT DISTINCT Region FROM club ORDER BY Region ASC NULLS LAST; |
Which building does the instructor who teaches the most number of courses live in?
Schema:
- Course(CName, Credits, Days)
- Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) | SELECT T2.Building FROM Course AS T1 JOIN Faculty AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor, T2.Building ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show the country names and the corresponding number of players.?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team) | SELECT Country_name, COUNT(*) AS num_players FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country GROUP BY T1.Country_name; |
return me the conference that has the most number of papers containing keyword " Relational Database " .?
Schema:
- publication_keyword(...)
- keyword(keyword)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- conference(homepage, name) | SELECT T2.name FROM publication_keyword AS T4 JOIN keyword AS T1 ON T4.kid = T1.kid JOIN publication AS T3 ON T3.pid = T4.pid JOIN conference AS T2 ON T3.cid = CAST(T2.cid AS TEXT) WHERE T1.keyword = 'Relational Database' GROUP BY T2.name ORDER BY COUNT(DISTINCT T3.title) DESC NULLS LAST LIMIT 1; |
What are all the distinct premise types?
Schema:
- Premises(premise_details, premises_type) | SELECT DISTINCT premises_type FROM Premises; |
List each charge type and its amount.?
Schema:
- Charges(charge_amount, charge_type) | SELECT charge_type, charge_amount FROM Charges; |
How many professors attained either Ph.D. or Masters degrees?
Schema:
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) | SELECT COUNT(*) AS num_professors FROM PROFESSOR WHERE PROF_HIGH_DEGREE = 'Ph.D.' OR PROF_HIGH_DEGREE = 'MA'; |
What is the name of the oldest student?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT name FROM Person WHERE job = 'student' AND age = (SELECT MAX(age) FROM Person WHERE job = 'student'); |
What are the names of all races held between 2009 and 2011?
Schema:
- races(date, name) | SELECT name FROM races WHERE "year" BETWEEN 2009 AND 2011; |
What are the heights of body builders with total score smaller than 315?
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.Height FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total < 315; |
What is the nickname of the employee named Janessa Sawayn?
Schema:
- Staff(COUNT, Name, Other_Details, date_joined_staff, date_left_staff, date_of_birth, email_address, first_name, gender, last_name, middle_name, nickname) | SELECT nickname FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'; |
Give the mean life expectancy of countries in which English is not the official language.?
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 AVG(LifeExpectancy) AS avg_life_expectancy FROM country WHERE Name NOT IN (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" = 'English' AND T2.IsOfficial = 'T'); |
How many languages are spoken in Aruba?
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(T2."Language") AS num_languages FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Aruba'; |
Which authors with submissions are from college "Florida" or "Temple"?
Schema:
- submission(Author, COUNT, College, Scores) | SELECT Author FROM submission WHERE College = 'Florida' OR College = 'Temple'; |
Find the players' first name and last name who won award both in 1960 and in 1961.?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
- player_award(...) | SELECT T1.name_first, T1.name_last FROM player AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id WHERE T2."year" IN (1960, 1961) GROUP BY T1.name_first, T1.name_last HAVING COUNT(DISTINCT T2."year") = 2; |
Give the city that the student whose family name is Kim lives in.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT city_code FROM Student WHERE LName = 'Kim'; |
Find the total budgets of the Marketing or Finance department.?
Schema:
- department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name) | SELECT SUM(budget) AS total_budget FROM department WHERE dept_name = 'Marketing' OR dept_name = 'Finance'; |
Return the claim start date for the claims whose claimed amount is no more than the average?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled) | SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= (SELECT AVG(Amount_Settled) FROM Claims); |
Find the total revenue of companies of each founder.?
Schema:
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT SUM(Revenue) AS total_revenue, Founder FROM Manufacturers GROUP BY Founder; |
How many different source system code for the cmi cross references are there?
Schema:
- CMI_Cross_References(source_system_code) | SELECT COUNT(DISTINCT source_system_code) AS num_source_system_codes FROM CMI_Cross_References; |
Find all reviews by Patrick with a rating above 4?
Schema:
- user_(name)
- review(i_id, rank, rating, text) | SELECT T1."text" FROM user_ AS T2 JOIN review AS T1 ON T2.user_id = T1.user_id WHERE T1.rating > 4 AND T2."name" = 'Patrick'; |
What are the first names of students studying in room 107?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName) | SELECT DISTINCT FirstName FROM list WHERE Classroom = 107; |
Show the average amount of transactions with type code "SALE".?
Schema:
- Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code) | SELECT AVG(amount_of_transaction) AS avg_amount_of_transaction FROM Transactions WHERE transaction_type_code = 'SALE'; |
Return the maximum and minimum customer codes.?
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 MAX(TRY_CAST(customer_code AS BIGINT)) AS max_customer_code, MIN(TRY_CAST(customer_code AS BIGINT)) AS min_customer_code FROM Customers; |
Which course authors teach two or more courses? Give me their addresses and author IDs.?
Schema:
- Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name)
- Courses(course_description, course_name) | SELECT T1.address_line_1, T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id, T1.address_line_1 HAVING COUNT(*) >= 2; |
Find the name of the company that has the least number of phone models. List the company name and the number of phone model produced by that company.?
Schema:
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) | SELECT Company_name, COUNT(*) AS num_phone_models FROM phone GROUP BY Company_name ORDER BY num_phone_models ASC NULLS LAST LIMIT 1; |
List the papers that used WebKB dataset?
Schema:
- paperDataset(...)
- dataset(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId FROM paperDataset AS T2 JOIN dataset AS T1 ON T2.datasetId = T1.datasetId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.datasetName = 'WebKB'; |
What are the names of the airports in the city of Goroka?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT name FROM airports WHERE city = 'Goroka'; |
Find the first and last names of people who payed more than the rooms' base prices.?
Schema:
- Reservations(Adults, CheckIn, FirstName, Kids, LastName)
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT T1.FirstName, T1.LastName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T1.Rate > T2.basePrice; |
List three countries which are the origins of the least players.?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT birth_country FROM player WHERE birth_country IS NOT NULL GROUP BY birth_country ORDER BY COUNT(*) ASC NULLS LAST LIMIT 3; |
List categories that have at least two books after year 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; |
Sort all the shops by number products in descending order, and return the name, location and district of each shop.?
Schema:
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT Name, Location, District FROM shop ORDER BY Number_products DESC NULLS LAST; |
What are the names of studios that have produced films with both Nicholas Meyer and Walter Hill?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) | SELECT DISTINCT T1.Studio FROM (SELECT Studio FROM film WHERE Director = 'Nicholas Meyer') AS T1 JOIN (SELECT Studio FROM film WHERE Director = 'Walter Hill') AS T2 ON T1.Studio = T2.Studio; |
For each customer who has at least two orders, find the 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; |
What is the name of the nurse has the most appointments?
Schema:
- Nurse(Name)
- Appointment(AppointmentID, Start) | SELECT T1.Name FROM Nurse AS T1 JOIN Appointment AS T2 ON T1.EmployeeID = T2.PrepNurse GROUP BY T1.EmployeeID, T1.Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
where is springfield?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT state_name FROM city WHERE city_name = 'springfield'; |
What are the names of wines made from red grapes?
Schema:
- grapes(...)
- wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) | SELECT DISTINCT T2.Name FROM grapes AS T1 JOIN wine AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'Red'; |
display the employee number, name( first name and last name ), and salary for all employees who earn more than the average salary and who work in a department with any employee with a 'J' in their first name.?
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, SALARY FROM employees WHERE SALARY > (SELECT AVG(SALARY) FROM employees) AND DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM employees WHERE FIRST_NAME LIKE '%J%'); |
Find the names of students who have taken any course in the fall semester of year 2003.?
Schema:
- student(COUNT, H, dept_name, name, tot_cred)
- takes(COUNT, semester, year) | SELECT name FROM student WHERE ID IN (SELECT ID FROM takes WHERE semester = 'Fall' AND "year" = 2003); |
What is the average and maximum age for each pet type?
Schema:
- Pets(PetID, PetType, pet_age, weight) | SELECT AVG(pet_age) AS avg_age, MAX(pet_age) AS max_age, PetType FROM Pets GROUP BY PetType; |
Return the most common first name among all actors.?
Schema:
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT first_name FROM actor WHERE first_name IS NOT NULL GROUP BY first_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
List the locations that are shared by more than two wrestlers.?
Schema:
- wrestler(COUNT, Days_held, Location, Name, Reign) | SELECT Location FROM wrestler WHERE Location IS NOT NULL GROUP BY Location HAVING COUNT(*) > 2; |
What is the phone number of the performer Ashley?
Schema:
- Performers(Customer_Name, Customer_Phone) | SELECT Customer_Phone FROM Performers WHERE Customer_Name = 'Ashley'; |
Who advises student 1004?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Advisor FROM Student WHERE StuID = 1004; |
List the name of artworks in ascending alphabetical order.?
Schema:
- artwork(COUNT, Name, Type) | SELECT Name FROM artwork ORDER BY Name ASC NULLS LAST; |
Count the number of poker players.?
Schema:
- poker_player(Best_Finish, Earnings, Final_Table_Made, Money_Rank) | SELECT COUNT(*) AS num_players FROM poker_player; |
Find the titles of papers whose first author is affiliated with an institution in the country "Japan" and has last name "Ohori"?
Schema:
- Authors(fname, lname)
- Authorship(...)
- Papers(title)
- Inst(...) | SELECT T3.title FROM Authors AS T1 JOIN Authorship AS T2 ON T1.authID = T2.authID JOIN Papers AS T3 ON T2.paperID = T3.paperID JOIN Inst AS T4 ON T2.instID = T4.instID WHERE T4.country = 'Japan' AND T2.authOrder = 1 AND T1.lname = 'Ohori'; |
What are the names of captains that have either the rank Midshipman or Lieutenant?
Schema:
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT Name FROM captain WHERE "Rank" = 'Midshipman' OR "Rank" = 'Lieutenant'; |
How many people live in countries that do not speak English?
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 SUM(Population) AS total_population FROM country WHERE Name NOT IN (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" = 'English'); |
List the first and last name of the students who do not have any food type allergy.?
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 Fname, LName FROM Student WHERE StuID NOT IN (SELECT T1.StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = 'food'); |
Find the names of the artists who are from Bangladesh and have never received rating higher than 7.?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more)) | SELECT DISTINCT artist_name FROM artist WHERE country = 'Bangladesh' AND artist_name NOT IN (SELECT artist_name FROM song WHERE rating > 7); |
Return the code of the card type that is most common.?
Schema:
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to) | SELECT card_type_code FROM Customers_Cards WHERE card_type_code IS NOT NULL GROUP BY card_type_code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the ids of suppliers which have an average amount purchased of above 50000 or below 30000?
Schema:
- Product_Suppliers(COUNT, DOUBLE, TRY_CAST, product_id, supplier_id) | SELECT supplier_id FROM Product_Suppliers WHERE supplier_id IS NOT NULL GROUP BY supplier_id HAVING AVG(TRY_CAST(total_amount_purchased AS DOUBLE)) > 50000 OR AVG(TRY_CAST(total_amount_purchased AS DOUBLE)) < 30000; |
What are the distinct payment method codes in all the invoices?
Schema:
- Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code) | SELECT DISTINCT payment_method_code FROM Invoices; |
List the publisher of the publication with the highest price.?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT Publisher FROM publication ORDER BY Price DESC NULLS LAST LIMIT 1; |
Which airlines have less than 200 flights?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT T1.Airline FROM airlines AS T1 JOIN flights AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline HAVING COUNT(*) < 200; |
Show all the cinema names and opening years in descending order of opening year.?
Schema:
- cinema(COUNT, Capacity, Location, Name, Openning_year, T1, c) | SELECT Name, Openning_year FROM cinema ORDER BY Openning_year DESC NULLS LAST; |
How many aircrafts exist in the database?
Schema:
- aircraft(Description, aid, d, distance, name) | SELECT COUNT(*) AS num_aircrafts FROM aircraft; |
Find the distinct last names of all the students who have president votes and whose advisor is 8741.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT DISTINCT T1.LName FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.President_Vote WHERE T1.Advisor = '8741'; |
List the file size and format for all songs that have resolution lower than 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 DISTINCT T1.file_size, T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.resolution < 800; |
Return the descriptions and names of the courses that have more than two students enrolled in.?
Schema:
- Courses(course_description, course_name)
- Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) | SELECT T1.course_description, T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name, T1.course_description HAVING COUNT(*) > 2; |
How many different projects are there?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT COUNT(DISTINCT Name) AS num_projects FROM Projects; |
Return the names and typical buying prices for all products.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT product_name, typical_buying_price FROM Products; |
Find the first and last name of students whose age is younger than the average age.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Fname, LName FROM Student WHERE Age < (SELECT AVG(Age) FROM Student); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.