question
stringlengths
43
589
query
stringlengths
19
598
Find all the female members of club "Bootup Baltimore". Show the first name and last name.? Schema: - Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn) - Member_of_club(...) - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT T3.Fname, T3.LName FROM Club AS T1 JOIN Member_of_club AS T2 ON T1.ClubID = T2.ClubID JOIN Student AS T3 ON T2.StuID = T3.StuID WHERE T1.ClubName = 'Bootup Baltimore' AND T3.Sex = 'F';
How many flights depart from City 'Aberdeen' and have destination City 'Ashley'? Schema: - flights(DestAirport, FlightNo, SourceAirport) - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT COUNT(*) AS num_flights FROM flights AS T1 JOIN airports AS T2 ON T1.DestAirport = T2.AirportCode JOIN airports AS T3 ON T1.SourceAirport = T3.AirportCode WHERE T2.City = 'Ashley' AND T3.City = 'Aberdeen';
What is the number of escape games in Madison? Schema: - category(...) - business(business_id, city, full_address, name, rating, review_count, state)
SELECT COUNT(DISTINCT T1.name) AS num_escape_games FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T1.city = 'Madison' AND T2.category_name = 'escape games';
What is the gender of the student Linda Smith? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT Sex FROM Student WHERE Fname = 'Linda' AND LName = 'Smith';
List the dates of enrollment and completion of the student with personal name "Karson".? Schema: - Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) - 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.date_of_enrolment, T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = 'Karson';
What is the document type description for document type named Film? Schema: - Ref_Document_Types(Document_Type_Code, Document_Type_Description, Document_Type_Name, document_type_code, document_type_description)
SELECT Document_Type_Description FROM Ref_Document_Types WHERE Document_Type_Name = 'Film';
Which makers designed more than 3 car models? List full name and the id.? Schema: - car_makers(...) - model_list(Maker, Model)
SELECT T1.FullName, T1.Id FROM car_makers AS T1 JOIN model_list AS T2 ON T1.Id = T2.Maker GROUP BY T1.Id, T1.FullName HAVING COUNT(*) > 3;
Give the id and product type of the product with the lowest price.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT product_id, product_type_code FROM Products ORDER BY product_price ASC NULLS LAST LIMIT 1;
give me a restaurant in mountain view that serves good 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 = 'mountain view' AND T1.food_type = 'arabic' AND T1.rating > 2.5;
Find the names and descriptions of courses that belong to the subject named "Computer Science".? Schema: - Courses(course_description, course_name) - Subjects(subject_name)
SELECT T1.course_name, T1.course_description FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = 'Computer Science';
List all the distinct cities? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
SELECT DISTINCT city FROM Addresses;
Show the most common college of authors of submissions.? Schema: - submission(Author, COUNT, College, Scores)
SELECT College FROM submission WHERE College IS NOT NULL GROUP BY College ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the count of the songs that last approximately 4 minutes? Schema: - files(COUNT, duration, f_id, formats)
SELECT COUNT(*) AS num_songs FROM files WHERE duration LIKE '4:%';
On what dates did the student with family name "Zieme" and personal name "Bernie" enroll in and complete the courses? Schema: - Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) - 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.date_of_enrolment, T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.family_name = 'Zieme' AND T2.personal_name = 'Bernie';
return me the number of papers published in the VLDB conference in each year .? Schema: - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - conference(homepage, name)
SELECT COUNT(DISTINCT T2.title) AS num_papers, T2."year" FROM publication AS T2 JOIN conference AS T1 ON T2.cid = CAST(T1.cid AS TEXT) WHERE T1.name = 'VLDB' GROUP BY T2."year";
return me the number of keywords in the papers of " University of Michigan " .? Schema: - organization(continent, homepage, name) - author(...) - writes(...) - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - publication_keyword(...) - keyword(keyword)
SELECT COUNT(DISTINCT T1.keyword) AS num_keywords FROM organization AS T6 JOIN author AS T2 ON T6.oid = T2.oid JOIN writes AS T4 ON T4.aid = T2.aid JOIN publication AS T5 ON T4.pid = T5.pid JOIN publication_keyword AS T3 ON T5.pid = T3.pid JOIN keyword AS T1 ON T3.kid = T1.kid WHERE T6.name = 'University of Michigan';
List the name of the aircraft that has been named winning aircraft the most number of times.? 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 ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
List all directors along with the number of films directed by each director.? Schema: - film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
SELECT Directed_by, COUNT(*) AS num_films FROM film GROUP BY Directed_by;
what is the largest state capital in population? 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);
What is the zip code of the hosue of the employee named Janessa Sawayn? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) - 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 T1.zip_postcode FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn';
For each manufacturer name, what are the names and prices of their most expensive product? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) - Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue)
SELECT T1.Name, MAX(T1.Price) AS max_price, T2.Name FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name, T1.Name;
What are the ids for employees who do not work in departments with managers that have ids between 100 and 200? Schema: - employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) - departments(DEPARTMENT_NAME, Market)
SELECT * FROM employees WHERE DEPARTMENT_ID NOT IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200);
Return the last name, id and phone number of the customer who has made the greatest 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;
What is the average length in feet of the bridges? Schema: - bridge(Ra, length_feet, location, name)
SELECT AVG(length_feet) AS avg_length_feet FROM bridge;
Which wineries produce at least four wines? Schema: - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
SELECT Winery FROM wine WHERE Winery IS NOT NULL GROUP BY Winery HAVING COUNT(*) >= 4;
What are the full names and gradepoints for 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;
Find the players whose names contain letter 'a'.? Schema: - Player(HS, pName, weight, yCard)
SELECT DISTINCT pName FROM Player WHERE pName LIKE '%a%';
How many available hotels are there in total? Schema: - Hotels(hotel_id, other_hotel_details, pets_allowed_yn, price_range, star_rating_code)
SELECT COUNT(*) AS num_hotels FROM Hotels;
Find the actors who played in the movie " Camp X-Ray "? Schema: - cast_(...) - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
SELECT T1.name FROM cast_ AS T2 JOIN actor AS T1 ON T2.aid = T1.aid JOIN movie AS T3 ON T3.mid = T2.msid WHERE T3.title = 'Camp X-Ray';
Return the average total amount purchased and total value purchased for the supplier who supplies the greatest number of products.? Schema: - Product_Suppliers(COUNT, DOUBLE, TRY_CAST, product_id, supplier_id)
SELECT AVG(TRY_CAST(total_amount_purchased AS DOUBLE)) AS avg_total_amount_purchased, AVG(total_value_purchased) AS avg_total_value_purchased FROM Product_Suppliers WHERE supplier_id = (SELECT supplier_id FROM Product_Suppliers WHERE supplier_id IS NOT NULL GROUP BY supplier_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1);
Find the distinct driver id of all drivers that have a longer stop duration than some drivers in the race whose id is 841? Schema: - pitStops(driverId, raceId, stop)
SELECT DISTINCT driverId, stop FROM pitStops WHERE TRY_CAST(duration AS INT) < (SELECT MAX(TRY_CAST(duration AS INT)) FROM pitStops WHERE raceId = 841);
which states have a major city named austin? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT state_name FROM city WHERE city_name = 'austin' AND population > 150000;
List name of all amenities which Anonymous Donor Hall has, and sort the results in alphabetic order.? Schema: - Dorm_amenity(amenity_name) - Has_amenity(dormid) - Dorm(dorm_name, gender, student_capacity)
SELECT T1.amenity_name FROM Dorm_amenity AS T1 JOIN Has_amenity AS T2 ON T2.amenid = T1.amenid JOIN Dorm AS T3 ON T2.dormid = T3.dormid WHERE T3.dorm_name = 'Anonymous Donor Hall' ORDER BY T1.amenity_name ASC NULLS LAST;
Give me the descriptions of the service types that cost more than 100.? Schema: - Ref_Service_Types(...) - Services(Service_Type_Code, Service_name)
SELECT T1.Service_Type_Description FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100;
List the customers first and last name of 10 least expensive invoices.? Schema: - customers(Mart, city, company, country, email, first_name, last_name, phone, state) - invoices(billing_city, billing_country, billing_state, total)
SELECT T1.first_name, T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id ORDER BY total ASC NULLS LAST LIMIT 10;
what is the largest of the state that the rio grande runs through? 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 MAX(area) FROM state WHERE state_name IN (SELECT traverse FROM river WHERE river_name = 'rio grande')) AND state_name IN (SELECT traverse FROM river WHERE river_name = 'rio grande');
List the email addresses of the drama workshop groups located in Alaska state.? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) - Drama_Workshop_Groups(COUNT, Currency_Code, Marketing_Region_Code, Store_Name)
SELECT T2.Store_Email_Address FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = CAST(T2.Address_ID AS TEXT) WHERE T1.State_County = 'Alaska';
Give me the minimum and maximum bathroom count among all the apartments.? Schema: - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT MIN(bathroom_count) AS min_bathroom_count, MAX(bathroom_count) AS max_bathroom_count FROM Apartments;
Find the distinct names of all wines that have prices higher than some wines from John Anthony winery.? Schema: - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
SELECT DISTINCT Name FROM wine WHERE Price > (SELECT MIN(Price) FROM wine WHERE Winery = 'John Anthony');
What is the number of airlines based in Russia? Schema: - airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
SELECT COUNT(*) AS num_airlines FROM airlines WHERE country = 'Russia';
Which type of policy is most frequently used? Give me the policy type code.? Schema: - Policies(COUNT, Policy_Type_Code)
SELECT Policy_Type_Code FROM Policies WHERE Policy_Type_Code IS NOT NULL GROUP BY Policy_Type_Code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Which student are enrolled in at least two courses? Give me the student ID and personal name.? Schema: - Student_Course_Enrolment(course_id, date_of_completion, date_of_enrolment, student_id) - 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.personal_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id, T2.personal_name HAVING COUNT(*) >= 2;
find the total percentage share of all channels owned by CCTV.? Schema: - channel(Name, Owner, Rating_in_percent, Share_in_percent)
SELECT SUM(Share_in_percent) AS total_percentage_share FROM channel WHERE Owner = 'CCTV';
what states border states that border colorado? Schema: - border_info(T1, border, state_name)
SELECT border FROM border_info WHERE state_name IN (SELECT border FROM border_info WHERE state_name = 'colorado');
Find the total number of hours have done for all students in each department.? Schema: - STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
SELECT SUM(STU_HRS) AS total_hours, DEPT_CODE FROM STUDENT GROUP BY DEPT_CODE;
For each year, return the year and the average number of attendance at home games.? Schema: - home_game(attendance, year)
SELECT "year", AVG(attendance) AS avg_attendance FROM home_game GROUP BY "year";
What are the papers of Liwen Xiong in 2015? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'Liwen Xiong' AND T3."year" = 2015;
What papers did Liwen Xiong publish last year ? 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;
List the nominees that have been nominated more than two musicals.? Schema: - musical(Award, COUNT, Name, Nom, Nominee, Result, T1)
SELECT Nominee FROM musical WHERE Nominee IS NOT NULL GROUP BY Nominee HAVING COUNT(*) > 2;
List ids for all student who are on scholarship.? Schema: - SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
SELECT StuID FROM SportsInfo WHERE OnScholarship = 'Y';
List the countries that have more than one mountain.? Schema: - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT Country FROM mountain WHERE Country IS NOT NULL GROUP BY Country HAVING COUNT(*) > 1;
Find the id and local authority of the station whose maximum precipitation is higher than 50.? Schema: - weekly_weather(low_temperature, wind_speed_mph) - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
SELECT T2.id, T2.local_authority FROM weekly_weather AS T1 JOIN station AS T2 ON T1.station_id = T2.id GROUP BY T1.station_id, T2.id, T2.local_authority HAVING MAX(T1.precipitation) > 50;
What are the ids of the students who do not own cats as pets? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - Has_Pet(...) - Pets(PetID, PetType, pet_age, weight)
SELECT StuID FROM Student WHERE StuID NOT IN (SELECT T1.StuID FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID JOIN Pets AS T3 ON T3.PetID = T2.PetID WHERE T3.PetType = 'cat');
find the name of the program that was launched most recently.? Schema: - program(Beij, Launch, Name, Origin, Owner)
SELECT Name FROM program ORDER BY Launch DESC NULLS LAST LIMIT 1;
What is the name of the tallest building? Schema: - building(Floors, Height_feet, Name, build)
SELECT Name FROM building ORDER BY Height_feet DESC NULLS LAST LIMIT 1;
Find the first name of students who have both cat and dog pets .? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - Has_Pet(...) - Pets(PetID, PetType, pet_age, weight)
SELECT T1.Fname FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID JOIN Pets AS T3 ON T3.PetID = T2.PetID WHERE T3.PetType = 'cat' AND T1.Fname IN (SELECT T4.Fname FROM Student AS T4 JOIN Has_Pet AS T5 ON T4.StuID = T5.StuID JOIN Pets AS T6 ON T6.PetID = T5.PetID WHERE T6.PetType = 'dog');
Show the first year and last year of parties with theme "Spring" or "Teqnology".? Schema: - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT First_year, Last_year FROM party WHERE Party_Theme = 'Spring' OR Party_Theme = 'Teqnology';
Please show the most common age of editors.? Schema: - editor(Age, COUNT, Name)
SELECT Age FROM editor WHERE Age IS NOT NULL GROUP BY Age ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are all the publication titles by Donald E Knuth ? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.title 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 = 'Donald E Knuth';
What are the names of properties that are either houses or apartments with more than 1 room? Schema: - Properties(property_name, property_type_code, room_count)
SELECT DISTINCT property_name FROM (SELECT property_name FROM Properties WHERE property_type_code = 'House' UNION ALL SELECT property_name FROM Properties WHERE property_type_code = 'Apartment' AND room_count > 1);
What are the enrollment and primary conference for the university which was founded the earliest? Schema: - university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School)
SELECT Enrollment, Primary_conference FROM university ORDER BY Founded ASC NULLS LAST LIMIT 1;
What is the most cited paper at sigcomm ? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - cite(...) - venue(venueId, venueName)
SELECT DISTINCT T3.citedPaperId, COUNT(T3.citingPaperId) AS num_citations FROM paper AS T1 JOIN cite AS T3 ON T1.paperId = T3.citedPaperId JOIN venue AS T2 ON T2.venueId = T1.venueId WHERE T2.venueName = 'sigcomm' GROUP BY T3.citedPaperId ORDER BY num_citations DESC NULLS LAST;
Find the ids of orders whose status is 'Success'.? Schema: - Actual_Orders(actual_order_id)
SELECT actual_order_id FROM Actual_Orders WHERE order_status_code = 'Success';
What is the date and id of the transcript with the least number of results? Schema: - Transcript_Contents(student_course_id) - Transcripts(other_details, transcript_date)
SELECT T2.transcript_date, T1.transcript_id FROM Transcript_Contents AS T1 JOIN Transcripts AS T2 ON T1.transcript_id = T2.transcript_id GROUP BY T1.transcript_id, T2.transcript_date ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
What is the average price range of five star hotels that allow pets? Schema: - Hotels(hotel_id, other_hotel_details, pets_allowed_yn, price_range, star_rating_code)
SELECT AVG(price_range) AS avg_price_range FROM Hotels WHERE star_rating_code = '5' AND pets_allowed_yn = '1';
Which guests have apartment bookings with status code "Confirmed"? Return their first names and last names.? 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 T2.guest_first_name, T2.guest_last_name FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = 'Confirmed';
What is the name of the race that occurred most recently? Schema: - races(date, name)
SELECT name FROM races ORDER BY "date" DESC NULLS LAST LIMIT 1;
what is the smallest city in the usa? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT city_name FROM city WHERE population = (SELECT MIN(population) FROM city);
Give the name of the nation that uses the greatest amount of languages.? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more)) - countrylanguage(COUNT, CountryCode, Engl, Language)
SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Show me the distinct payment method codes from the invoice record.? Schema: - Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code)
SELECT DISTINCT payment_method_code FROM Invoices;
What are the numbers of races for each constructor id? Schema: - constructorStandings(constructorId)
SELECT COUNT(*) AS num_races, constructorId FROM constructorStandings GROUP BY constructorId;
Show the distinct names of mountains climbed by climbers from country "West Germany".? Schema: - climber(Country, K, Name, Points) - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT DISTINCT T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T1.Country = 'West Germany';
Which colleges does each player with a name that starts with the letter D who tried out go to? Schema: - Tryout(COUNT, EX, T1, cName, decision, pPos) - Player(HS, pName, weight, yCard)
SELECT T1.cName FROM Tryout AS T1 JOIN Player AS T2 ON T1.pID = T2.pID WHERE T2.pName ILIKE 'D%';
List all of the player ids with a height of at least 180cm and an overall rating higher than 85.? Schema: - Player(HS, pName, weight, yCard) - Player_Attributes(overall_rating, preferred_foot)
SELECT DISTINCT T1.player_api_id FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T1.height >= 180 AND T2.overall_rating > 85;
Give the names of countries that are in Europe and have a population equal to 80000.? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
SELECT Name FROM country WHERE Continent = 'Europe' AND Population = '80000';
How many churches opened before 1850 are there? Schema: - church(Name, Open_Date, Organized_by)
SELECT COUNT(*) AS num_churches FROM church WHERE Open_Date < 1850;
where is the lowest point in 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);
Find the names of customers who have no policies associated.? 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)) - Policies(COUNT, Policy_Type_Code)
SELECT c.Customer_Details FROM Customers c LEFT JOIN Policies p ON c.Customer_ID = p.Customer_ID WHERE p.Customer_ID IS NULL;
What are the major record formats of orchestras, sorted by their frequency? Schema: - orchestra(COUNT, Major_Record_Format, Record_Company, Year_of_Founded)
SELECT Major_Record_Format FROM orchestra WHERE Major_Record_Format IS NOT NULL GROUP BY Major_Record_Format ORDER BY COUNT(*) ASC NULLS LAST;
What are the aircrafts with top 3 shortest lengthes? List their names.? Schema: - aircraft(Description, aid, d, distance, name)
SELECT name FROM aircraft ORDER BY distance ASC NULLS LAST LIMIT 3;
What is the number of days that had an average humity above 50 and an average visibility above 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 COUNT(*) AS num_days FROM weather WHERE mean_humidity > 50 AND mean_visibility_miles > 8;
Find the average number of followers for the users who had some tweets.? Schema: - user_profiles(email, followers, name, partitionid) - tweets(I, tweet_text, uid)
SELECT AVG(followers) AS avg_followers FROM user_profiles WHERE uid IN (SELECT uid FROM tweets);
Show the first name and last name for the customer with account name 900.? 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 T2.customer_first_name, T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = '900';
Sort the names of products in ascending order of their price.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT Product_Name FROM Products ORDER BY Product_Price ASC NULLS LAST;
What is the number of flights? Schema: - flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more))
SELECT COUNT(*) AS num_flights FROM flight;
who are all the co-authors of Noah A Smith ? Schema: - writes(...) - author(...)
SELECT DISTINCT T1.authorId FROM writes AS T3 JOIN author AS T2 ON T3.authorId = T2.authorId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T2.authorName = 'Noah A Smith';
Find the average and maximum age for each type of pet.? Schema: - Pets(PetID, PetType, pet_age, weight)
SELECT AVG(pet_age) AS avg_age, MAX(pet_age) AS max_age, PetType FROM Pets GROUP BY PetType;
What are the teams of the players, sorted in ascending alphabetical order? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
SELECT Team FROM player ORDER BY Team ASC NULLS LAST;
Where is the history department? Schema: - DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
SELECT DEPT_ADDRESS FROM DEPARTMENT WHERE DEPT_NAME = 'History';
Find the name of instructors who didn't teach any courses? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary) - teaches(ID, Spr, semester)
SELECT name FROM instructor WHERE ID NOT IN (SELECT ID FROM teaches);
How long is the total lesson time took by customer with first name as Rylan and last name as Goodwin? 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 SUM(TRY_CAST(T1.lesson_time AS DOUBLE)) AS total_lesson_time 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';
Find the number of dorms that have some amenity.? Schema: - Has_amenity(dormid)
SELECT COUNT(DISTINCT dormid) AS num_dorms FROM Has_amenity;
What are the names and trade names of the medcines that are FDA approved? Schema: - medicine(FDA_approved, Trade_Name, name)
SELECT name, Trade_Name FROM medicine WHERE FDA_approved = 'Yes';
what was the first deep learning paper ? Schema: - paperDataset(...) - dataset(...) - paperKeyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - keyphrase(...)
SELECT DISTINCT T2.datasetId, T4."year" FROM paperDataset AS T3 JOIN dataset AS T2 ON T3.datasetId = T2.datasetId JOIN paperKeyphrase AS T1 ON T1.paperId = T3.paperId JOIN paper AS T4 ON T4.paperId = T3.paperId JOIN keyphrase AS T5 ON T1.keyphraseId = T5.keyphraseId WHERE T5.keyphraseName = 'deep learning' ORDER BY T4."year" ASC NULLS LAST;
Return the code of the city that has the most students.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT city_code FROM Student WHERE city_code IS NOT NULL GROUP BY city_code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Find the average price of wines that are not produced from Sonoma county.? Schema: - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w) - appellations(Area, County)
SELECT AVG(Price) AS avg_price FROM wine WHERE Appelation NOT IN (SELECT T1.Appelation FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Sonoma');
Find the name of the shops that do not hire any employee.? Schema: - shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) - hiring(...)
SELECT Name FROM shop WHERE Shop_ID NOT IN (SELECT Shop_ID FROM hiring);
What are the names of regions with two or more storms? Schema: - region(Label, Region_code, Region_name) - affected_region(Region_id)
SELECT T1.Region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.Region_id = T2.Region_id GROUP BY T1.Region_id, T1.Region_name HAVING COUNT(*) >= 2;
Show the cinema name and location for cinemas with capacity above average.? Schema: - cinema(COUNT, Capacity, Location, Name, Openning_year, T1, c)
SELECT Name, Location FROM cinema WHERE Capacity > (SELECT AVG(Capacity) FROM cinema);
When was the order placed whose shipment tracking number is 3452? Give me the date.? Schema: - Orders(customer_id, date_order_placed, order_id) - Shipments(order_id, shipment_date, shipment_tracking_number)
SELECT T1.date_order_placed FROM Orders AS T1 JOIN Shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.shipment_tracking_number = '3452';