question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
What are the ids and details for each project?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT Project_ID, Project_Details FROM Projects; |
What are the gender and occupation of players?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) | SELECT Gender, Occupation FROM player; |
What are the names of students who haven't taken any Biology courses?
Schema:
- student(COUNT, H, dept_name, name, tot_cred)
- takes(COUNT, semester, year)
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) | SELECT name FROM student WHERE ID NOT IN (SELECT T1.ID FROM takes AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.dept_name = 'Biology'); |
Find the id of courses which are registered or attended by student whose id is 121?
Schema:
- Student_Course_Registrations(COUNT, student_id)
- Student_Course_Attendance(course_id, date_of_attendance, student_id) | SELECT DISTINCT course_id FROM (SELECT course_id FROM Student_Course_Registrations WHERE student_id = 121 UNION ALL SELECT course_id FROM Student_Course_Attendance WHERE student_id = 121); |
What is the level name of the cheapest catalog (in USD)?
Schema:
- Catalog_Contents(capacity, catalog_entry_name, height, next_entry_id, price_in_dollars, price_in_euros, product_stock_number)
- Catalog_Structure(catalog_level_name, catalog_level_number) | SELECT T2.catalog_level_name FROM Catalog_Contents AS T1 JOIN Catalog_Structure AS T2 ON T1.catalog_level_number = T2.catalog_level_number ORDER BY T1.price_in_dollars ASC NULLS LAST LIMIT 1; |
Which institution does "Katsuhiro Ueno" belong to?
Schema:
- Authors(fname, lname)
- Authorship(...)
- Inst(...) | SELECT DISTINCT T3.name FROM Authors AS T1 JOIN Authorship AS T2 ON T1.authID = T2.authID JOIN Inst AS T3 ON T2.instID = T3.instID WHERE T1.fname = 'Katsuhiro' AND T1.lname = 'Ueno'; |
return me the keyword, which have been contained by the most number of papers in PVLDB .?
Schema:
- publication_keyword(...)
- keyword(keyword)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
- journal(Theme, homepage, name) | SELECT T1.keyword FROM publication_keyword AS T4 JOIN keyword AS T1 ON T4.kid = T1.kid JOIN publication AS T2 ON T2.pid = T4.pid JOIN journal AS T3 ON T2.jid = T3.jid WHERE T3.name = 'PVLDB' GROUP BY T1.keyword ORDER BY COUNT(DISTINCT T2.title) DESC NULLS LAST LIMIT 1; |
List name of all tracks in Balls to the Wall.?
Schema:
- albums(I, title)
- tracks(composer, milliseconds, name, unit_price) | SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.title = 'Balls to the Wall'; |
what is the shortest river in texas?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE LENGTH = (SELECT MIN(LENGTH) FROM river WHERE traverse = 'texas') AND traverse = 'texas'; |
how many places for french food are there in palo alto ?
Schema:
- restaurant(...)
- location(...) | SELECT COUNT(*) AS num_restaurants FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'palo alto' AND T1.food_type = 'french'; |
how many rivers are in the state with the highest point.?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT COUNT(T1.river_name) AS num_rivers FROM highlow AS T2 JOIN river AS T1 ON T1.traverse = T2.state_name WHERE T2.highest_elevation = (SELECT MAX(highest_elevation) FROM highlow); |
Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order.?
Schema:
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count) | SELECT apt_type_code, COUNT(*) AS num_apartments FROM Apartments WHERE apt_type_code IS NOT NULL GROUP BY apt_type_code ORDER BY num_apartments ASC NULLS LAST; |
Count the total number of apartment bookings.?
Schema:
- Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code) | SELECT COUNT(*) AS num_bookings FROM Apartment_Bookings; |
Give the names, details, and data types of characteristics that are not found in any product.?
Schema:
- Characteristics(characteristic_name)
- Product_Characteristics(...) | SELECT T1.characteristic_name, T1.other_characteristic_details, T1.characteristic_data_type FROM Characteristics AS T1 LEFT JOIN Product_Characteristics AS T2 ON T1.characteristic_id = T2.characteristic_id WHERE T2.characteristic_id IS NULL; |
For each sex, what is the name and sex of the candidate with the oppose rate for their sex?
Schema:
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
- candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_rate) | SELECT T1.Name, T1.Sex, MIN(Oppose_rate) AS min_oppose_rate FROM people AS T1 JOIN candidate AS T2 ON T1.People_ID = T2.People_ID GROUP BY T1.Name, T1.Sex; |
Find the number of orchestras whose record format is "CD" or "DVD".?
Schema:
- orchestra(COUNT, Major_Record_Format, Record_Company, Year_of_Founded) | SELECT COUNT(*) AS num_orchestras FROM orchestra WHERE Major_Record_Format = 'CD' OR Major_Record_Format = 'DVD'; |
What are the famous titles of the artist "Triumfall"?
Schema:
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT Famous_Title FROM artist WHERE Artist = 'Triumfall'; |
Which attribute definitions have attribute value 0? Give me the attribute name and attribute ID.?
Schema:
- Attribute_Definitions(attribute_data_type, attribute_name)
- Catalog_Contents_Additional_Attributes(...) | SELECT T1.attribute_name, T1.attribute_id FROM Attribute_Definitions AS T1 JOIN Catalog_Contents_Additional_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE TRY_CAST(T2.attribute_value AS INT) = 0; |
What is the name of all the people who are older than at least one engineer? Order them by age.?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT name FROM Person WHERE age > (SELECT MIN(age) FROM Person WHERE job = 'engineer') ORDER BY age ASC NULLS LAST; |
What is the document status description of the document with id 1?
Schema:
- Ref_Document_Status(document_status_code, document_status_description, work)
- 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 Ref_Document_Status.document_status_description FROM Ref_Document_Status JOIN Documents ON Documents.document_status_code = Ref_Document_Status.document_status_code WHERE Documents.document_id = 1; |
What is the most common mill type, and how many are there?
Schema:
- mill(Moul, location, name, type) | SELECT type, COUNT(*) AS num_mills FROM mill WHERE type IS NOT NULL GROUP BY type ORDER BY num_mills DESC NULLS LAST LIMIT 1; |
Find the distinct number of president votes.?
Schema:
- Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote) | SELECT COUNT(DISTINCT President_Vote) AS num_president_votes FROM Voting_record; |
What are the ids of all reviewers who did not give 4 stars?
Schema:
- Rating(Rat, mID, rID, stars) | SELECT rID FROM Rating WHERE rID NOT IN (SELECT rID FROM Rating WHERE stars = 4); |
What is the id and type code for the template used by the most 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))
- Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number) | SELECT T1.Template_ID, T2.Template_Type_Code FROM Documents AS T1 JOIN Templates AS T2 ON T1.Template_ID = T2.Template_ID GROUP BY T1.Template_ID, T2.Template_Type_Code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Show first name and last name for all students.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Fname, LName FROM Student; |
How many council taxes are collected for renting arrears ?
Schema:
- Rent_Arrears(...) | SELECT COUNT(*) AS num_council_taxes FROM Rent_Arrears; |
How many countries are there in total?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) | SELECT COUNT(*) AS num_countries FROM country; |
Return the phone and email of the customer with the first name Aniyah and last name Feest.?
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 customer_phone, customer_email FROM Customers WHERE customer_first_name = 'Aniyah' AND customer_last_name = 'Feest'; |
Show the invoice number and the number of transactions for each invoice.?
Schema:
- Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type) | SELECT invoice_number, COUNT(*) AS num_transactions FROM Financial_Transactions GROUP BY invoice_number; |
In which year were most departments established?
Schema:
- department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name) | SELECT Creation FROM department WHERE Creation IS NOT NULL GROUP BY Creation ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the average access counts of documents with functional area "Acknowledgement".?
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))
- Document_Functional_Areas(...)
- Functional_Areas(...) | SELECT AVG(T1.access_count) AS avg_access_count FROM Documents AS T1 JOIN Document_Functional_Areas AS T2 ON T1.document_code = T2.document_code JOIN Functional_Areas AS T3 ON T2.functional_area_code = T3.functional_area_code WHERE T3.functional_area_description = 'Acknowledgement'; |
What are the id of students who registered courses or attended courses?
Schema:
- Student_Course_Registrations(COUNT, student_id)
- Student_Course_Attendance(course_id, date_of_attendance, student_id) | SELECT DISTINCT student_id FROM (SELECT student_id FROM Student_Course_Registrations UNION ALL SELECT student_id FROM Student_Course_Attendance); |
What are all distinct countries where singers above age 20 are from?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s) | SELECT DISTINCT Country FROM singer WHERE Age > 20; |
What are the names of students who have taken the prerequisite for the course International Finance?
Schema:
- student(COUNT, H, dept_name, name, tot_cred)
- takes(COUNT, semester, year)
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- prereq(...) | SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.ID = T2.ID WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id = T4.course_id WHERE T3.title = 'International Finance'); |
Return the names of artists and the themes of their exhibitions that had a ticket price higher than average.?
Schema:
- exhibition(Theme, Ticket_Price, Year)
- artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) | SELECT T1.Theme, T2.Name FROM exhibition AS T1 JOIN artist AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Ticket_Price > (SELECT AVG(Ticket_Price) FROM exhibition); |
give me the longest river that passes through the us?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT river_name FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river); |
display the employee ID and job name for all those jobs in department 80.?
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))
- jobs(JOB_TITLE, diff) | SELECT T1.EMPLOYEE_ID, T2.JOB_TITLE FROM employees AS T1 JOIN jobs AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T1.DEPARTMENT_ID = 80; |
Find the name and city of the airport which is the destination of the most number of routes.?
Schema:
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
- routes(...) | SELECT T1.name, T1.city, T2.dst_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid GROUP BY T1.name, T1.city, T2.dst_apid ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
How many apartment bookings are there in total?
Schema:
- Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code) | SELECT COUNT(*) AS num_bookings FROM Apartment_Bookings; |
Show the premise type and address type code for all customer addresses.?
Schema:
- Customer_Addresses(address_type_code)
- Premises(premise_details, premises_type) | SELECT T2.premises_type, T1.address_type_code FROM Customer_Addresses AS T1 JOIN Premises AS T2 ON T1.premise_id = T2.premise_id; |
What are the official names of cities, ordered descending by population?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT Official_Name FROM city ORDER BY Population DESC NULLS LAST; |
What are the opening year and staff number of the museum named Plaza Museum?
Schema:
- museum(Name, Open_Year) | SELECT Num_of_Staff, Open_Year FROM museum WHERE Name = 'Plaza Museum'; |
Find the number of tied games (the value of "ties" is '1') in 1885 postseason.?
Schema:
- postseason(ties) | SELECT COUNT(*) AS num_ties FROM postseason WHERE "year" = 1885 AND ties = 1; |
what is the name of the instructor who is in Statistics department and earns the lowest salary?
Schema:
- instructor(AVG, M, So, Stat, dept_name, name, salary) | SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary ASC NULLS LAST LIMIT 1; |
How many visitors below age 30 are there?
Schema:
- visitor(Age, Level_of_membership, Name) | SELECT COUNT(*) AS num_visitors FROM visitor WHERE Age < 30; |
Show student ids who are on scholarship and have major 600.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID) | SELECT DISTINCT T1.StuID FROM Student AS T1 JOIN SportsInfo AS T2 ON T1.StuID = T2.StuID WHERE T1.Major = 600 AND T2.OnScholarship = 'Y'; |
What are the last names of faculty who are part of the computer science department?
Schema:
- Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2) | SELECT T2.LName FROM Department AS T1, Faculty AS T2, Member_of AS T3 WHERE T1.DNO = T3.DNO AND T2.FacID = T3.FacID AND T1.DName = 'Computer Science'; |
What is the id of the instructor who advises of all students from History department?
Schema:
- advisor(s_ID)
- student(COUNT, H, dept_name, name, tot_cred) | SELECT i_ID FROM advisor AS T1 JOIN student AS T2 ON T1.s_ID = T2.ID WHERE T2.dept_name = 'History'; |
What are the names of the top 8 countries by total invoice size and what are those sizes?
Schema:
- invoices(billing_city, billing_country, billing_state, total) | SELECT billing_country, SUM(total) AS total_invoice_size FROM invoices WHERE billing_country IS NOT NULL GROUP BY billing_country ORDER BY total_invoice_size DESC NULLS LAST LIMIT 8; |
For each city, how many branches opened before 2010?
Schema:
- branch(Address_road, City, Name, Open_year, membership_amount) | SELECT City, COUNT(*) AS num_branches FROM branch WHERE Open_year < 2010 GROUP BY City; |
What authors wrote papers about Bacterial Wilt in 2016 ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T3.authorId FROM paperKeyphrase AS T1 JOIN keyphrase AS T2 ON T1.keyphraseId = T2.keyphraseId JOIN paper AS T4 ON T4.paperId = T1.paperId JOIN writes AS T3 ON T3.paperId = T4.paperId JOIN author AS T5 ON T3.authorId = T5.authorId WHERE T2.keyphraseName = 'Bacterial Wilt' AND T4."year" = 2016; |
How many songs have vocals of type lead?
Schema:
- Vocals(COUNT, Type)
- Songs(Title) | SELECT COUNT(DISTINCT Title) AS num_songs FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Type = 'lead'; |
Show the product ids and the number of unique orders containing each product.?
Schema:
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) | SELECT product_id, COUNT(DISTINCT order_id) AS num_orders FROM Order_Items GROUP BY product_id; |
What is the average gradepoint for students with the last name Smith?
Schema:
- Enrolled_in(Fname, Grade, LName, StuID, T2, T3, gradepoint) | SELECT AVG(T2.gradepoint) AS avg_gradepoint FROM Enrolled_in AS T1, Gradeconversion AS T2, Student AS T3 WHERE T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID AND T3.LName = 'Smith'; |
How many different professors are there for the different schools?
Schema:
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE) | SELECT COUNT(*) AS num_professors, T1.SCHOOL_CODE FROM DEPARTMENT AS T1 JOIN PROFESSOR AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.SCHOOL_CODE; |
How many departments offer any degree?
Schema:
- Degree_Programs(degree_summary_name, department_id) | SELECT COUNT(DISTINCT department_id) AS num_departments FROM Degree_Programs; |
Find the start and end dates of detentions of teachers with last name "Schultz".?
Schema:
- Detention(detention_summary, detention_type_code)
- Teachers(email_address, first_name, gender, last_name) | SELECT T1.datetime_detention_start, datetime_detention_end FROM Detention AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.last_name = 'Schultz'; |
find the total checkins in Italian Delis in each state on Sunday?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state)
- checkin(...) | SELECT T1.state, SUM(T4."count") AS total_checkins FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN category AS T3 ON T3.business_id = T1.business_id JOIN checkin AS T4 ON T4.business_id = T1.business_id WHERE T2.category_name = 'Italian' AND T3.category_name = 'Delis' AND T4."day" = 'Sunday' GROUP BY T1.state; |
Who were the governors of the parties associated with delegates from district 1?
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 T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1; |
Count the total number of settlements made.?
Schema:
- Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount) | SELECT COUNT(*) AS num_settlements FROM Settlements; |
Sort employee names by their age in ascending order.?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) | SELECT Name FROM employee ORDER BY Age ASC NULLS LAST; |
display the department name and number of employees in each of the department.?
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))
- departments(DEPARTMENT_NAME, Market) | SELECT T2.DEPARTMENT_NAME, COUNT(*) AS num_employees FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID GROUP BY T2.DEPARTMENT_NAME; |
What is the last transcript release date?
Schema:
- Transcripts(other_details, transcript_date) | SELECT transcript_date FROM Transcripts ORDER BY transcript_date DESC NULLS LAST LIMIT 1; |
Give the flight numbers of flights arriving in Aberdeen.?
Schema:
- flights(DestAirport, FlightNo, SourceAirport)
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) | SELECT T1.FlightNo FROM flights AS T1 JOIN airports AS T2 ON T1.DestAirport = T2.AirportCode WHERE T2.City = 'Aberdeen'; |
What are the cities no customers live in?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- 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_Addresses(address_type_code) | SELECT city FROM Addresses WHERE city NOT IN (SELECT DISTINCT T3.city FROM Customers AS T1 JOIN Customer_Addresses AS T2 ON T1.customer_id = T2.customer_id JOIN Addresses AS T3 ON T2.address_id = T3.address_id); |
What are the name and population of each county?
Schema:
- county(County_name, Population, Zip_code) | SELECT County_name, Population FROM county; |
Find the number of projects which each scientist is working on and scientist's name.?
Schema:
- Scientists(Name)
- AssignedTo(Scientist) | SELECT COUNT(*) AS num_projects, T1.Name FROM Scientists AS T1 JOIN AssignedTo AS T2 ON T1.SSN = T2.Scientist GROUP BY T1.Name; |
which country did participated in the most number of Tournament competitions?
Schema:
- competition(COUNT, Competition_type, Country, T1, Year) | SELECT Country FROM competition WHERE Competition_type = 'Tournament' AND Country IS NOT NULL GROUP BY Country ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Which allergy has most number of students affected?
Schema:
- Has_Allergy(Allergy, COUNT, StuID) | SELECT Allergy FROM Has_Allergy WHERE Allergy IS NOT NULL GROUP BY Allergy ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the different names of all reviewers whose ratings do not have a date field?
Schema:
- Reviewer(Lew, name, rID)
- Rating(Rat, mID, rID, stars) | SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate IS NULL; |
What is the maximum accelerate for different number of cylinders?
Schema:
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year) | SELECT MAX(Accelerate) AS max_accelerate, Cylinders FROM cars_data GROUP BY Cylinders; |
List the document ids for any documents with the status code done and the type code paper.?
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_id FROM Documents WHERE document_status_code = 'done' AND document_type_code = 'Paper'; |
papers about WebKB?
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'; |
How many businesses in " San Diego " has Christine 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 T1.city = 'San Diego' AND T2."year" = 2010 AND T3.name = 'Christine'; |
Which papers are about about 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'; |
What distinct accelerator names are compatible with the browswers that have market share higher than 15?
Schema:
- Web_client_accelerator(Client, Operating_system)
- accelerator_compatible_browser(...)
- browser(id, market_share, name) | SELECT DISTINCT T1.name FROM Web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id JOIN browser AS T3 ON T2.browser_id = T3.id WHERE T3.market_share > 15; |
What are the names of the artists that are from the UK and sang songs in English?
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 T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.country = 'UK' AND T2.languages = 'english'; |
Which category does the product named "flax" belong to?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT product_category_code FROM Products WHERE product_name = 'flax'; |
How many clubs are located at "HHH"?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn) | SELECT COUNT(*) AS num_clubs FROM Club WHERE ClubLocation = 'HHH'; |
List top 10 employee work longest in the company. List employee's first and last 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 first_name, last_name FROM employees ORDER BY hire_date ASC NULLS LAST LIMIT 10; |
Show the dates of transactions if the share count is bigger than 100 or the amount is bigger than 1000.?
Schema:
- Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code) | SELECT date_of_transaction FROM Transactions WHERE TRY_CAST(share_count AS DOUBLE) > 100 OR amount_of_transaction > 1000; |
give me some good arabic restaurants in mountain view ?
Schema:
- restaurant(...)
- location(...) | SELECT T2.house_number, T1.name FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'mountain view' AND T1.food_type = 'arabic' AND T1.rating > 2.5; |
how long is the rio grande river in miles?
Schema:
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT LENGTH FROM river WHERE river_name = 'rio grande'; |
List the names of pilots that do not have any record.?
Schema:
- pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team)
- pilot_record(...) | SELECT Pilot_name FROM pilot WHERE Pilot_ID NOT IN (SELECT Pilot_ID FROM pilot_record); |
What is the name of the visitor who visited both a museum opened before 2009 and a museum opened after 2011?
Schema:
- visitor(Age, Level_of_membership, Name)
- visit(...)
- museum(Name, Open_Year) | SELECT T1.Name FROM visitor AS T1 JOIN visit AS T2 ON T1.ID = T2.visitor_ID JOIN museum AS T3 ON T3.Museum_ID = T2.Museum_ID WHERE T3.Open_Year < 2009 AND T1.Name IN (SELECT T1.Name FROM visitor AS T1 JOIN visit AS T2 ON T1.ID = T2.visitor_ID JOIN museum AS T3 ON T3.Museum_ID = T2.Museum_ID WHERE T3.Open_Year > 2011); |
Which submission received the highest score in acceptance result. Show me the result.?
Schema:
- Acceptance(...)
- submission(Author, COUNT, College, Scores) | SELECT T1."Result" FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY T2.Scores DESC NULLS LAST LIMIT 1; |
Return the names of the contestants whose names contain the substring 'Al' .?
Schema:
- CONTESTANTS(contestant_name) | SELECT contestant_name FROM CONTESTANTS WHERE contestant_name LIKE '%Al%'; |
Find the accreditation level that more than 3 phones use.?
Schema:
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode) | SELECT Accreditation_level FROM phone WHERE Accreditation_level IS NOT NULL GROUP BY Accreditation_level HAVING COUNT(*) > 3; |
Return the codes of the document types that do not have a total access count of over 10000.?
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 SUM(access_count) > 10000; |
Find the number of students taught by TARRING LEIA.?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName)
- teachers(Classroom, FirstName, LastName) | SELECT COUNT(*) AS num_students FROM list AS T1 JOIN teachers AS T2 ON T1.Classroom = T2.Classroom WHERE T2.FirstName = 'TARRING' AND T2.LastName = 'LEIA'; |
List all budget type codes and descriptions.?
Schema:
- Ref_Budget_Codes(Budget_Type_Code, Budget_Type_Description) | SELECT Budget_Type_Code, Budget_Type_Description FROM Ref_Budget_Codes; |
return me the number of papers written by " H. V. Jagadish " and " Divesh Srivastava " .?
Schema:
- writes(...)
- author(...)
- publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) | SELECT COUNT(DISTINCT T5.title) AS num_papers FROM writes AS T3 JOIN author AS T2 ON T3.aid = T2.aid JOIN publication AS T5 ON T3.pid = T5.pid JOIN writes AS T4 ON T4.pid = T5.pid JOIN author AS T1 ON T4.aid = T1.aid WHERE T2.name = 'H. V. Jagadish' AND T1.name = 'Divesh Srivastava'; |
What are the names of banks that have loaned money to customers with credit scores below 100?
Schema:
- loan(...)
- bank(SUM, bname, city, morn, no_of_customers, state)
- customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) | SELECT T2.bname FROM loan AS T1 JOIN bank AS T2 ON T1.branch_ID = CAST(T2.branch_ID AS TEXT) JOIN customer AS T3 ON T1.cust_ID = T3.cust_ID WHERE T3.credit_score < 100; |
what state has the largest population density?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM state WHERE density = (SELECT MAX(density) FROM state); |
What is the first name and country code of the player with the most tours?
Schema:
- players(COUNT, birth_date, country_code, first_name, hand, last_name)
- rankings(ranking_date, tours) | SELECT T1.country_code, T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id ORDER BY T2.tours DESC NULLS LAST LIMIT 1; |
Find the average age of the members in the club "Bootup Baltimore".?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn)
- Member_of_club(...)
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT AVG(T3.Age) AS avg_age FROM Club AS T1 JOIN Member_of_club AS T2 ON T1.ClubID = T2.ClubID JOIN Student AS T3 ON T2.StuID = T3.StuID WHERE T1.ClubName = 'Bootup Baltimore'; |
Find the make and production time of the cars that were produced in the earliest year?
Schema:
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
- car_names(COUNT, Model) | SELECT T2.Make, T1."Year" FROM cars_data AS T1 JOIN car_names AS T2 ON T1.Id = T2.MakeId WHERE T1."Year" = (SELECT MIN("Year") FROM cars_data); |
Find the name and email of the user followed by the least number of people.?
Schema:
- user_profiles(email, followers, name, partitionid) | SELECT name, email FROM user_profiles ORDER BY followers ASC NULLS LAST LIMIT 1; |
What is the total number of unique official languages spoken in the countries that are founded before 1930?
Schema:
- country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
- countrylanguage(COUNT, CountryCode, Engl, Language) | SELECT COUNT(DISTINCT T2."Language") AS num_languages FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE IndepYear < 1930 AND T2.IsOfficial = 'T'; |
Find the titles of items that received any rating below 5.?
Schema:
- item(title)
- review(i_id, rank, rating, text) | SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.