question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
Show the nicknames of schools that are not in division 1.?
Schema:
- school_details(Div, Division, Nickname) | SELECT Nickname FROM school_details WHERE Division != 'Division 1'; |
give me a good place on buchanan in san francisco for arabic food ?
Schema:
- restaurant(...)
- location(...) | SELECT T2.house_number, T1.name FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'san francisco' AND T2.street_name = 'buchanan' AND T1.food_type = 'arabic' AND T1.rating > 2.5; |
Return the titles of any movies with an R rating.?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) | SELECT title FROM film WHERE rating = 'R'; |
What are the names of procedures physician John Wen was trained in?
Schema:
- Physician(I, Name)
- Trained_In(...)
- Procedures(Cost, Name) | SELECT T3.Name FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment WHERE T1.Name = 'John Wen'; |
What are the different parties of representative? Show the party name and the number of representatives in each party.?
Schema:
- representative(JO, Lifespan, Name, Party, State, T1) | SELECT Party, COUNT(*) AS num_representatives FROM representative GROUP BY Party; |
Find the name and email of the users who have more than 1000 followers.?
Schema:
- user_profiles(email, followers, name, partitionid) | SELECT name, email FROM user_profiles WHERE followers > 1000; |
Which dogs are of the rarest breed? Show their names and treatment dates.?
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 T1.name, T2.date_of_treatment FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id = T2.dog_id WHERE T1.breed_code = (SELECT breed_code FROM Dogs WHERE breed_code IS NOT NULL GROUP BY breed_code ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1); |
Give me the name and description of the document type code RV.?
Schema:
- Ref_Document_Types(Document_Type_Code, Document_Type_Description, Document_Type_Name, document_type_code, document_type_description) | SELECT Document_Type_Name, Document_Type_Description FROM Ref_Document_Types WHERE Document_Type_Code = 'RV'; |
List all information about the assessment notes sorted by date in ascending order.?
Schema:
- Assessment_Notes(date_of_notes) | SELECT * FROM Assessment_Notes ORDER BY date_of_notes ASC NULLS LAST; |
How many employees live in Georgia?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) | SELECT COUNT(*) AS num_employees FROM Addresses WHERE state_province_county = 'Georgia'; |
Give the name of the student with the most 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 ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the number of professionals who have not treated any dogs.?
Schema:
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street)
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT COUNT(*) AS num_professionals FROM Professionals WHERE professional_id NOT IN (SELECT professional_id FROM Treatments); |
what is the largest city in the smallest state in the usa?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT city_name FROM city WHERE population = (SELECT MAX(population) FROM city WHERE state_name IN (SELECT state_name FROM state WHERE area = (SELECT MIN(area) FROM state))) AND state_name IN (SELECT state_name FROM state WHERE area = (SELECT MIN(area) FROM state)); |
Find the number of classes offered for all class rooms that held at least 2 classes.?
Schema:
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) | SELECT COUNT(*) AS num_classes, CLASS_ROOM FROM CLASS WHERE CLASS_ROOM IS NOT NULL GROUP BY CLASS_ROOM HAVING COUNT(*) >= 2; |
What are the distinct names of products purchased by at least two different customers?
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)
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT DISTINCT T3.product_name FROM Customer_Orders AS T1 JOIN Order_Items AS T2 ON T1.order_id = T2.order_id JOIN Products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id, T3.product_name HAVING COUNT(DISTINCT T1.customer_id) >= 2; |
Show the medicine names and trade names that cannot interact with the enzyme with product 'Heme'.?
Schema:
- medicine(FDA_approved, Trade_Name, name)
- medicine_enzyme_interaction(interaction_type)
- enzyme(Chromosome, Location, OMIM, Porphyria, Product, name) | SELECT T1.name, T1.Trade_Name FROM medicine AS T1 LEFT JOIN (SELECT T1.name, T1.Trade_Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id JOIN enzyme AS T3 ON T3.id = T2.enzyme_id WHERE T3.Product = 'Protoporphyrinogen IX') AS T2 ON T1.name = T2.name AND T1.Trade_Name = T2.Trade_Name WHERE T2.name IS NULL; |
Find the names of the channels that are broadcast in the morning.?
Schema:
- channel(Name, Owner, Rating_in_percent, Share_in_percent)
- broadcast(Program_ID, Time_of_day) | SELECT T1.Name FROM channel AS T1 JOIN broadcast AS T2 ON T1.Channel_ID = T2.Channel_ID WHERE T2.Time_of_day = 'Morning'; |
Find the IDs of customers whose name contains "Diana".?
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_ID FROM Customers WHERE Customer_name LIKE '%Diana%'; |
What are the names of all courses that have some students enrolled?
Schema:
- Courses(course_description, course_name)
- Student_Enrolment_Courses(...) | SELECT DISTINCT T1.course_name FROM Courses AS T1 JOIN Student_Enrolment_Courses AS T2 ON T1.course_id = T2.course_id; |
how tall is the highest point in delaware?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT highest_elevation FROM highlow WHERE state_name = 'delaware'; |
What instrument did the musician with last name "Heilo" use in the song "Badlands"?
Schema:
- Performance(...)
- Band(...)
- Songs(Title)
- Instruments(COUNT, Instrument) | SELECT T4.Instrument FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id JOIN Songs AS T3 ON T3.SongId = T1.SongId JOIN Instruments AS T4 ON T4.SongId = T3.SongId AND T4.BandmateId = T2.Id WHERE T2.Lastname = 'Heilo' AND T3.Title = 'Badlands'; |
Count the number of authors.?
Schema:
- Authors(fname, lname) | SELECT COUNT(*) AS num_authors FROM Authors; |
List the names of aircrafts and the number of times it won matches.?
Schema:
- aircraft(Description, aid, d, distance, name)
- match_(Competition, Date, Match_ID, Venue) | SELECT T1.Aircraft, COUNT(*) AS num_wins FROM aircraft AS T1 JOIN match_ AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T1.Aircraft_ID, T1.Aircraft; |
Find the number of dorms and 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; |
give me some good places for arabic on buchanan in san francisco ?
Schema:
- restaurant(...)
- location(...) | SELECT T2.house_number, T1.name FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'san francisco' AND T2.street_name = 'buchanan' AND T1.food_type = 'arabic' AND T1.rating > 2.5; |
What are the names of the teachers and how many courses do they teach?
Schema:
- course_arrange(...)
- teacher(Age, COUNT, D, Hometown, Name) | SELECT T2.Name, COUNT(*) AS num_courses FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name; |
which state has the highest 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); |
Which player has the most all star game experiences? Give me the first name, last name and id of the player, as well as the number of times the player participated in all star game.?
Schema:
- player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
- all_star(...) | SELECT T1.name_first, T1.name_last, T1.player_id, COUNT(*) AS num_all_star_games FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id GROUP BY T1.name_first, T1.name_last, T1.player_id ORDER BY num_all_star_games DESC NULLS LAST LIMIT 1; |
Find the names of accounts whose checking balance is above the average checking balance, but savings balance is below the average savings balance.?
Schema:
- ACCOUNTS(name)
- CHECKING(balance)
- SAVINGS(SAV, balance) | SELECT T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid WHERE T2.balance > (SELECT AVG(balance) FROM CHECKING) AND T3.balance < (SELECT AVG(balance) FROM SAVINGS); |
datasets used by semantic parsing papers?
Schema:
- paperDataset(...)
- dataset(...)
- paperKeyphrase(...)
- keyphrase(...) | SELECT DISTINCT T2.datasetId FROM paperDataset AS T3 JOIN dataset AS T2 ON T3.datasetId = T2.datasetId JOIN paperKeyphrase AS T1 ON T1.paperId = T3.paperId JOIN keyphrase AS T4 ON T1.keyphraseId = T4.keyphraseId WHERE T4.keyphraseName = 'semantic parsing'; |
What are the names of parties and their respective regions?
Schema:
- party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
- region(Label, Region_code, Region_name) | SELECT T1.Party_name, T2.Region_name FROM party AS T1 JOIN region AS T2 ON T1.Region_ID = T2.Region_ID; |
What are the different fates of the mission that involved ships from the United States?
Schema:
- mission(...)
- ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage) | SELECT DISTINCT T1.Fate FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2.Nationality = 'United States'; |
What is the total budget amount for school "Glenn" in all years?
Schema:
- budget(Budgeted)
- School(County, Enrollment, Location, Mascot, School_name) | SELECT SUM(T1.Budgeted) AS total_budget FROM budget AS T1 JOIN School AS T2 ON CAST(T1.School_id AS TEXT) = T2.School_id WHERE T2.School_name = 'Glenn'; |
What is the label that has the most albums?
Schema:
- Albums(COUNT, Label, Title) | SELECT Label FROM Albums WHERE Label IS NOT NULL GROUP BY Label ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Give the budget type code that is most common among documents with expenses.?
Schema:
- Documents_with_Expenses(Budget_Type_Code, COUNT, Document_ID) | SELECT Budget_Type_Code FROM Documents_with_Expenses WHERE Budget_Type_Code IS NOT NULL GROUP BY Budget_Type_Code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find id of the candidate who most recently completed their assesment the course?
Schema:
- Candidate_Assessments(asessment_outcome_code, assessment_date, candidate_id) | SELECT candidate_id FROM Candidate_Assessments ORDER BY assessment_date DESC NULLS LAST LIMIT 1; |
Which campus has the most faculties in year 2003?
Schema:
- Campuses(Campus, County, Franc, Location)
- faculty(Faculty) | SELECT T1.Campus FROM Campuses AS T1 JOIN faculty AS T2 ON T1.Id = T2.Campus WHERE T2."Year" = 2003 ORDER BY T2.Faculty DESC NULLS LAST LIMIT 1; |
Which city is the address of the store named "FJA Filming" located in?
Schema:
- Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
- Stores(...) | SELECT T1.City_Town FROM Addresses AS T1 JOIN Stores AS T2 ON T1.Address_ID = CAST(T2.Address_ID AS TEXT) WHERE T2.Store_Name = 'FJA Filming'; |
What are the names of all employees who are not certified to fly Boeing 737-800s?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
- certificate(eid)
- aircraft(Description, aid, d, distance, name) | SELECT name FROM employee WHERE name NOT IN (SELECT T1.name FROM employee AS T1 JOIN certificate AS T2 ON T1.eid = T2.eid JOIN aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Boeing 737-800'); |
Find the average grade point of student whose last name is Smith.?
Schema:
- Enrolled_in(Fname, Grade, LName, StuID, T2, T3, gradepoint) | SELECT AVG(T2.gradepoint) AS avg_grade_point 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'; |
What are the details for the projects which were launched by the organization with the most projects?
Schema:
- Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) | SELECT project_details FROM Projects WHERE organisation_id IN (SELECT organisation_id FROM Projects WHERE organisation_id IS NOT NULL GROUP BY organisation_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1); |
top syntactic parsing author?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...) | SELECT DISTINCT COUNT(T4.paperId) AS num_papers, 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 WHERE T2.keyphraseName = 'syntactic parsing' GROUP BY T3.authorId ORDER BY num_papers DESC NULLS LAST; |
What are the ids, names, dates of opening, and other details for accounts corresponding to the customer with the first name "Meaghan"?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
- 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 T1.account_id, T1.date_account_opened, T1.account_name, T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan'; |
List the name of actors whose age is not 20.?
Schema:
- actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) | SELECT Name FROM actor WHERE age != 20; |
Show the name and date for each race and its track name.?
Schema:
- race(Class, Date, Name)
- track(Location, Name, Seat, Seating, T1, Year_Opened) | SELECT T1.Name, T1."Date", T2.Name FROM race AS T1 JOIN track AS T2 ON T1.Track_ID = CAST(T2.Track_ID AS TEXT); |
Find the the name of the customers who have a loan with amount more than 3000.?
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 WHERE amount > 3000; |
List all schools and their nicknames in the order of founded year.?
Schema:
- university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School) | SELECT School, Nickname FROM university ORDER BY Founded ASC NULLS LAST; |
What are the title and rental rate of the film with the highest rental rate?
Schema:
- film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) | SELECT title, rental_rate FROM film ORDER BY rental_rate DESC NULLS LAST LIMIT 1; |
What are the first names of all the students aged above 22?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT Fname FROM Student WHERE Age > 22; |
What are the song titles and singer names?
Schema:
- singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
- song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more)) | SELECT T2.Title, T1.Name FROM singer AS T1 JOIN song AS T2 ON T1.Singer_ID = T2.Singer_ID; |
What are teh names of the different products, as well as the number of customers who have ordered each product.?
Schema:
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Orders(customer_id, date_order_placed, order_id) | SELECT T2.product_name, COUNT(*) AS num_customers FROM Order_Items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T3.order_id = T1.order_id GROUP BY T2.product_name; |
Which events id does not have any participant with detail 'Kenyatta Kuhn'?
Schema:
- Events(...)
- Participants_in_Events(COUNT, Event_ID, Participant_ID)
- Participants(Participant_Details, Participant_ID, Participant_Type_Code) | SELECT E.Event_ID FROM Events E LEFT JOIN (SELECT T1.Event_ID FROM Participants_in_Events AS T1 JOIN Participants AS T2 ON T1.Participant_ID = T2.Participant_ID WHERE T2.Participant_Details = 'Kenyatta Kuhn') AS P ON E.Event_ID = P.Event_ID WHERE P.Event_ID IS NULL; |
Find the number of checking accounts for each account name.?
Schema:
- ACCOUNTS(name)
- CHECKING(balance) | SELECT COUNT(*) AS num_checking_accounts, T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid GROUP BY T1.name; |
What document status codes do we have?
Schema:
- Ref_Document_Status(document_status_code, document_status_description, work) | SELECT document_status_code FROM Ref_Document_Status; |
Find the number of activities available.?
Schema:
- Activity(activity_name) | SELECT COUNT(*) AS num_activities FROM Activity; |
Show locations and nicknames of schools.?
Schema:
- school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type)
- school_details(Div, Division, Nickname) | SELECT T1.Location, T2.Nickname FROM school AS T1 JOIN school_details AS T2 ON T1.School_ID = T2.School_ID; |
Count the number of rooms in Lamberton with capacity lower than 50.?
Schema:
- classroom(building, capacity, room_number) | SELECT COUNT(*) AS num_rooms FROM classroom WHERE building = 'Lamberton' AND capacity < 50; |
what is the smallest state through which the longest river runs?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT state_name FROM state WHERE area = (SELECT MIN(area) FROM state WHERE state_name IN (SELECT traverse FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river))) AND state_name IN (SELECT traverse FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river)); |
Which airlines have departing flights from both APG and CVO airports?
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 WHERE T2.SourceAirport IN ('APG', 'CVO') GROUP BY T1.Airline HAVING COUNT(DISTINCT T2.SourceAirport) = 2; |
What is the name of the customer who has the largest number of orders?
Schema:
- Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
- Orders(customer_id, date_order_placed, order_id) | SELECT T1.customer_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id, T1.customer_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What was oren etzioni 's latest paper ?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT T2.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'oren etzioni' GROUP BY T2.paperId, T3."year" ORDER BY T3."year" DESC NULLS LAST; |
Which movie had the character " Daffy Duck "?
Schema:
- movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
- cast_(...) | SELECT T1.title FROM movie AS T1 JOIN cast_ AS T2 ON T1.mid = T2.msid WHERE T2.role = 'Daffy Duck'; |
What is the id of the most recent order?
Schema:
- Orders(customer_id, date_order_placed, order_id) | SELECT order_id FROM Orders ORDER BY date_order_placed DESC NULLS LAST LIMIT 1; |
What is the customer last name, id and phone number with most number of orders?
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_last_name, T1.customer_id, T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_last_name, T1.customer_id, T2.phone_number ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Find the id and first name of the student that has the most number of assessment notes?
Schema:
- Assessment_Notes(date_of_notes)
- Students(cell_mobile_number, current_address_id, date_first_registered, date_left, date_of_latest_logon, email_address, family_name, first_name, last_name, login_name, middle_name, other_student_details, ... (1 more)) | SELECT T1.student_id, T2.first_name FROM Assessment_Notes AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id, T2.first_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
what are the names of people who did not participate in the candidate election.?
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 Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM candidate); |
What are the headquarters that have both a company in the banking and 'oil and gas' industries?
Schema:
- company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) | SELECT DISTINCT T1.Headquarters FROM company AS T1 JOIN company AS T2 ON T1.Headquarters = T2.Headquarters WHERE T1.Main_Industry = 'Banking' AND T2.Main_Industry = 'Oil and gas'; |
Show me some recent papers on deep learning ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT T3.paperId, 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 = 'deep learning' ORDER BY T3."year" DESC NULLS LAST; |
Give the average number of cities within markets that had a low market estimation larger than 10000?
Schema:
- film_market_estimation(High_Estimate, Low_Estimate, Type)
- market(Country, Number_cities) | SELECT AVG(T2.Number_cities) AS avg_number_cities FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID WHERE T1.Low_Estimate > 10000; |
What are the names of conductors who have conducted at more than one orchestra?
Schema:
- conductor(Age, Name, Nationality, Year_of_Work)
- orchestra(COUNT, Major_Record_Format, Record_Company, Year_of_Founded) | SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID GROUP BY T2.Conductor_ID, T1.Name HAVING COUNT(*) > 1; |
What is the name of the department with the most students enrolled?
Schema:
- CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
- ENROLL(...)
- COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT T4.DEPT_NAME FROM CLASS AS T1 JOIN ENROLL AS T2 ON T1.CLASS_CODE = T2.CLASS_CODE JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN DEPARTMENT AS T4 ON T3.DEPT_CODE = T4.DEPT_CODE GROUP BY T3.DEPT_CODE, T4.DEPT_NAME ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
For each zip code, what is the average mean temperature for all dates that start with '8'?
Schema:
- weather(AVG, COUNT, M, Ra, cloud_cover, date, diff, events, mean_humidity, mean_sea_level_pressure_inches, mean_temperature_f, mean_visibility_miles, ... (1 more)) | SELECT zip_code, AVG(mean_temperature_f) AS avg_mean_temperature FROM weather WHERE "date" LIKE '8/%' GROUP BY zip_code; |
What are the ids of all students who live in CHI?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) | SELECT StuID FROM Student WHERE city_code = 'CHI'; |
What are the average and minimum age of captains in different class?
Schema:
- captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l) | SELECT AVG(TRY_CAST(age AS INT)) AS avg_age, MIN(TRY_CAST(age AS INT)) AS min_age, Class FROM captain GROUP BY Class; |
What are the distinct names and nationalities of the architects who have ever built a mill?
Schema:
- architect(gender, id, name, nationality)
- mill(Moul, location, name, type) | SELECT DISTINCT T1.name, T1.nationality FROM architect AS T1 JOIN mill AS T2 ON T1.id = CAST(T2.architect_id AS TEXT); |
How many 'United Airlines' flights go to Airport 'ASY'?
Schema:
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
- flights(DestAirport, FlightNo, SourceAirport) | SELECT COUNT(*) AS num_flights FROM airlines AS T1 JOIN flights AS T2 ON T2.Airline = T1.uid WHERE T1.Airline = 'United Airlines' AND T2.DestAirport = 'ASY'; |
How many clubs have total medals less than 10?
Schema:
- club_rank(Gold, Silver, Total) | SELECT COUNT(*) AS num_clubs FROM club_rank WHERE Total < 10; |
What is the the phone number of Nancy Edwards?
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 phone FROM employees WHERE first_name = 'Nancy' AND last_name = 'Edwards'; |
Which documents have more than 1 draft copies? List document id and number of draft copies.?
Schema:
- Draft_Copies(copy_number, document_id) | SELECT document_id, COUNT(*) AS num_draft_copies FROM Draft_Copies WHERE document_id IS NOT NULL GROUP BY document_id HAVING COUNT(*) > 1; |
what is the highest point in the state with capital des moines?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT highest_point FROM highlow WHERE state_name IN (SELECT state_name FROM state WHERE capital = 'des moines'); |
Show all distinct lot details.?
Schema:
- Lots(investor_id, lot_details) | SELECT DISTINCT lot_details FROM Lots; |
how many citations does noah a smith have ?
Schema:
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- cite(...)
- writes(...)
- author(...) | SELECT DISTINCT COUNT(T4.citedPaperId) AS num_citations FROM paper AS T3 JOIN cite AS T4 ON T3.paperId = T4.citedPaperId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'noah a smith'; |
List names of conductors in descending order of years of work.?
Schema:
- conductor(Age, Name, Nationality, Year_of_Work) | SELECT Name FROM conductor ORDER BY Year_of_Work DESC NULLS LAST; |
What are the first names of all the different drivers in alphabetical order?
Schema:
- drivers(forename, nationality, surname) | SELECT DISTINCT forename FROM drivers ORDER BY forename ASC NULLS LAST; |
Which are the first and last names of the students taught by MARROTTE KIRK?
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 = 'MARROTTE' AND T2.LastName = 'KIRK'; |
When did the staff member Janessa Sawayn leave the company?
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 date_left_staff FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'; |
What are the types of competition that have most 5 competitions for that type?
Schema:
- competition(COUNT, Competition_type, Country, T1, Year) | SELECT Competition_type FROM competition WHERE Competition_type IS NOT NULL GROUP BY Competition_type HAVING COUNT(*) <= 5; |
How many statements do we have?
Schema:
- Statements(Statement_Details, Statement_ID) | SELECT COUNT(*) AS num_statements FROM Statements; |
Show all card type codes and the number of customers holding cards in each type.?
Schema:
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to) | SELECT card_type_code, COUNT(DISTINCT customer_id) AS num_customers FROM Customers_Cards GROUP BY card_type_code; |
What is the id of the department with the least number of staff?
Schema:
- Staff_Department_Assignments(COUNT, date_assigned_to, department_id, job_title_code, staff_id) | SELECT department_id FROM Staff_Department_Assignments WHERE department_id IS NOT NULL GROUP BY department_id ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
What are the different schools and their nicknames, ordered by their founding years?
Schema:
- university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School) | SELECT School, Nickname FROM university ORDER BY Founded ASC NULLS LAST; |
Find the number of albums.?
Schema:
- Album(Title) | SELECT COUNT(*) AS num_albums FROM Album; |
Give the product id for the product that was ordered most frequently.?
Schema:
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) | SELECT product_id FROM Order_Items WHERE product_id IS NOT NULL GROUP BY product_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
Liwen Xiong 's papers 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 are the names, color descriptions, and product descriptions for products in the 'Herbs' category?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
- Ref_Colors(color_description) | SELECT T1.product_name, T2.color_description, T1.product_description FROM Products AS T1 JOIN Ref_Colors AS T2 ON T1.color_code = T2.color_code WHERE product_category_code = 'Herbs'; |
Which model of the car has the minimum horsepower?
Schema:
- car_names(COUNT, Model)
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year) | SELECT T1.Model FROM car_names AS T1 JOIN cars_data AS T2 ON T1.MakeId = T2.Id ORDER BY T2.Horsepower ASC NULLS LAST LIMIT 1; |
Find the physicians who are trained in a procedure that costs more than 5000.?
Schema:
- Physician(I, Name)
- Trained_In(...)
- Procedures(Cost, Name) | SELECT T1.Name FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment WHERE T3.Cost > 5000; |
Which game type has least number of games?
Schema:
- Video_Games(COUNT, Dest, GName, GType, onl) | SELECT GType FROM Video_Games WHERE GType IS NOT NULL GROUP BY GType ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1; |
main topics of work by Brian DeRenzi?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- writes(...)
- author(...) | SELECT DISTINCT T1.keyphraseName, SUM(T3.numCitedBy) AS num_cited_by FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T5 ON T4.authorId = T5.authorId WHERE T5.authorName = 'Brian DeRenzi' GROUP BY T1.keyphraseName ORDER BY num_cited_by DESC NULLS LAST; |
What are the start date and end date of the apartment bookings made by female guests (gender code "Female")?
Schema:
- Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code)
- Guests(date_of_birth, gender_code, guest_first_name, guest_last_name) | SELECT T1.booking_start_date, T1.booking_end_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = 'Female'; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.