question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
Find the number of scientists involved for each project name.?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
- AssignedTo(Scientist) | SELECT COUNT(*) AS num_scientists, T1.Name FROM Projects AS T1 JOIN AssignedTo AS T2 ON T1.Code = T2.Project GROUP BY T1.Name; |
Find the the customer details and id for the customers who had more than one policy.?
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))
- Customer_Policies(COUNT, Policy_Type_Code) | SELECT T1.Customer_Details, T1.Customer_ID FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID GROUP BY T1.Customer_ID, T1.Customer_Details HAVING COUNT(*) > 1; |
What are the different ship flags, and how many ships have each?
Schema:
- Ship(Built_Year, COUNT, Class, Flag, Name, Type) | SELECT COUNT(*) AS num_ships, Flag FROM Ship GROUP BY Flag; |
How many phone hardware models are produced by the company named "Nokia Corporation"?
Schema:
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) | SELECT COUNT(*) AS num_models FROM phone WHERE Company_name = 'Nokia Corporation'; |
Among all the claims, what is the amount claimed in the claim with the least amount settled? List both the settlement amount and claim amount.?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled) | SELECT Amount_Settled, Amount_Claimed FROM Claims ORDER BY Amount_Settled ASC NULLS LAST LIMIT 1; |
Return the full name of the staff who provided a customer with the first name April and the last name Burns with a film rental.?
Schema:
- staff(...)
- rental(...)
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) | SELECT DISTINCT T1.first_name, T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id = T2.staff_id JOIN customer AS T3 ON T2.customer_id = T3.customer_id WHERE T3.first_name = 'APRIL' AND T3.last_name = 'BURNS'; |
How many enzymes do not have any interactions?
Schema:
- enzyme(Chromosome, Location, OMIM, Porphyria, Product, name)
- medicine_enzyme_interaction(interaction_type) | SELECT COUNT(*) AS num_enzymes FROM enzyme WHERE id NOT IN (SELECT enzyme_id FROM medicine_enzyme_interaction); |
Which papers' first author is affiliated with an institution in the country "Japan" and has last name "Ohori"? Give me the titles of the papers.?
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'; |
how many inhabitants does boulder have?
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 = 'boulder'; |
How many papers run experiments on ImageNet ?
Schema:
- paperDataset(...)
- dataset(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT COUNT(DISTINCT T3.paperId) AS num_papers 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 LIKE 'ImageNet'; |
What are the names of the different customers who have taken out a loan, ordered by the total amount that they have taken?
Schema:
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id)
- loan(...) | SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_ID = T2.cust_ID GROUP BY T1.cust_name ORDER BY SUM(T2.amount) ASC NULLS LAST; |
what cities are located in texas?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT city_name FROM city WHERE state_name = 'texas'; |
What are the different years for all competitions that are not of type equal to tournament?
Schema:
- competition(COUNT, Competition_type, Country, T1, Year) | SELECT DISTINCT "Year" FROM competition WHERE Competition_type != 'Tournament'; |
Find the total amount of products ordered before 2018-03-17 07:13:53.?
Schema:
- Customer_Orders(customer_id, order_date, order_id, order_shipping_charges)
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) | SELECT SUM(TRY_CAST(T2.order_quantity AS DOUBLE)) AS total_amount FROM Customer_Orders AS T1 JOIN Order_Items AS T2 ON T1.order_id = T2.order_id WHERE T1.order_date < '2018-03-17 07:13:53'; |
Find the name of the ships that are steered by both a captain with Midshipman rank and a captain with Lieutenant rank.?
Schema:
- Ship(Built_Year, COUNT, Class, Flag, Name, Type)
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT T1.Name FROM Ship AS T1 JOIN captain AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2."Rank" = 'Midshipman' AND T1.Name IN (SELECT T1.Name FROM Ship AS T1 JOIN captain AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2."Rank" = 'Lieutenant'); |
return me the keywords in VLDB conference .?
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 T1.keyword 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 T2.name = 'VLDB'; |
Return the ids 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 Document_ID FROM Documents WHERE Document_ID NOT IN (SELECT Document_ID FROM Documents_with_Expenses); |
Which journals did linda shapiro submit papers to ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- journal(Theme, homepage, name)
- writes(...)
- author(...) | SELECT DISTINCT T2.journalId FROM paper AS T3 JOIN journal AS T2 ON T3.journalId = T2.journalId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T1.authorName = 'linda shapiro'; |
Show the number of transaction types.?
Schema:
- Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type) | SELECT COUNT(DISTINCT transaction_type) AS num_transaction_types FROM Financial_Transactions; |
What is the name of the youngest male?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT name FROM Person WHERE gender = 'male' AND age = (SELECT MIN(age) FROM Person WHERE gender = 'male'); |
What are the names of instructors who didn't teach?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary)
- teaches(ID, Spr, semester) | SELECT name FROM instructor WHERE ID NOT IN (SELECT ID FROM teaches); |
What are the population, name and leader of the country with 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; |
What are the names of all cartoons directed by Ben Jones?
Schema:
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by) | SELECT Title FROM Cartoon WHERE Directed_by = 'Ben Jones'; |
List the titles of the papers whose authors are from the institution "Indiana University".?
Schema:
- Papers(title)
- Authorship(...)
- Inst(...) | SELECT DISTINCT T1.title FROM Papers AS T1 JOIN Authorship AS T2 ON T1.paperID = T2.paperID JOIN Inst AS T3 ON T2.instID = T3.instID WHERE T3.name = 'Indiana University'; |
Find the names of nurses who are on call.?
Schema:
- Nurse(Name)
- On_Call(BlockCode, BlockFloor, Nurse) | SELECT DISTINCT T1.Name FROM Nurse AS T1 JOIN On_Call AS T2 ON T1.EmployeeID = T2.Nurse; |
Give me a list of all the service names sorted alphabetically.?
Schema:
- Services(Service_Type_Code, Service_name) | SELECT Service_name FROM Services ORDER BY Service_name ASC NULLS LAST; |
For model volvo, how many cylinders does the car with the least accelerate have?
Schema:
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
- car_names(COUNT, Model) | SELECT T1.Cylinders FROM cars_data AS T1 JOIN car_names AS T2 ON T1.Id = T2.MakeId WHERE T2.Model = 'volvo' ORDER BY T1.Accelerate ASC NULLS LAST LIMIT 1; |
How many movies about Persians were released after 1990 ?
Schema:
- tags(...)
- keyword(keyword)
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) | SELECT COUNT(DISTINCT T3.title) AS num_movies FROM tags AS T2 JOIN keyword AS T1 ON T2.kid = T1.id JOIN movie AS T3 ON T2.msid = T3.mid WHERE T1.keyword = 'Persians' AND T3.release_year > 1990; |
Show the names of companies in the banking or retailing industry?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT Name FROM company WHERE Industry = 'Banking' OR Industry = 'Retailing'; |
which countries' tv channels are not playing any cartoon written by Todd Casey?
Schema:
- TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name)
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by) | SELECT Country FROM TV_Channel WHERE Country NOT IN (SELECT T1.Country FROM TV_Channel AS T1 JOIN Cartoon AS T2 ON T1.id = T2.Channel WHERE T2.Written_by = 'Todd Casey'); |
list all the names of programs, ordering by launch time.?
Schema:
- program(Beij, Launch, Name, Origin, Owner) | SELECT Name FROM program ORDER BY Launch ASC NULLS LAST; |
Return the names of all counties sorted by county name in descending alphabetical order.?
Schema:
- county(County_name, Population, Zip_code) | SELECT County_name FROM county ORDER BY County_name DESC NULLS LAST; |
Give the order ids for all orders, as well as the total product quantity in each.?
Schema:
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) | SELECT order_id, SUM(TRY_CAST(product_quantity AS INT)) AS total_product_quantity FROM Order_Items GROUP BY order_id; |
What are the allergy types and how many allergies correspond to each one?
Schema:
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT AllergyType, COUNT(*) AS num_allergies FROM Allergy_Type GROUP BY AllergyType; |
Hom many albums does the artist "Metallica" have?
Schema:
- Album(Title)
- Artist(Name) | SELECT COUNT(*) AS num_albums FROM Album AS T1 JOIN Artist AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = 'Metallica'; |
What are the ids of instructors who taught in the Fall of 2009 but not in the Spring of 2010?
Schema:
- teaches(ID, Spr, semester) | SELECT ID FROM teaches WHERE semester = 'Fall' AND "year" = 2009 AND ID NOT IN (SELECT ID FROM teaches WHERE semester = 'Spring' AND "year" = 2010); |
How many camera lenses are not used in taking any photos?
Schema:
- camera_lens(brand, name)
- photos(color, id, name) | SELECT COUNT(*) AS num_lenses FROM camera_lens WHERE id NOT IN (SELECT camera_lens_id FROM photos); |
How many friends does the high school student Kyle have?
Schema:
- Friend(student_id)
- Highschooler(COUNT, ID, grade, name) | SELECT COUNT(*) AS num_friends FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID WHERE T2.name = 'Kyle'; |
Find the name of instructors who are advising more than one student.?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary)
- advisor(s_ID) | SELECT T1.name FROM instructor AS T1 JOIN advisor AS T2 ON T1.ID = T2.i_ID GROUP BY T2.i_ID, T1.name HAVING COUNT(*) > 1; |
Find the full names of employees who help customers with the first name Leonie.?
Schema:
- Customer(Email, FirstName, LastName, State, lu)
- Employee(BirthDate, City, FirstName, LastName, Phone) | SELECT T2.FirstName, T2.LastName FROM Customer AS T1 JOIN Employee AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = 'Leonie'; |
what state has the capital salem?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM state WHERE capital = 'salem'; |
Return the total and minimum enrollments across all schools.?
Schema:
- university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School) | SELECT SUM(Enrollment) AS total_enrollment, MIN(Enrollment) AS min_enrollment FROM university; |
return me the number of papers by " H. V. Jagadish " on VLDB conference .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- conference(homepage, name)
- writes(...)
- author(...) | SELECT COUNT(DISTINCT T4.title) AS num_papers FROM publication AS T4 JOIN conference AS T2 ON T4.cid = CAST(T2.cid AS TEXT) JOIN writes AS T3 ON T3.pid = T4.pid JOIN author AS T1 ON T3.aid = T1.aid WHERE T1.name = 'H. V. Jagadish' AND T2.name = 'VLDB'; |
what papers are published by Liwen Xiong 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; |
What is the average rating of songs for each language?
Schema:
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more)) | SELECT AVG(rating) AS avg_rating, languages FROM song GROUP BY languages; |
how many papers does David M. Blei have at AISTATS?
Schema:
- venue(venueId, venueName)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT COUNT(T3.paperId) AS num_papers FROM venue AS T4 JOIN paper AS T3 ON T4.venueId = T3.venueId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'David M. Blei' AND T4.venueName = 'AISTATS'; |
How many markets have number of cities smaller than 300?
Schema:
- market(Country, Number_cities) | SELECT COUNT(*) AS num_markets FROM market WHERE Number_cities < 300; |
Show the name and country for all people whose age is smaller than the average.?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT Name, Country FROM people WHERE Age < (SELECT AVG(Age) FROM people); |
What is the name and country for the artist with most number of exhibitions?
Schema:
- exhibition(Theme, Ticket_Price, Year)
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT T2.Name, T2.Country FROM exhibition AS T1 JOIN artist AS T2 ON T1.Artist_ID = T2.Artist_ID GROUP BY T1.Artist_ID, T2.Name, T2.Country ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the names of the chairs of festivals, sorted in ascending order of the year held?
Schema:
- festival_detail(Chair_Name, Festival_Name, Location, T1, Year) | SELECT Chair_Name FROM festival_detail ORDER BY "Year" ASC NULLS LAST; |
How many classes are professor whose last name is Graztevski has?
Schema:
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME)
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) | SELECT COUNT(*) AS num_classes FROM EMPLOYEE AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE T1.EMP_LNAME = 'Graztevski'; |
papers by 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'; |
How many games were played in city Atlanta in 2000?
Schema:
- home_game(attendance, year)
- park(city, state) | SELECT COUNT(*) AS num_games FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1."year" = 2000 AND T2.city = 'Atlanta'; |
Count the number of courses without prerequisites.?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- prereq(...) | SELECT COUNT(*) AS num_courses FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq); |
What are the country code and first name of the players who won in both tourney WTA Championships and Australian Open?
Schema:
- players(COUNT, birth_date, country_code, first_name, hand, last_name)
- matches_(COUNT, T1, loser_age, loser_name, minutes, tourney_name, winner_age, winner_hand, winner_name, winner_rank, winner_rank_points, year) | SELECT DISTINCT T1.country_code, T1.first_name FROM players AS T1 JOIN matches_ AS T2 ON T1.player_id = T2.winner_id JOIN players AS T3 ON T1.player_id = T3.player_id JOIN matches_ AS T4 ON T3.player_id = T4.winner_id WHERE T2.tourney_name = 'WTA Championships' AND T4.tourney_name = 'Australian Open'; |
What student id corresponds to the oldest student?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT StuID FROM Student WHERE Age = (SELECT MAX(Age) FROM Student); |
What are the total number of credits offered by each department?
Schema:
- COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE)
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) | SELECT SUM(T1.CRS_CREDIT) AS total_credits, T1.DEPT_CODE FROM COURSE AS T1 JOIN CLASS AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY T1.DEPT_CODE; |
return me all the organizations .?
Schema:
- organization(continent, homepage, name) | SELECT name FROM organization; |
What is the content of the series Sky Radio?
Schema:
- TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name) | SELECT Content FROM TV_Channel WHERE series_name = 'Sky Radio'; |
give me some restaurants good for french food in the yosemite and mono lake area ?
Schema:
- restaurant(...)
- geographic(...)
- location(...) | SELECT T3.house_number, T1.name FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name JOIN location AS T3 ON T1.id = T3.restaurant_id WHERE T2.region = 'yosemite and mono lake area' AND T1.food_type = 'french' AND T1.rating > 2.5; |
return me the authors who have cited the papers by " H. V. Jagadish " .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- cite(...)
- writes(...)
- author(...) | SELECT T2.name FROM publication AS T7 JOIN cite AS T5 ON T7.pid = T5.citing JOIN publication AS T6 ON T6.pid = T5.cited JOIN writes AS T3 ON T3.pid = T7.pid JOIN writes AS T4 ON T4.pid = T6.pid JOIN author AS T2 ON T3.aid = T2.aid JOIN author AS T1 ON T4.aid = T1.aid WHERE T1.name = 'H. V. Jagadish'; |
What is the name of the hardware product with the greatest price?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT product_name FROM Products WHERE product_type_code = 'Hardware' ORDER BY product_price DESC NULLS LAST LIMIT 1; |
Which vocal type has the band mate with last name "Heilo" played the most?
Schema:
- Vocals(COUNT, Type)
- Band(...) | SELECT Type FROM Vocals AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id WHERE Lastname = 'Heilo' AND Type IS NOT NULL GROUP BY Type ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
who does Noah A Smith author with ?
Schema:
- writes(...)
- author(...) | SELECT DISTINCT T1.authorId FROM writes AS T3 JOIN author AS T2 ON T3.authorId = T2.authorId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T2.authorName = 'Noah A Smith'; |
Which department offers the most credits all together?
Schema:
- COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE)
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT T3.DEPT_NAME FROM COURSE AS T1 JOIN CLASS AS T2 ON T1.CRS_CODE = T2.CRS_CODE JOIN DEPARTMENT AS T3 ON T1.DEPT_CODE = T3.DEPT_CODE GROUP BY T1.DEPT_CODE, T3.DEPT_NAME ORDER BY SUM(T1.CRS_CREDIT) DESC NULLS LAST LIMIT 1; |
How many dorms are there and what is the total capacity for each gender?
Schema:
- Dorm(dorm_name, gender, student_capacity) | SELECT COUNT(*) AS num_dorms, SUM(student_capacity) AS total_capacity, gender FROM Dorm GROUP BY gender; |
Count the number of different nationalities.?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT COUNT(DISTINCT Nationality) AS num_nationalities FROM people; |
What is the first name, last name, and phone of the customer with card 4560596484842.?
Schema:
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to)
- 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_first_name, T2.customer_last_name, T2.customer_phone FROM Customers_Cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.card_number = '4560596484842'; |
Find the payment method that is used the most often in all the invoices. Give me its code.?
Schema:
- Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code) | SELECT payment_method_code FROM Invoices WHERE payment_method_code IS NOT NULL GROUP BY payment_method_code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
what are some good places in the yosemite and mono lake area for french food ?
Schema:
- restaurant(...)
- geographic(...)
- location(...) | SELECT T3.house_number, T1.name FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name JOIN location AS T3 ON T1.id = T3.restaurant_id WHERE T2.region = 'yosemite and mono lake area' AND T1.food_type = 'french' AND T1.rating > 2.5; |
What is the department name of the students with lowest gpa belongs to?
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; |
What were all the salary values of players in 2010 and 2001?
Schema:
- salary(salary) | SELECT DISTINCT salary FROM (SELECT salary FROM salary WHERE "year" = 2010 UNION ALL SELECT salary FROM salary WHERE "year" = 2001); |
What are the average and minimum weights for people of each sex?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT AVG(Weight) AS avg_weight, MIN(Weight) AS min_weight, Sex FROM people GROUP BY Sex; |
Find the production code and channel of the most recently aired cartoon .?
Schema:
- Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by) | SELECT Production_code, Channel FROM Cartoon ORDER BY Original_air_date DESC NULLS LAST LIMIT 1; |
Give the name and building of the departments with greater than average budget.?
Schema:
- department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name) | SELECT dept_name, building FROM department WHERE budget > (SELECT AVG(budget) FROM department); |
Return the nationalities for which there are two or more people.?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT Nationality FROM people WHERE Nationality IS NOT NULL GROUP BY Nationality HAVING COUNT(*) >= 2; |
What are the prices of products that have never gotten a complaint?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Complaints(complaint_status_code, complaint_type_code) | SELECT product_price FROM Products WHERE product_id NOT IN (SELECT product_id FROM Complaints); |
What is the total quantity of products purchased by "Rodrick Heaney"?
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))
- Customer_Orders(customer_id, order_date, order_id, order_shipping_charges)
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) | SELECT SUM(TRY_CAST(T3.order_quantity AS DOUBLE)) AS total_quantity FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_Items AS T3 ON T2.order_id = T3.order_id WHERE T1.customer_name = 'Rodrick Heaney'; |
Show all member names and registered branch names sorted by register year.?
Schema:
- membership_register_branch(...)
- branch(Address_road, City, Name, Open_year, membership_amount)
- member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) | SELECT T3.Name, T2.Name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.Branch_ID = T2.Branch_ID JOIN member_ AS T3 ON T1.Member_ID = T3.Member_ID ORDER BY T1.Register_Year ASC NULLS LAST; |
return me the number of authors who have cited the papers by " H. V. Jagadish " .?
Schema:
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- cite(...)
- writes(...)
- author(...) | SELECT COUNT(DISTINCT T2.name) AS num_authors FROM publication AS T7 JOIN cite AS T5 ON T7.pid = T5.citing JOIN publication AS T6 ON T6.pid = T5.cited JOIN writes AS T3 ON T3.pid = T7.pid JOIN writes AS T4 ON T4.pid = T6.pid JOIN author AS T2 ON T3.aid = T2.aid JOIN author AS T1 ON T4.aid = T1.aid WHERE T1.name = 'H. V. Jagadish'; |
Find the first name and gender of student who have more than one pet.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Has_Pet(...) | SELECT T1.Fname, T1.Sex FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID, T1.Fname, T1.Sex HAVING COUNT(*) > 1; |
What are the country codes of countries where people use languages other than English?
Schema:
- countrylanguage(COUNT, CountryCode, Engl, Language) | SELECT DISTINCT CountryCode FROM countrylanguage WHERE "Language" != 'English'; |
What is the channel code and contact number of the customer contact channel that was active for the longest time?
Schema:
- Customer_Contact_Channels(DATEDIFF, DAY, active_from_date, active_to_date, channel_code, contact_number, diff) | SELECT channel_code, contact_number FROM Customer_Contact_Channels WHERE DATEDIFF(DAY, active_from_date, active_to_date) = (SELECT DATEDIFF(DAY, active_from_date, active_to_date) FROM Customer_Contact_Channels ORDER BY DATEDIFF(DAY, active_from_date, active_to_date) DESC NULLS LAST LIMIT 1); |
Find the number of stores in each city.?
Schema:
- store(Type)
- store_district(...)
- district(City_Area, City_Population, District_name, d) | SELECT T3.Headquartered_City, COUNT(*) AS num_stores FROM store AS T1 JOIN store_district AS T2 ON T1.Store_ID = T2.Store_ID JOIN district AS T3 ON T2.District_ID = T3.District_ID GROUP BY T3.Headquartered_City; |
Who are Bob's friends?
Schema:
- Person(M, age, city, eng, gender, job, name)
- PersonFriend(M, friend, name) | SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Bob'; |
Show teams that have suffered more than three eliminations.?
Schema:
- Elimination(Benjam, Eliminated_By, Elimination_Move, T1, Team, Time) | SELECT Team FROM Elimination WHERE Team IS NOT NULL GROUP BY Team HAVING COUNT(*) > 3; |
Count the number of schools that have had basketball matches.?
Schema:
- basketball_match(ACC_Percent, All_Home, School_ID, Team_Name) | SELECT COUNT(DISTINCT School_ID) AS num_schools FROM basketball_match; |
What are the full names of students minoring in department 140?
Schema:
- Minor_in(...)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT T2.Fname, T2.LName FROM Minor_in AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.DNO = 140; |
List the names of departments where some physicians are primarily affiliated with.?
Schema:
- Affiliated_With(Department, Physician, PrimaryAffiliation)
- Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2) | SELECT DISTINCT T2.Name FROM Affiliated_With AS T1 JOIN Department AS T2 ON T1.Department = T2.DepartmentID WHERE PrimaryAffiliation = 1; |
Which customers have both "On Road" and "Shipped" as order status? List the customer ids.?
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 DISTINCT T1.customer_id FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Orders AS T3 ON T1.customer_id = T3.customer_id WHERE (T2.order_status = 'On Road' AND T3.order_status = 'Shipped'); |
How many degrees does the engineering department offer?
Schema:
- Departments(...)
- Degree_Programs(degree_summary_name, department_id) | SELECT COUNT(*) AS num_degrees FROM Departments AS T1 JOIN Degree_Programs AS T2 ON T1.department_id = T2.department_id WHERE T1.department_name = 'engineer'; |
Show the names of students who have at least 2 likes.?
Schema:
- Likes(student_id)
- Highschooler(COUNT, ID, grade, name) | SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID GROUP BY T1.student_id, T2.name HAVING COUNT(*) >= 2; |
papers that mention Question Answering?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId WHERE T1.keyphraseName = 'Question Answering'; |
return me the author in the " University of Michigan " whose papers have more than 5000 total citations .?
Schema:
- organization(continent, homepage, name)
- author(...)
- writes(...)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT T1.name FROM organization AS T2 JOIN author AS T1 ON T2.oid = T1.oid JOIN writes AS T3 ON T3.aid = T1.aid JOIN publication AS T4 ON T3.pid = T4.pid WHERE T2.name = 'University of Michigan' GROUP BY T1.name HAVING SUM(T4.citation_num) > 5000; |
Which students study under the teacher named OTHA MOYER? Give me the first and last names of the students.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
- teachers(Classroom, FirstName, LastName) | SELECT T1.FirstName, T1.LastName FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T2.FirstName = 'OTHA' AND T2.LastName = 'MOYER'; |
Give me the temperature of Shanghai in January.?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- temperature(...) | SELECT T2.Jan FROM city AS T1 JOIN temperature AS T2 ON T1.City_ID = T2.City_ID WHERE T1.City = 'Shanghai'; |
display all the information of the employees whose salary if within the range of smallest salary and 2500.?
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 * FROM employees WHERE SALARY BETWEEN (SELECT MIN(SALARY) FROM employees) AND 2500; |
What is the name of the customer that has purchased the most items?
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))
- Customer_Orders(customer_id, order_date, order_id, order_shipping_charges)
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) | SELECT T1.customer_name FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_Items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_name ORDER BY SUM(TRY_CAST(T3.order_quantity AS DOUBLE)) DESC NULLS LAST LIMIT 1; |
For any rating where the name of reviewer is the same as the director of the movie, return the reviewer name, movie title, and number of stars.?
Schema:
- Rating(Rat, mID, rID, stars)
- Movie(T1, director, title, year)
- Reviewer(Lew, name, rID) | SELECT DISTINCT T3.name, T2.title, T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.director = T3.name; |
Which dogs have not cost their owner more than 1000 for treatment ? List the dog names .?
Schema:
- Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT name FROM Dogs WHERE dog_id NOT IN (SELECT dog_id FROM Treatments WHERE dog_id IS NOT NULL GROUP BY dog_id having SUM(cost_of_treatment) > 1000); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.