question
stringlengths
43
589
query
stringlengths
19
598
What are the names of all instructors who advise students in the math depart sorted by total credits of the student.? Schema: - advisor(s_ID) - instructor(AVG, M, So, Stat, dept_name, name, salary) - student(COUNT, H, dept_name, name, tot_cred)
SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_ID = T2.ID JOIN student AS T3 ON T1.s_ID = T3.ID WHERE T3.dept_name = 'Math' ORDER BY T3.tot_cred ASC NULLS LAST;
return me the total citations of papers in the VLDB conference before 2005 .? Schema: - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - conference(homepage, name)
SELECT SUM(T2.citation_num) AS total_citations FROM publication AS T2 JOIN conference AS T1 ON T2.cid = CAST(T1.cid AS TEXT) WHERE T1.name = 'VLDB' AND T2."year" < 2005;
Find the number of adults for the room reserved and checked in by CONRAD SELBIG on Oct 23, 2010.? Schema: - Reservations(Adults, CheckIn, FirstName, Kids, LastName)
SELECT Adults FROM Reservations WHERE CheckIn = '2010-10-23' AND FirstName = 'CONRAD' AND LastName = 'SELBIG';
How many TV Channel using language English? Schema: - TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name)
SELECT COUNT(*) AS num_channels FROM TV_Channel WHERE "Language" = 'English';
What are the names of wrestlers days held less than 100? Schema: - wrestler(COUNT, Days_held, Location, Name, Reign)
SELECT Name FROM wrestler WHERE TRY_CAST(Days_held AS INT) < 100;
How many students and instructors are in each department? Schema: - department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name) - student(COUNT, H, dept_name, name, tot_cred) - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT COUNT(DISTINCT T2.ID) AS num_students, COUNT(DISTINCT T3.ID) AS num_instructors, T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name = T2.dept_name JOIN instructor AS T3 ON T1.dept_name = T3.dept_name GROUP BY T3.dept_name;
Has mirella lapata written any papers in 2016 ? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT COUNT(T3.paperId) AS num_papers, T2.authorId 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 = 'mirella lapata' AND T3."year" = 2016 GROUP BY T2.authorId;
List the cost of each treatment and the corresponding treatment type description.? Schema: - Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) - Treatment_Types(...)
SELECT T1.cost_of_treatment, T2.treatment_type_description FROM Treatments AS T1 JOIN Treatment_Types AS T2 ON T1.treatment_type_code = T2.treatment_type_code;
How many battles did not lose any ship with tonnage '225'? Schema: - battle(Baldw, bulgarian_commander, date, latin_commander, name, result) - ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage)
SELECT COUNT(*) AS num_battles FROM battle WHERE id NOT IN (SELECT lost_in_battle FROM ship WHERE tonnage = '225');
What are the names of all movies made before 1980 or had James Cameron as the director? Schema: - Movie(T1, director, title, year)
SELECT title FROM Movie WHERE director = 'James Cameron' OR "year" < 1980;
What are the years of film market estimation for the market of Japan, ordered by year descending? Schema: - film_market_estimation(High_Estimate, Low_Estimate, Type) - market(Country, Number_cities)
SELECT T1."Year" FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID WHERE T2.Country = 'Japan' ORDER BY T1."Year" DESC NULLS LAST;
What are the names of customers who have a savings balance lower than their checking balance, and what is the total of their checking and savings balances? Schema: - ACCOUNTS(name) - CHECKING(balance) - SAVINGS(SAV, balance)
SELECT T1.name, T3.balance + T2.balance AS total_balance FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid WHERE T3.balance < T2.balance;
what is the adjacent state of kentucky? Schema: - border_info(T1, border, state_name)
SELECT border FROM border_info WHERE state_name = 'kentucky';
Count the number of addressed in the California district.? Schema: - address(address, district, phone, postal_code)
SELECT COUNT(*) AS num_addresses FROM address WHERE district = 'California';
Which statuses correspond to both cities that have a population over 1500 and cities that have a population lower than 500? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT DISTINCT T1.Status FROM (SELECT Status FROM city WHERE Population > 1500) AS T1, (SELECT Status FROM city WHERE Population < 500) AS T2 WHERE T1.Status = T2.Status;
What is the complete description of the job of a researcher? Schema: - Staff_Roles(role_code, role_description)
SELECT role_description FROM Staff_Roles WHERE role_code = 'researcher';
Count the number of colors.? Schema: - Ref_Colors(color_description)
SELECT COUNT(*) AS num_colors FROM Ref_Colors;
What are the planned delivery date and actual delivery date for each booking? Schema: - Bookings(Actual_Delivery_Date, COUNT, Order_Date, Planned_Delivery_Date, Status_Code)
SELECT Planned_Delivery_Date, Actual_Delivery_Date FROM Bookings;
Show first name, last name, age for all female students. Their sex is F.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT Fname, LName, Age FROM Student WHERE Sex = 'F';
What are the name of rooms that cost more than the average.? Schema: - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT roomName FROM Rooms WHERE basePrice > (SELECT AVG(basePrice) FROM Rooms);
What are the names of all aircrafts that have won a match at least twice? Schema: - aircraft(Description, aid, d, distance, name) - match_(Competition, Date, Match_ID, Venue)
SELECT T1.Aircraft FROM aircraft AS T1 JOIN match_ AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T1.Aircraft_ID, T1.Aircraft HAVING COUNT(*) >= 2;
What is the id, name and nationality of the architect who built most mills? Schema: - architect(gender, id, name, nationality) - mill(Moul, location, name, type)
SELECT T1.id, T1.name, T1.nationality FROM architect AS T1 JOIN mill AS T2 ON T1.id = CAST(T2.architect_id AS TEXT) GROUP BY T1.id, T1.name, T1.nationality ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Show the names of customers who use Credit Card payment method and have more than 2 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)) - Customer_Orders(customer_id, order_date, order_id, order_shipping_charges)
SELECT T1.customer_name FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_method_code = 'Credit Card' GROUP BY T1.customer_id, T1.customer_name HAVING COUNT(*) > 2;
How many students did not have any course enrollment? Schema: - 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)) - Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id)
SELECT COUNT(*) AS num_students FROM Students WHERE student_id NOT IN (SELECT student_id FROM Student_Course_Enrolment);
What is the time of elimination for the wrestler with the most days held? Schema: - Elimination(Benjam, Eliminated_By, Elimination_Move, T1, Team, Time) - wrestler(COUNT, Days_held, Location, Name, Reign)
SELECT T1."Time" FROM Elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = CAST(T2.Wrestler_ID AS TEXT) ORDER BY T2.Days_held DESC NULLS LAST LIMIT 1;
What is the description for the section named h? Schema: - Sections(section_description, section_name)
SELECT section_description FROM Sections WHERE section_name = 'h';
How many tracks are in the AAC audio file media type? Schema: - MediaType(...) - Track(Milliseconds, Name, UnitPrice)
SELECT COUNT(*) AS num_tracks FROM MediaType AS T1 JOIN Track AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = 'AAC audio file';
What is the weekly rank for the episode "A Love of a Lifetime"? Schema: - TV_series(Air_Date, Episode, Rating, Share, Weekly_Rank)
SELECT Weekly_Rank FROM TV_series WHERE Episode = 'A Love of a Lifetime';
Find the last names of the faculty members who participate in Canoeing and Kayaking.? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) - Faculty_Participates_in(FacID) - Activity(activity_name)
SELECT DISTINCT T1.Lname FROM Faculty AS T1 JOIN Faculty_Participates_in AS T2 ON T1.FacID = T2.FacID JOIN Activity AS T3 ON T2.actid = T3.actid JOIN Faculty_Participates_in AS T4 ON T1.FacID = T4.FacID JOIN Activity AS T5 ON T4.actid = T5.actid WHERE (T3.activity_name = 'Canoeing' AND T5.activity_name = 'Kayaking');
return me the number of authors who have papers containing keyword " Relational Database " .? Schema: - publication_keyword(...) - keyword(keyword) - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - writes(...) - author(...)
SELECT COUNT(DISTINCT T2.name) AS num_authors FROM publication_keyword AS T5 JOIN keyword AS T1 ON T5.kid = T1.kid JOIN publication AS T3 ON T3.pid = T5.pid JOIN writes AS T4 ON T4.pid = T3.pid JOIN author AS T2 ON T4.aid = T2.aid WHERE T1.keyword = 'Relational Database';
What are the details of all products? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT DISTINCT product_details FROM Products;
What details are there on the research staff? List the result in ascending alphabetical order.? Schema: - Research_Staff(staff_details)
SELECT staff_details FROM Research_Staff ORDER BY staff_details ASC NULLS LAST;
How many employees have a first name of Ludie? 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 COUNT(*) AS num_employees FROM Staff WHERE first_name = 'Ludie';
How many products are there under the category "Seeds"? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT COUNT(*) AS num_products FROM Products WHERE product_category_code = 'Seeds';
Show names for all employees who have certificate of Boeing 737-800.? Schema: - employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) - certificate(eid) - aircraft(Description, aid, d, distance, name)
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';
What are the ids of the trips that lasted the longest and how long did they last? Schema: - trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code)
SELECT id, duration FROM trip ORDER BY duration DESC NULLS LAST LIMIT 3;
List the description of all the colors.? Schema: - Ref_Colors(color_description)
SELECT color_description FROM Ref_Colors;
find the number of distinct country codes of all players.? Schema: - players(COUNT, birth_date, country_code, first_name, hand, last_name)
SELECT COUNT(DISTINCT country_code) AS num_country_codes FROM players;
List the writers who have written more than one book.? Schema: - book(Ela, Issues, Title, Writer)
SELECT Writer FROM book WHERE Writer IS NOT NULL GROUP BY Writer HAVING COUNT(*) > 1;
What is the song with the most vocals? Schema: - Vocals(COUNT, Type) - Songs(Title)
SELECT Title FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId GROUP BY T1.SongId, Title ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
How many United Airlines flights go to City 'Aberdeen'? Schema: - flights(DestAirport, FlightNo, SourceAirport) - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) - airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
SELECT COUNT(*) AS num_flights FROM flights AS T1 JOIN airports AS T2 ON T1.DestAirport = T2.AirportCode JOIN airlines AS T3 ON T3.uid = T1.Airline WHERE T2.City = 'Aberdeen' AND T3.Airline = 'United Airlines';
What are the delegate and committee information for each election record? Schema: - election(Committee, Date, Delegate, District, Vote_Percent, Votes)
SELECT Delegate, Committee FROM election;
List the phone hardware model and company name for the phones whose screen usage in kb is between 10 and 15.? Schema: - screen_mode(used_kb) - phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode)
SELECT DISTINCT T2.Hardware_Model_name, T2.Company_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.used_kb BETWEEN 10 AND 15;
What is the airport name for airport 'AKO'? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT AirportName FROM airports WHERE AirportCode = 'AKO';
What is the number of states that has some college whose enrollment is larger than the average enrollment? Schema: - College(M, cName, enr, state)
SELECT COUNT(DISTINCT state) AS num_states FROM College WHERE enr > (SELECT AVG(enr) FROM College);
Which owner has paid the largest amount of money in total for their dogs? Show the owner id and zip code.? Schema: - Owners(email_address, first_name, last_name, state) - 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.owner_id, T1.zip_code FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id JOIN Treatments AS T3 ON T2.dog_id = T3.dog_id GROUP BY T1.owner_id, T1.zip_code ORDER BY SUM(T3.cost_of_treatment) DESC NULLS LAST LIMIT 1;
Show student ids for all male students.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT StuID FROM Student WHERE Sex = 'M';
Return the most common full name among all actors.? Schema: - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
SELECT first_name, last_name FROM actor WHERE first_name IS NOT NULL AND last_name IS NOT NULL GROUP BY first_name, last_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Find the number of schools that have more than one donator whose donation amount is less than 8.5.? Schema: - endowment(School_id, amount, donator_name)
SELECT COUNT(*) AS num_schools FROM (SELECT School_id FROM endowment WHERE amount > 8.5 AND School_id IS NOT NULL GROUP BY School_id HAVING COUNT(*) > 1);
give me a restaurant on bethel island rd in bethel island ? 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 = 'bethel island' AND T2.street_name = 'bethel island rd';
Find the id and address of the shops whose score is below the average score.? Schema: - shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more))
SELECT Shop_ID, Address FROM shop WHERE Score < (SELECT AVG(Score) FROM shop);
Find names of instructors with salary greater than that of some (at least one) instructor in the Biology department.? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT name FROM instructor WHERE salary > (SELECT MIN(salary) FROM instructor WHERE dept_name = 'Biology');
How many papers used ImageNet datasets in cvpr ? Schema: - paperDataset(...) - dataset(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - venue(venueId, venueName)
SELECT DISTINCT COUNT(T3.paperId) AS num_papers FROM paperDataset AS T2 JOIN dataset AS T1 ON T2.datasetId = T1.datasetId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.datasetName = 'ImageNet' AND T4.venueName = 'cvpr';
Please show the most common publication date.? Schema: - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
SELECT Publication_Date FROM publication WHERE Publication_Date IS NOT NULL GROUP BY Publication_Date ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Show names of climbers and the names of mountains they climb.? Schema: - climber(Country, K, Name, Points) - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT T1.Name, T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID;
What is the average price for each type of product? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT product_type_code, AVG(product_price) AS avg_price FROM Products GROUP BY product_type_code;
What are the latest papers by oren etzioni ? 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;
What is the id and last name of the driver who participated in the most races after 2010? Schema: - drivers(forename, nationality, surname) - results(...) - races(date, name)
SELECT T1.driverId, T1.surname FROM drivers AS T1 JOIN results AS T2 ON T1.driverId = T2.driverId JOIN races AS T3 ON T2.raceId = T3.raceId WHERE T3."year" > 2010 GROUP BY T1.driverId, T1.surname ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the completion dates of all the tests that have result "Fail"? Schema: - Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) - Student_Tests_Taken(date_test_taken, test_result)
SELECT T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = 'Fail';
where is a good french restaurant in the yosemite and mono lake area ? Schema: - restaurant(...) - geographic(...) - location(...)
SELECT T3.house_number, T1.name FROM restaurant AS T1 JOIN geographic AS T2 ON T1.city_name = T2.city_name JOIN location AS T3 ON T1.id = T3.restaurant_id WHERE T2.region = 'yosemite and mono lake area' AND T1.food_type = 'french' AND T1.rating > 2.5;
Find the addresses and author IDs of the course authors that teach at least two courses.? Schema: - Course_Authors_and_Tutors(address_line_1, family_name, login_name, personal_name) - Courses(course_description, course_name)
SELECT T1.address_line_1, T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id, T1.address_line_1 HAVING COUNT(*) >= 2;
What are the names and genders of staff who were assigned in 2016? 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) - Staff_Department_Assignments(COUNT, date_assigned_to, department_id, job_title_code, staff_id) - LIKE(...)
SELECT T1.staff_name, T1.staff_gender FROM Staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.date_assigned_from LIKE '2016%';
Find the id of the customer who made the most 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_id FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the package options of all tv channels that are not playing any cartoons directed by Ben Jones? Schema: - TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name) - Cartoon(Channel, Directed_by, Original_air_date, Production_code, Title, Written_by)
SELECT Package_Option FROM TV_Channel WHERE id NOT IN (SELECT Channel FROM Cartoon WHERE Directed_by = 'Ben Jones');
Which service id and type has the least number of participants? Schema: - Participants(Participant_Details, Participant_ID, Participant_Type_Code) - Participants_in_Events(COUNT, Event_ID, Participant_ID) - Events(...) - Services(Service_Type_Code, Service_name)
SELECT T3.Service_ID, T4.Service_Type_Code FROM Participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID JOIN Events AS T3 ON T2.Event_ID = T3.Event_ID JOIN Services AS T4 ON T3.Service_ID = T4.Service_ID GROUP BY T3.Service_ID, T4.Service_Type_Code ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
Which orders are made by the customer named "Jeramie"? Give me the order ids and status.? 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 T2.order_id, T2.order_status FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = 'Jeramie';
What model has the most different versions? Schema: - car_names(COUNT, Model)
SELECT Model FROM car_names WHERE Model IS NOT NULL GROUP BY Model ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are flight numbers of flights arriving at Airport "APG"? Schema: - flights(DestAirport, FlightNo, SourceAirport)
SELECT FlightNo FROM flights WHERE DestAirport = 'APG';
Return the name, rate, check in and check out date for the room with the highest rate.? Schema: - Reservations(Adults, CheckIn, FirstName, Kids, LastName) - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT T2.roomName, T1.Rate, T1.CheckIn, T1.CheckOut FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room, T2.roomName, T1.Rate, T1.CheckIn, T1.CheckOut ORDER BY T1.Rate DESC NULLS LAST LIMIT 1;
Show all opening years and the number of churches that opened in that year.? Schema: - church(Name, Open_Date, Organized_by)
SELECT Open_Date, COUNT(*) AS num_churches FROM church GROUP BY Open_Date;
Find the name and access counts of all documents, in alphabetic order of the document name.? 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_name, access_count FROM Documents ORDER BY document_name ASC NULLS LAST;
Report the number of students in each classroom.? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName)
SELECT Classroom, COUNT(*) AS num_students FROM list GROUP BY Classroom;
What are all company names that have a corresponding movie directed in the year 1999? Schema: - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title) - culture_company(...)
SELECT T2.Company_name FROM movie AS T1 JOIN culture_company AS T2 ON CAST(T1.movie_id AS TEXT) = T2.movie_id WHERE T1."Year" = 1999;
For each zip code, find the ids of all trips that have a higher average mean temperature above 60? Schema: - trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code) - 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 T1.id FROM trip AS T1 JOIN weather AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.zip_code, T1.id HAVING AVG(T2.mean_temperature_f) > 60;
What is all the job history info done by employees earning a salary greater than or equal to 12000? Schema: - job_history(EMPLOYEE_ID, END_DATE, JOB_ID) - employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more))
SELECT * FROM job_history AS T1 JOIN employees AS T2 ON T1.EMPLOYEE_ID = T2.EMPLOYEE_ID WHERE T2.SALARY >= 12000;
What types of ships have both ships that have Panama Flags and Malta flags? Schema: - Ship(Built_Year, COUNT, Class, Flag, Name, Type)
SELECT DISTINCT Type FROM Ship WHERE Flag = 'Panama' AND Type IN (SELECT Type FROM Ship WHERE Flag = 'Malta');
Find the number of papers published by authors from the institution "Tokohu University".? Schema: - Papers(title) - Authorship(...) - Inst(...)
SELECT COUNT(DISTINCT T1.title) AS num_papers FROM Papers AS T1 JOIN Authorship AS T2 ON T1.paperID = T2.paperID JOIN Inst AS T3 ON T2.instID = T3.instID WHERE T3.name = 'Tokohu University';
How many matches were played in each year? Schema: - matches_(COUNT, T1, loser_age, loser_name, minutes, tourney_name, winner_age, winner_hand, winner_name, winner_rank, winner_rank_points, year)
SELECT COUNT(*) AS num_matches, "year" FROM matches_ GROUP BY "year";
List the id, color scheme, and name for all the photos.? Schema: - photos(color, id, name)
SELECT id, color, name FROM photos;
Where is the youngest teacher from? Schema: - teacher(Age, COUNT, D, Hometown, Name)
SELECT Hometown FROM teacher ORDER BY Age ASC NULLS LAST LIMIT 1;
List the builders of railways in ascending alphabetical order.? Schema: - railway(Builder, COUNT, Location)
SELECT Builder FROM railway ORDER BY Builder ASC NULLS LAST;
Which dogs are owned by someone who lives in Virginia? List the owner's first name and the dog's name.? Schema: - Owners(email_address, first_name, last_name, state) - Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
SELECT T1.first_name, T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id WHERE T1.state = 'Virginia';
Find the names of employees who never won any award in the evaluation.? Schema: - employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) - evaluation(Bonus)
SELECT Name FROM employee WHERE CAST(Employee_ID AS TEXT) NOT IN (SELECT Employee_ID FROM evaluation);
What are the distinct names of customers who have purchased a keyboard? Schema: - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) - Customer_Orders(customer_id, order_date, order_id, order_shipping_charges) - Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT DISTINCT T1.customer_name FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_Items AS T3 ON T2.order_id = T3.order_id JOIN Products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_name = 'keyboard';
Find the name of the makers that produced some cars in the year of 1970? Schema: - car_makers(...) - model_list(Maker, Model) - car_names(COUNT, Model) - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT DISTINCT T1.Maker FROM car_makers AS T1 JOIN model_list AS T2 ON T1.Id = T2.Maker JOIN car_names AS T3 ON T2.Model = T3.Model JOIN cars_data AS T4 ON T3.MakeId = T4.Id WHERE T4."Year" = '1970';
What are all the songs in albums under label "Universal Music Group"? Schema: - Albums(COUNT, Label, Title) - Tracklists(...) - Songs(Title)
SELECT T3.Title FROM Albums AS T1 JOIN Tracklists AS T2 ON T1.AId = T2.AlbumId JOIN Songs AS T3 ON T2.SongId = T3.SongId WHERE T1.Label = 'Universal Music Group';
What are the names and years released for the movies with the top 3 highest ratings? Schema: - Rating(Rat, mID, rID, stars) - Movie(T1, director, title, year)
SELECT T2.title, T2."year" FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID ORDER BY T1.stars DESC NULLS LAST LIMIT 3;
How many faculty lines are there at San Francisco State University in 2004? Schema: - faculty(Faculty) - Campuses(Campus, County, Franc, Location)
SELECT Faculty FROM faculty AS T1 JOIN Campuses AS T2 ON T1.Campus = T2.Id WHERE T1."Year" = 2004 AND T2.Campus = 'San Francisco State University';
What are the names of the songs that are modern or sung in English? Schema: - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT song_name FROM song WHERE genre_is = 'modern' OR languages = 'english';
Show the product type codes which have at least two products.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT product_type_code FROM Products WHERE product_type_code IS NOT NULL GROUP BY product_type_code HAVING COUNT(*) >= 2;
return me the authors who have papers in VLDB conference in 2002 .? Schema: - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - conference(homepage, name) - writes(...) - author(...)
SELECT T1.name FROM publication AS T4 JOIN conference AS T2 ON T4.cid = CAST(T2.cid AS TEXT) JOIN writes AS T3 ON T3.pid = T4.pid JOIN author AS T1 ON T3.aid = T1.aid WHERE T2.name = 'VLDB' AND T4."year" = 2002;
What is the state and enrollment of the colleges where have any students who got accepted in the tryout decision.? 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';
How many problems did the product called "voluptatem" have in record? Schema: - Product(product_id, product_name) - Problems(date_problem_reported, problem_id)
SELECT COUNT(*) AS num_problems FROM Product AS T1 JOIN Problems AS T2 ON T1.product_id = T2.product_id WHERE T1.product_name = 'voluptatem';
What are the distinct last names of the students who have president votes and have 8741 as the advisor? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - Voting_record(Election_Cycle, President_Vote, Registration_Date, Secretary_Vote, Vice_President_Vote)
SELECT DISTINCT T1.LName FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.President_Vote WHERE T1.Advisor = '8741';
What is the id for the employee called Ebba? Schema: - Employees(COUNT, Date_of_Birth, Employee_ID, Employee_Name, Role_Code, employee_id, employee_name, role_code)
SELECT Employee_ID FROM Employees WHERE Employee_Name = 'Ebba';
What is the name of each camera lens and the number of photos taken by it? Order the result by the count of photos.? Schema: - camera_lens(brand, name) - photos(color, id, name)
SELECT T1.name, COUNT(*) AS num_photos FROM camera_lens AS T1 JOIN photos AS T2 ON T1.id = T2.camera_lens_id GROUP BY T1.id, T1.name ORDER BY num_photos ASC NULLS LAST;
How many students have personal names that contain the word "son"? Schema: - 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 COUNT(*) AS num_students FROM Students WHERE personal_name LIKE '%son%';
How many customers have email that contains "gmail.com"? Schema: - Customer(Email, FirstName, LastName, State, lu)
SELECT COUNT(*) AS num_customers FROM Customer WHERE Email LIKE '%gmail.com%';
What are the names and locations of all enzymes listed? Schema: - enzyme(Chromosome, Location, OMIM, Porphyria, Product, name)
SELECT name, Location FROM enzyme;
What are the distinct ids of products ordered between 1975-01-01 and 1976-01-01?? Schema: - Orders(customer_id, date_order_placed, order_id) - Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
SELECT DISTINCT T2.product_id FROM Orders AS T1 JOIN Order_Items AS T2 ON T1.order_id = T2.order_id WHERE T1.date_order_placed >= '1975-01-01 00:00:00' AND T1.date_order_placed <= '1976-01-01 23:59:59';