question
stringlengths
43
589
query
stringlengths
19
598
what is the name and nation of the singer who have a song having 'Hey' in its name? Schema: - singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
SELECT Name, Country FROM singer WHERE Song_Name LIKE '%Hey%';
What are the names of customers with accounts, and what are the total savings balances for each? Schema: - ACCOUNTS(name) - SAVINGS(SAV, balance)
SELECT SUM(T2.balance) AS total_savings_balance, T1.name FROM ACCOUNTS AS T1 JOIN SAVINGS AS T2 ON T1.custid = T2.custid GROUP BY T1.name;
How many debit cards do we have? Schema: - Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to)
SELECT COUNT(*) AS num_debit_cards FROM Customers_Cards WHERE card_type_code = 'Debit';
Find the state which has the most number of customers.? Schema: - bank(SUM, bname, city, morn, no_of_customers, state)
SELECT state FROM bank WHERE state IS NOT NULL GROUP BY state ORDER BY SUM(no_of_customers) DESC NULLS LAST LIMIT 1;
What are flight numbers of flights departing from Airport "APG"? Schema: - flights(DestAirport, FlightNo, SourceAirport)
SELECT FlightNo FROM flights WHERE SourceAirport = 'APG';
What are the different instruments listed in the database? Schema: - Instruments(COUNT, Instrument)
SELECT DISTINCT Instrument FROM Instruments;
Show institution types, along with the number of institutions and total enrollment for each type.? Schema: - Institution(COUNT, Enrollment, Founded, Type)
SELECT Type, COUNT(*) AS num_institutions, SUM(Enrollment) AS total_enrollment FROM Institution GROUP BY Type;
How many male (sex is M) students have class senator votes in the fall election cycle? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote)
SELECT COUNT(*) AS num_male_students FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.Sex = 'M' AND T2.Election_Cycle = 'Fall';
What are the countries of all airlines whose names start with Orbit? Schema: - airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
SELECT country FROM airlines WHERE name LIKE 'Orbit%';
How many courses does the student with id 171 actually attend? Schema: - Courses(course_description, course_name) - Student_Course_Attendance(course_id, date_of_attendance, student_id)
SELECT COUNT(*) AS num_courses FROM Courses AS T1 JOIN Student_Course_Attendance AS T2 ON T1.course_id = CAST(T2.course_id AS TEXT) WHERE T2.student_id = 171;
What are the ids of all students who are not video game players? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - Plays_Games(GameID, Hours_Played, StuID)
SELECT StuID FROM Student WHERE StuID NOT IN (SELECT StuID FROM Plays_Games);
Who are the friends of Alice that are doctors? 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.friend WHERE T2.name = 'Alice' AND T1.gender = 'male' AND T1.job = 'doctor';
Show the id and details of the investor that has the largest number of transactions.? Schema: - Investors(Investor_details) - Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code)
SELECT T2.investor_id, T1.Investor_details FROM Investors AS T1 JOIN Transactions AS T2 ON T1.investor_id = T2.investor_id GROUP BY T2.investor_id, T1.Investor_details ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
How many distinct locations have the things with service detail 'Unsatisfied' been located in? Schema: - Things(...) - Timed_Locations_of_Things(...)
SELECT COUNT(DISTINCT T2.Location_Code) AS num_locations FROM Things AS T1 JOIN Timed_Locations_of_Things AS T2 ON T1.thing_id = T2.thing_id WHERE T1.service_details = 'Unsatisfied';
How films are produced by each studio? Schema: - film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
SELECT Studio, COUNT(*) AS num_films FROM film GROUP BY Studio;
Find the phone number of performer "Ashley".? Schema: - Performers(Customer_Name, Customer_Phone)
SELECT Customer_Phone FROM Performers WHERE Customer_Name = 'Ashley';
Show the ids for all the students who participate in an activity and are under 20.? Schema: - Participates_in(...) - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT DISTINCT StuID FROM Participates_in WHERE StuID IN (SELECT StuID FROM Student WHERE Age < 20);
What states have at least two representatives? Schema: - representative(JO, Lifespan, Name, Party, State, T1)
SELECT State FROM representative WHERE State IS NOT NULL GROUP BY State HAVING COUNT(*) >= 2;
What is the budget type code with most number of documents.? 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;
What is the total number of rooms available in this inn? Schema: - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT COUNT(*) AS num_rooms FROM Rooms;
Return the name of the mountain with the greatest height.? Schema: - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT Name FROM mountain ORDER BY Height DESC NULLS LAST LIMIT 1;
Find the total number of rooms in the apartments that have facility code "Gym".? Schema: - Apartment_Facilities(...) - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT SUM(TRY_CAST(T2.room_count AS INT)) AS total_rooms FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = 'Gym';
What is the country with the most number of TV Channels and how many does it have? Schema: - TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name)
SELECT Country, COUNT(*) AS num_channels FROM TV_Channel WHERE Country IS NOT NULL GROUP BY Country ORDER BY num_channels DESC NULLS LAST LIMIT 1;
What country is the artist who made the fewest songs from? Schema: - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name, T1.country ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
What is the average fee on a CSU campus in 2005? Schema: - csu_fees(CampusFee)
SELECT AVG(CampusFee) AS avg_fee FROM csu_fees WHERE "Year" = 2005;
return me the 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 T5.title 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 is the average points of players from club with name "AIB".? Schema: - club(Region, Start_year, name) - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
SELECT AVG(T2.Points) AS avg_points FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = 'AIB';
Show all the distinct product names with price higher than the average.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT DISTINCT Product_Name FROM Products WHERE Product_Price > (SELECT AVG(Product_Price) FROM Products);
Show the detail of vehicle with id 1.? Schema: - Vehicles(vehicle_details, vehicle_id)
SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1;
Show codes and fates of missions, and names of ships involved.? Schema: - mission(...) - ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage)
SELECT T1.Code, T1.Fate, T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID;
papers with Question Answering in keyphrases? 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';
Find the name, city, country, and altitude (or elevation) of the airports in the city of New York.? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT name, city, country, elevation FROM airports WHERE city = 'New York';
what are the papers that have Peter Mertens and Dina Barbian as co-authors? 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 transaction does each account have? Show the number and account id.? Schema: - Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type)
SELECT COUNT(*) AS num_transactions, account_id FROM Financial_Transactions GROUP BY account_id;
What is the name of the patient who made the most recent appointment? Schema: - Patient(...) - Appointment(AppointmentID, Start)
SELECT T1.Name FROM Patient AS T1 JOIN Appointment AS T2 ON T1.SSN = T2.Patient ORDER BY T2."Start" DESC NULLS LAST LIMIT 1;
What are the name, origin and owner of each program? Schema: - program(Beij, Launch, Name, Origin, Owner)
SELECT Name, Origin, Owner FROM program;
Find the organisation type description of the organisation detailed as 'quo'.? Schema: - Organisation_Types(...) - Organisations(...)
SELECT T1.organisation_type_description FROM Organisation_Types AS T1 JOIN Organisations AS T2 ON T1.organisation_type = T2.organisation_type WHERE T2.organisation_details = 'quo';
Find the id and star rating of each hotel and sort them in increasing order of price.? Schema: - Hotels(hotel_id, other_hotel_details, pets_allowed_yn, price_range, star_rating_code)
SELECT hotel_id, star_rating_code FROM Hotels ORDER BY price_range ASC NULLS LAST;
What are the titles for courses with two prerequisites? Schema: - course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) - prereq(...)
SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id, T1.title HAVING COUNT(*) = 2;
Show the names of singers that have more than one song.? 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 T1.Name FROM singer AS T1 JOIN song AS T2 ON T1.Singer_ID = T2.Singer_ID GROUP BY T1.Name HAVING COUNT(*) > 1;
return me the paper after 2000 in Databases area with the most citations .? Schema: - domain(...) - domain_publication(...) - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
SELECT T3.title FROM domain AS T2 JOIN domain_publication AS T1 ON T2.did = T1.did JOIN publication AS T3 ON T3.pid = T1.pid WHERE T2.name = 'Databases' AND T3."year" > 2000 ORDER BY T3.citation_num DESC NULLS LAST LIMIT 1;
What is the name of the series that has the episode "A Love of a Lifetime"? Schema: - TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name) - TV_series(Air_Date, Episode, Rating, Share, Weekly_Rank)
SELECT T1.series_name FROM TV_Channel AS T1 JOIN TV_series AS T2 ON T1.id = T2.Channel WHERE T2.Episode = 'A Love of a Lifetime';
How many allergy entries are there? Schema: - Allergy_Type(Allergy, AllergyType, COUNT)
SELECT COUNT(DISTINCT Allergy) AS num_allergies FROM Allergy_Type;
How many lessons did the customer Ryan Goodwin complete? Schema: - Lessons(lesson_status_code) - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
SELECT COUNT(*) AS num_lessons FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Rylan' AND T2.last_name = 'Goodwin' AND T1.lesson_status_code = 'Completed';
Show the name of colleges that have at least two players.? Schema: - match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team)
SELECT College FROM match_season WHERE College IS NOT NULL GROUP BY College HAVING COUNT(*) >= 2;
Which rooms cost between 120 and 150? Give me the room names.? Schema: - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT roomName FROM Rooms WHERE basePrice BETWEEN 120 AND 150;
In what scholarly journals does Takashi Matsumoto publish ? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.journalId 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 = 'Takashi Matsumoto' GROUP BY T3.journalId;
How many editors are there? Schema: - editor(Age, COUNT, Name)
SELECT COUNT(*) AS num_editors FROM editor;
Show the number of accounts.? Schema: - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
SELECT COUNT(*) AS num_accounts FROM Accounts;
what is the lowest point in the state of iowa? Schema: - highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
SELECT lowest_point FROM highlow WHERE state_name = 'iowa';
how many papers does David M. Blei have in 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';
What is the highest acc percent score in the competition? Schema: - basketball_match(ACC_Percent, All_Home, School_ID, Team_Name)
SELECT ACC_Percent FROM basketball_match ORDER BY ACC_Percent DESC NULLS LAST LIMIT 1;
return me the author in the " University of Michigan " in Databases area whose papers have more than 5000 total citations .? Schema: - domain_author(...) - author(...) - domain(...) - organization(continent, homepage, name) - writes(...) - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
SELECT T1.name FROM domain_author AS T6 JOIN author AS T1 ON T6.aid = T1.aid JOIN domain AS T3 ON T3.did = T6.did JOIN organization AS T5 ON T5.oid = T1.oid JOIN writes AS T2 ON T2.aid = T1.aid JOIN publication AS T4 ON T2.pid = T4.pid WHERE T3.name = 'Databases' AND T5.name = 'University of Michigan' GROUP BY T1.name HAVING SUM(T4.citation_num) > 5000;
How many institutions are there? Schema: - Inst(...)
SELECT COUNT(*) AS num_institutions FROM Inst;
display all the information of those employees who did not have any job in the past.? 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)) - job_history(EMPLOYEE_ID, END_DATE, JOB_ID)
SELECT * FROM employees WHERE EMPLOYEE_ID NOT IN (SELECT EMPLOYEE_ID FROM job_history);
What is the total likes on tips from Niloofar about " Cafe Zinho "? Schema: - tip(month, text) - business(business_id, city, full_address, name, rating, review_count, state) - user_(name)
SELECT SUM(T2.likes) AS total_likes FROM tip 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.name = 'Cafe Zinho' AND T3.name = 'Niloofar';
Find the name, city, and country of the airport that has the lowest altitude.? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT name, city, country FROM airports ORDER BY elevation ASC NULLS LAST LIMIT 1;
What are the names of all Rock tracks that are stored on MPEG audio files? Schema: - genres(name) - tracks(composer, milliseconds, name, unit_price) - media_types(name)
SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = 'Rock' AND T3.name = 'MPEG audio file';
What are the highest and lowest prices of products, grouped by and alphabetically ordered by product type? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT MAX(product_price) AS max_price, MIN(product_price) AS min_price, product_type_code FROM Products WHERE product_type_code IS NOT NULL GROUP BY product_type_code ORDER BY product_type_code ASC NULLS LAST;
How many bookings does each booking status have? List the booking status code and the number of corresponding bookings.? Schema: - Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code)
SELECT booking_status_code, COUNT(*) AS num_bookings FROM Apartment_Bookings GROUP BY booking_status_code;
How many co-authors has Mark Steedman had ? Schema: - writes(...) - author(...)
SELECT DISTINCT COUNT(DISTINCT T1.authorId) AS num_authors FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName != 'Mark Steedman' AND T2.paperId IN (SELECT T2.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'Mark Steedman');
Give the number of students living in either HKG or CHI.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT COUNT(*) AS num_students FROM Student WHERE city_code = 'HKG' OR city_code = 'CHI';
What are the ids for transactions that have an amount greater than the average amount of a transaction? Schema: - Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type)
SELECT transaction_id FROM Financial_Transactions WHERE transaction_amount > (SELECT AVG(transaction_amount) FROM Financial_Transactions);
List the cities which have more than one airport and number of airports.? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT city, COUNT(*) AS num_airports FROM airports WHERE city IS NOT NULL GROUP BY city HAVING COUNT(*) > 1;
Find the student first and last names and grade points of all enrollments.? Schema: - Enrolled_in(Fname, Grade, LName, StuID, T2, T3, gradepoint)
SELECT T3.Fname, T3.LName, T2.gradepoint FROM Enrolled_in AS T1, Gradeconversion AS T2, Student AS T3 WHERE T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID;
Show the document name and the document date for all documents on project with details 'Graph Database project'.? 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)) - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
SELECT Document_Name, Document_Date FROM Documents AS T1 JOIN Projects AS T2 ON T1.Project_ID = T2.Project_ID WHERE T2.Project_Details = 'Graph Database project';
What are the building, room number, semester and year of courses in the Psychology department, sorted using course title? Schema: - course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) - section(COUNT, JO, Spr, T1, course_id, semester, year)
SELECT T2.building, T2.room_number, T2.semester, T2."year" FROM course AS T1 JOIN section AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title ASC NULLS LAST;
Find the name of customer who has the lowest credit score.? Schema: - customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id)
SELECT cust_name FROM customer ORDER BY credit_score ASC NULLS LAST LIMIT 1;
How many students are enrolled in colleges that have student accepted during tryouts, and in which states are those colleges? Schema: - College(M, cName, enr, state) - Tryout(COUNT, EX, T1, cName, decision, pPos)
SELECT DISTINCT T1.state, T1.enr FROM College AS T1 JOIN Tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes';
Find all movies written and produced by " Woody Allen "? Schema: - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) - made_by(...) - producer(...) - written_by(...) - writer(...)
SELECT T2.title FROM movie AS T2 JOIN made_by AS T3 ON T2.mid = T3.msid JOIN producer AS T1 ON T1.pid = T3.pid JOIN written_by AS T5 ON T5.msid = T2.mid JOIN writer AS T4 ON T5.wid = T4.wid WHERE T1.name = 'Woody Allen' AND T4.name = 'Woody Allen';
what can you tell me about the population of california? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT population FROM state WHERE state_name = 'california';
Find the last name and hire date of the professor who is in office DRE 102.? Schema: - EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) - PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE)
SELECT T1.EMP_LNAME, T1.EMP_HIREDATE FROM EMPLOYEE AS T1 JOIN PROFESSOR AS T2 ON T1.EMP_NUM = T2.EMP_NUM WHERE T2.PROF_OFFICE = 'DRE 102';
what is the lowest point of the us? Schema: - highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
SELECT lowest_point FROM highlow WHERE lowest_elevation = (SELECT MIN(lowest_elevation) FROM highlow);
how many states border the state with the largest population? Schema: - border_info(T1, border, state_name) - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT COUNT(border) AS num_borders FROM border_info WHERE state_name IN (SELECT state_name FROM state WHERE population = (SELECT MAX(population) FROM state));
What is the total home game attendance of team Boston Red Stockings from 2000 to 2010? Schema: - home_game(attendance, year) - team(Name)
SELECT SUM(T1.attendance) AS total_home_game_attendance FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1."year" BETWEEN 2000 AND 2010;
How many lessons have been cancelled? Schema: - Lessons(lesson_status_code)
SELECT COUNT(*) AS num_lessons FROM Lessons WHERE lesson_status_code = 'Cancelled';
What is the name, city, and country of the airport with the highest elevation? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT name, city, country FROM airports ORDER BY elevation DESC NULLS LAST LIMIT 1;
Which studios have an average gross of over 4500000? Schema: - film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
SELECT Studio FROM film WHERE Studio IS NOT NULL GROUP BY Studio HAVING AVG(Gross_in_dollar) >= 4500000;
Give the country codes for countries in which people speak langauges that are not English.? Schema: - countrylanguage(COUNT, CountryCode, Engl, Language)
SELECT DISTINCT CountryCode FROM countrylanguage WHERE "Language" != 'English';
What journals are Takashi Matsumoto 's articles published in ? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.journalId 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 = 'Takashi Matsumoto' GROUP BY T3.journalId;
What is the average, maximum, and minimum for the number of hours spent training? Schema: - Player(HS, pName, weight, yCard)
SELECT AVG(HS) AS avg_hours_spent_training, MAX(HS) AS max_hours_spent_training, MIN(HS) AS min_hours_spent_training FROM Player;
How many courses are offered by the Computer Info. Systems department? Schema: - DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) - COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE)
SELECT COUNT(*) AS num_courses FROM DEPARTMENT AS T1 JOIN COURSE AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE WHERE DEPT_NAME = 'Computer Info. Systems';
Show the season, the player, and the name of the country that player belongs to.? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) - match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team)
SELECT T2.Season, T2.Player, T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country;
What are the names of all pilots listed by descending age? Schema: - pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team)
SELECT Name FROM pilot ORDER BY Age DESC NULLS LAST;
Find all restaurant that serve Seafood in " Los Angeles "? Schema: - category(...) - business(business_id, city, full_address, name, rating, review_count, state)
SELECT T1.name 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 WHERE T1.city = 'Los Angeles' AND T2.category_name = 'Seafood' AND T3.category_name = 'restaurant';
How many rooms have not had any reservation yet? Schema: - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) - Reservations(Adults, CheckIn, FirstName, Kids, LastName)
SELECT COUNT(*) AS num_rooms FROM Rooms WHERE RoomId NOT IN (SELECT DISTINCT Room FROM Reservations);
How many airports are there per city in the US ordered from most to least? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT COUNT(*) AS num_airports, city FROM airports WHERE country = 'United States' AND city IS NOT NULL GROUP BY city ORDER BY num_airports DESC NULLS LAST;
Return the name of the artist who has the latest join year.? Schema: - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) - DESC(...)
SELECT Name FROM artist ORDER BY Year_Join DESC NULLS LAST LIMIT 1;
Find the emails and phone numbers of all the customers, ordered by email address and phone number.? Schema: - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
SELECT email_address, phone_number FROM Customers ORDER BY email_address, phone_number ASC NULLS LAST;
find the name of people whose height is lower 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 FROM people WHERE Height < (SELECT AVG(Height) FROM people);
List the order dates of all the bookings.? Schema: - Bookings(Actual_Delivery_Date, COUNT, Order_Date, Planned_Delivery_Date, Status_Code)
SELECT Order_Date FROM Bookings;
Which city has most number of departing flights? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) - flights(DestAirport, FlightNo, SourceAirport)
SELECT T1.City FROM airports AS T1 JOIN flights AS T2 ON T1.AirportCode = T2.SourceAirport GROUP BY T1.City ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Find the names and descriptions of the photos taken at the tourist attraction called "film festival".? Schema: - Photos(Name) - Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more))
SELECT T1.Name, T1.Description FROM Photos AS T1 JOIN Tourist_Attractions AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T2.Name = 'film festival';
Show the names of customers who have the most mailshots.? Schema: - Mailshot_Customers(outcome_code) - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
SELECT T2.customer_name FROM Mailshot_Customers AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id, T2.customer_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Find the ids and first names of the 3 teachers that have the most number of assessment notes? Schema: - Assessment_Notes(date_of_notes) - Teachers(email_address, first_name, gender, last_name)
SELECT T1.teacher_id, T2.first_name FROM Assessment_Notes AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id GROUP BY T1.teacher_id, T2.first_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 3;
Find the name of physicians who are affiliated with both Surgery and Psychiatry departments.? Schema: - Physician(I, Name) - Affiliated_With(Department, Physician, PrimaryAffiliation) - Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2)
SELECT T1.Name FROM Physician AS T1 JOIN Affiliated_With AS T2 ON T1.EmployeeID = T2.Physician JOIN Department AS T3 ON T2.Department = T3.DepartmentID WHERE T3.Name IN ('Surgery', 'Psychiatry') GROUP BY T1.Name HAVING COUNT(DISTINCT T3.Name) = 2;
How many rooms in total are there in the apartments in the building with short name "Columbus Square"? Schema: - Apartment_Buildings(building_address, building_description, building_full_name, building_manager, building_phone, building_short_name) - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT SUM(TRY_CAST(T2.room_count AS INT)) AS num_rooms FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_short_name = 'Columbus Square';
Which customers have orders with status "Packing"? Give me the customer names.? 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_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = 'Packing';
List the names of all left-footed players who have overall rating between 85 and 90.? Schema: - Player(HS, pName, weight, yCard) - Player_Attributes(overall_rating, preferred_foot)
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.preferred_foot = 'left' AND T2.overall_rating >= 85 AND T2.overall_rating <= 90;
what is the most populated capital 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(T1.population) FROM state AS T2 JOIN city AS T1 ON T2.capital = T1.city_name);