question
stringlengths
43
589
query
stringlengths
19
598
What are the names and prices of products that cost at least 180, sorted by price decreasing and name ascending? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT Name, Price FROM Products WHERE Price >= 180 ORDER BY Price DESC, Name ASC NULLS LAST;
What is the incident type description for the incident type with code "VIOLENCE"? Schema: - Ref_Incident_Type(incident_type_code, incident_type_description)
SELECT incident_type_description FROM Ref_Incident_Type WHERE incident_type_code = 'VIOLENCE';
How many faculty members does each building have? List the result with the name of the building.? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
SELECT Building, COUNT(*) AS num_faculty FROM Faculty GROUP BY Building;
What are the distinct details of invoices created before 1989-09-03 or after 2007-12-25? Schema: - Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code)
SELECT DISTINCT invoice_details FROM Invoices WHERE invoice_date < '1989-09-03 23:59:59' OR invoice_date > '2007-12-25 00:00:00';
Find all Apple Store in " Los Angeles "? Schema: - business(business_id, city, full_address, name, rating, review_count, state)
SELECT business_id FROM business WHERE city = 'Los Angeles' AND name = 'Apple Store';
How many employees live in Canada? Schema: - employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more))
SELECT COUNT(*) AS num_employees FROM employees WHERE country = 'Canada';
Which distinctive models are produced by maker with the full name General Motors or weighing more than 3500? Schema: - car_names(COUNT, Model) - model_list(Maker, Model) - car_makers(...) - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT DISTINCT T2.Model FROM car_names AS T1 JOIN model_list AS T2 ON T1.Model = T2.Model JOIN car_makers AS T3 ON T2.Maker = T3.Id JOIN cars_data AS T4 ON T1.MakeId = T4.Id WHERE T3.FullName = 'General Motors' OR T4.Weight > 3500;
Find the number of distinct amenities.? Schema: - Dorm_amenity(amenity_name)
SELECT COUNT(*) AS num_amenities FROM Dorm_amenity;
How many artists do we have? Schema: - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
SELECT COUNT(*) AS num_artists FROM artist;
What is the code of the city with 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;
how many states have a city called springfield? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT COUNT(state_name) AS num_states FROM city WHERE city_name = 'springfield';
How many regions are affected? Schema: - affected_region(Region_id)
SELECT COUNT(DISTINCT Region_id) AS num_regions FROM affected_region;
What is the placement date of the order whose invoice number is 10? 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.invoice_number = 10;
Find the titles of items that received both a rating higher than 8 and a rating below 5.? Schema: - item(title) - review(i_id, rank, rating, text)
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T1.title HAVING MAX(T2.rating) > 8 AND MIN(T2.rating) < 5;
What is the average, minimum, and maximum age for all French singers? Schema: - singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
SELECT AVG(Age) AS avg_age, MIN(Age) AS min_age, MAX(Age) AS max_age FROM singer WHERE Country = 'France';
how many papers does Christopher D. Manning have ? Schema: - writes(...) - author(...)
SELECT DISTINCT COUNT(DISTINCT T2.paperId) AS num_papers FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'Christopher D. Manning';
what is the population of boulder city? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT population FROM city WHERE city_name = 'boulder';
Which film has the most number of actors or actresses? List the film name, film id and description.? Schema: - film_actor(...) - film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
SELECT T2.title, T2.film_id, T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.title, T2.film_id, T2.description ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Show the average amount of transactions for different lots.? Schema: - Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code) - Transactions_Lots(...)
SELECT T2.lot_id, AVG(amount_of_transaction) AS avg_amount_of_transaction FROM Transactions AS T1 JOIN Transactions_Lots AS T2 ON T1.transaction_id = T2.transaction_id GROUP BY T2.lot_id;
What are the cell phone numbers of the candidates that received an assessment code of "Fail"? Schema: - Candidates(...) - Candidate_Assessments(asessment_outcome_code, assessment_date, candidate_id) - People(first_name)
SELECT T3.cell_mobile_number FROM Candidates AS T1 JOIN Candidate_Assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN People AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = 'Fail';
What is the total kills of the perpetrators with height more than 1.84.? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) - perpetrator(Country, Date, Injured, Killed, Location, Year)
SELECT SUM(T2.Killed) AS total_kills FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Height > 1.84;
Which parties have hosts of age above 50? Give me the party locations.? Schema: - party_host(...) - host(Age, COUNT, Name, Nationality) - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT T3.Location FROM party_host AS T1 JOIN host AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE TRY_CAST(T2.Age AS INT) > 50;
number of papers written by Christopher D. Manning? Schema: - writes(...) - author(...)
SELECT DISTINCT COUNT(DISTINCT T2.paperId) AS num_papers FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'Christopher D. Manning';
who is the most cited author at CVPR ? Schema: - venue(venueId, venueName) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - writes(...) - cite(...)
SELECT DISTINCT COUNT(DISTINCT T4.citingPaperId) AS num_citations, T1.authorId FROM venue AS T3 JOIN paper AS T2 ON T3.venueId = T2.venueId JOIN writes AS T1 ON T1.paperId = T2.paperId JOIN cite AS T4 ON T1.paperId = T4.citedPaperId WHERE T3.venueName = 'CVPR' GROUP BY T1.authorId ORDER BY num_citations DESC NULLS LAST;
What kind of decor has the least number of reservations? Schema: - Reservations(Adults, CheckIn, FirstName, Kids, LastName) - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT T2.decor FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T2.decor ORDER BY COUNT(T2.decor) ASC NULLS LAST LIMIT 1;
What are the distinct majors that students with treasurer votes are studying? 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.Major FROM Student AS T1 JOIN Voting_record AS T2 ON T1.StuID = T2.Treasurer_Vote;
List the hardware model name and company name for all the phones that were launched in year 2002 or have RAM size greater than 32.? Schema: - chip_model(Launch_year, Model_name, RAM_MiB, WiFi) - phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode)
SELECT T2.Hardware_Model_name, T2.Company_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model WHERE T1.Launch_year = 2002 OR T1.RAM_MiB > 32;
What is the id of the bike that traveled the most in 94002? Schema: - trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code)
SELECT bike_id FROM trip WHERE zip_code = 94002 AND bike_id IS NOT NULL GROUP BY bike_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is maximum group equity shareholding of the companies? Schema: - operate_company(Group_Equity_Shareholding, Type)
SELECT MAX(Group_Equity_Shareholding) AS max_group_equity_shareholding FROM operate_company;
What is the average and oldest age for each gender of student? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT AVG(Age) AS avg_age, MAX(Age) AS oldest_age, Sex FROM Student GROUP BY Sex;
How many papers are published in total? Schema: - Papers(title)
SELECT COUNT(*) AS num_papers FROM Papers;
What is average age for different job title? Schema: - Person(M, age, city, eng, gender, job, name)
SELECT AVG(age) AS avg_age, job FROM Person GROUP BY job;
Show the short names of the buildings managed by "Emma".? Schema: - Apartment_Buildings(building_address, building_description, building_full_name, building_manager, building_phone, building_short_name)
SELECT building_short_name FROM Apartment_Buildings WHERE building_manager = 'Emma';
Return the name and job title of the staff with the latest date assigned.? 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)
SELECT T1.staff_name, T2.job_title_code FROM Staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY T2.date_assigned_to DESC NULLS LAST LIMIT 1;
How many transcripts are released? Schema: - Transcripts(other_details, transcript_date)
SELECT COUNT(*) AS num_transcripts FROM Transcripts;
What are the distinct Famous release dates? Schema: - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
SELECT DISTINCT Famous_Release_date FROM artist;
What are the states with the most invoices? Schema: - invoices(billing_city, billing_country, billing_state, total)
SELECT billing_state, COUNT(*) AS num_invoices FROM invoices WHERE billing_country = 'USA' AND billing_state IS NOT NULL GROUP BY billing_state ORDER BY num_invoices DESC NULLS LAST LIMIT 1;
Give me the number of faculty members who participate in an activity? Schema: - Faculty_Participates_in(FacID)
SELECT COUNT(DISTINCT FacID) AS num_faculty FROM Faculty_Participates_in;
Tell me the distinct block codes where some rooms are available.? Schema: - Room(BlockCode, RoomType, Unavailable)
SELECT DISTINCT BlockCode FROM Room WHERE Unavailable = 0;
Show the id and builder of the railway that are associated with the most trains.? Schema: - railway(Builder, COUNT, Location) - train(Name, Service, Time, destination, name, origin, time, train_number)
SELECT T2.Railway_ID, T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID, T1.Builder ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
what is the lowest elevation in pennsylvania? Schema: - highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
SELECT lowest_elevation FROM highlow WHERE state_name = 'pennsylvania';
What is the headquarter of the company whose founder is James? Schema: - Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue)
SELECT Headquarter FROM Manufacturers WHERE Founder = 'James';
Which product has been ordered most number of times? Schema: - Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity) - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT T2.product_details FROM Order_Items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id, T2.product_details ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
For which countries are there more than four distinct addresses listed? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
SELECT country FROM Addresses WHERE country IS NOT NULL GROUP BY country HAVING COUNT(address_id) > 4;
give me some restaurants good for arabic food in mountain view ? Schema: - restaurant(...) - location(...)
SELECT T2.house_number, T1.name FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'mountain view' AND T1.food_type = 'arabic' AND T1.rating > 2.5;
what are the papers in NIPS about TAIL ? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - venue(venueId, venueName)
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 JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.keyphraseName = 'TAIL' AND T4.venueName = 'NIPS';
Find the name of the campuses that is in Northridge, Los Angeles or in San Francisco, San Francisco.? Schema: - Campuses(Campus, County, Franc, Location)
SELECT Campus FROM Campuses WHERE (Location = 'Northridge' AND County = 'Los Angeles') OR (Location = 'San Francisco' AND County = 'San Francisco');
display the department name and number of employees in each of the department.? Schema: - employees(COMMISSION_PCT, DEPARTMENT_ID, EMAIL, EMPLOYEE_ID, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, M, MANAGER_ID, PHONE_NUMBER, SALARY, ... (12 more)) - departments(DEPARTMENT_NAME, Market)
SELECT DEPARTMENT_NAME, COUNT(*) AS num_employees FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID GROUP BY DEPARTMENT_NAME;
For each constructor id, how many races are there? Schema: - constructorStandings(constructorId)
SELECT COUNT(*) AS num_races, constructorId FROM constructorStandings GROUP BY constructorId;
Find all the zip codes in which the max dew point have never reached 70.? Schema: - weather(AVG, COUNT, M, Ra, cloud_cover, date, diff, events, mean_humidity, mean_sea_level_pressure_inches, mean_temperature_f, mean_visibility_miles, ... (1 more))
SELECT zip_code FROM weather WHERE zip_code IS NOT NULL GROUP BY zip_code HAVING MAX(max_dew_point_f) < 70;
How many companies were created by Andy? Schema: - Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue)
SELECT COUNT(*) AS num_companies FROM Manufacturers WHERE Founder = 'Andy';
Show the name of the shop that has the most kind of devices in stock.? Schema: - stock(Quantity) - shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more))
SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID, T2.Shop_Name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Find the address and staff number of the shops that do not have any happy hour.? Schema: - shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) - happy_hour(COUNT, Month)
SELECT Address, Num_of_staff FROM shop WHERE Shop_ID NOT IN (SELECT Shop_ID FROM happy_hour);
Tell me the name of the staff in charge of the attraction called "US museum".? 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) - 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 FROM Staff AS T1 JOIN Tourist_Attractions AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T2.Name = 'US museum';
Find the producers of all movies in which " Kate Winslet " is an actor? 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) - directed_by(...) - director(Afghan, name, nationality)
SELECT T3.name FROM cast_ AS T4 JOIN actor AS T1 ON T4.aid = T1.aid JOIN movie AS T5 ON T5.mid = T4.msid JOIN directed_by AS T2 ON T5.mid = T2.msid JOIN director AS T3 ON T3.did = T2.did WHERE T1.name = 'Kate Winslet';
Show party names and the number of events for each party.? Schema: - party_events(Event_Name) - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT T2.Party_name, COUNT(*) AS num_events FROM party_events AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID, T2.Party_name;
What is the name, city, and country of the airport with 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 all the movies directed by " Asghar Farhadi " featuring " Taraneh Alidoosti " ? 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) - directed_by(...) - director(Afghan, name, nationality)
SELECT T4.title FROM cast_ AS T5 JOIN actor AS T1 ON T5.aid = T1.aid JOIN movie AS T4 ON T4.mid = T5.msid JOIN directed_by AS T2 ON T4.mid = T2.msid JOIN director AS T3 ON T3.did = T2.did WHERE T1.name = 'Taraneh Alidoosti' AND T3.name = 'Asghar Farhadi';
What are the names of all tracks that are on the Movies playlist but not in the music playlist? Schema: - tracks(composer, milliseconds, name, unit_price) - playlist_tracks(...) - playlists(name)
SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' AND T1.name NOT IN (SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music');
Find the total number of players.? Schema: - players(COUNT, birth_date, country_code, first_name, hand, last_name)
SELECT COUNT(*) AS num_players FROM players;
List the distinct payment method codes with the number of orders made? Schema: - Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code)
SELECT payment_method_code, COUNT(*) AS num_orders FROM Invoices GROUP BY payment_method_code;
papers about character recognition from before 2010? 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 = 'character recognition' AND T3."year" < 2010;
What is the id of the shortest trip? Schema: - trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code)
SELECT id FROM trip ORDER BY duration ASC NULLS LAST LIMIT 1;
What was the date of the earliest payment? Schema: - payment(amount, payment_date)
SELECT payment_date FROM payment ORDER BY payment_date ASC NULLS LAST LIMIT 1;
List the names of shops that have no devices in stock.? Schema: - shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) - stock(Quantity)
SELECT Shop_Name FROM shop WHERE Shop_ID NOT IN (SELECT Shop_ID FROM stock);
Find the average credit score of the customers who have some loan.? Schema: - customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) - loan(...)
SELECT AVG(credit_score) AS avg_credit_score FROM customer WHERE cust_ID IN (SELECT cust_ID FROM loan);
where can i find a jamerican cuisine in san francisco ? Schema: - restaurant(...) - location(...)
SELECT T2.house_number, T1.name FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'san francisco' AND T1.name = 'jamerican cuisine';
How many credits is the course that the student with the last name Smithson took, and what is its description? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) - ENROLL(...) - STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE) - COURSE(C, CRS_CODE, CRS_CREDIT, CRS_DESCRIPTION, DEPT_CODE)
SELECT T4.CRS_DESCRIPTION, T4.CRS_CREDIT FROM CLASS AS T1 JOIN ENROLL AS T2 ON T1.CLASS_CODE = T2.CLASS_CODE JOIN STUDENT AS T3 ON T3.STU_NUM = T2.STU_NUM JOIN COURSE AS T4 ON T4.CRS_CODE = T1.CRS_CODE WHERE T3.STU_LNAME = 'Smithson';
what are the event details of the services that have the type code 'Marriage'? Schema: - Events(...) - Services(Service_Type_Code, Service_name)
SELECT T1.Event_Details FROM Events AS T1 JOIN Services AS T2 ON T1.Service_ID = T2.Service_ID WHERE T2.Service_Type_Code = 'Marriage';
Give me the star rating descriptions of the hotels that cost more than 10000.? Schema: - Hotels(hotel_id, other_hotel_details, pets_allowed_yn, price_range, star_rating_code) - Ref_Hotel_Star_Ratings(...)
SELECT T2.star_rating_description FROM Hotels AS T1 JOIN Ref_Hotel_Star_Ratings AS T2 ON T1.star_rating_code = T2.star_rating_code WHERE T1.price_range > 10000;
What are the different names of the colleges involved in the tryout in alphabetical order? Schema: - Tryout(COUNT, EX, T1, cName, decision, pPos)
SELECT DISTINCT cName FROM Tryout ORDER BY cName ASC NULLS LAST;
What are the emails and phone numbers of all customers, sorted 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;
What are the start station's name and id for the one that had the most start trips in August? Schema: - trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code)
SELECT start_station_name, start_station_id FROM trip WHERE start_date LIKE '8/%' AND start_station_name IS NOT NULL AND start_station_id IS NOT NULL GROUP BY start_station_name, start_station_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
where is the lowest point in 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 states are there? Schema: - AREA_CODE_STATE(area_code, state)
SELECT COUNT(DISTINCT state) AS num_states FROM AREA_CODE_STATE;
What are the names of counties that do not contain any cities? Schema: - county_public_safety(COUNT, Case_burden, Crime_rate, Location, Name, Police_force, Police_officers, Population, T1) - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT Name FROM county_public_safety WHERE County_ID NOT IN (SELECT County_ID FROM city);
List the id of students who never attends courses? 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_Attendance(course_id, date_of_attendance, student_id)
SELECT student_id FROM Students WHERE student_id NOT IN (SELECT student_id FROM Student_Course_Attendance);
Find the name and budget of departments whose budgets are more than the average budget.? Schema: - department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name)
SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department);
What are the names of the members that have never registered at any branch? Schema: - member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more)) - membership_register_branch(...)
SELECT Name FROM member_ WHERE Member_ID NOT IN (SELECT Member_ID FROM membership_register_branch);
What is the reviewer name, film title, movie rating, and rating date for every movie ordered by reviewer name, movie title, then finally rating? Schema: - Rating(Rat, mID, rID, stars) - Movie(T1, director, title, year) - Reviewer(Lew, name, rID)
SELECT T3.name, T2.title, T1.stars, T1.ratingDate FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID ORDER BY T3.name, T2.title, T1.stars ASC NULLS LAST;
Show the customer id and number of accounts with most accounts.? Schema: - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
SELECT customer_id, COUNT(*) AS num_accounts FROM Accounts WHERE customer_id IS NOT NULL GROUP BY customer_id ORDER BY num_accounts DESC NULLS LAST LIMIT 1;
What are the names of organizations that contain the word "Party"? Schema: - Organizations(date_formed, organization_name)
SELECT organization_name FROM Organizations WHERE organization_name LIKE '%Party%';
Show the transaction type and the number of transactions.? Schema: - Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type)
SELECT transaction_type, COUNT(*) AS num_transactions FROM Financial_Transactions GROUP BY transaction_type;
In February, which city marks the highest temperature? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) - temperature(...)
SELECT T1.City FROM city AS T1 JOIN temperature AS T2 ON T1.City_ID = T2.City_ID ORDER BY T2.Feb DESC NULLS LAST LIMIT 1;
Find all the players' first name and last name who have empty death record.? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
SELECT name_first, name_last FROM player WHERE death_year IS NULL;
What TAIL paper published in NIPS ? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - venue(venueId, venueName)
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 JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.keyphraseName = 'TAIL' AND T4.venueName = 'NIPS';
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';
What is the first and last name of the youngest student with a GPA above 3, and what is their GPA? Schema: - STUDENT(DEPT_CODE, STU_DOB, STU_FNAME, STU_GPA, STU_HRS, STU_LNAME, STU_PHONE)
SELECT STU_FNAME, STU_LNAME, STU_GPA FROM STUDENT WHERE STU_GPA > 3 ORDER BY STU_DOB DESC NULLS LAST LIMIT 1;
What is the name of the department with the fewest members? Schema: - Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2) - Member_of(...)
SELECT T1.DName FROM Department AS T1 JOIN Member_of AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO, T1.DName ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
List the names of wrestlers that have not been eliminated.? Schema: - wrestler(COUNT, Days_held, Location, Name, Reign) - Elimination(Benjam, Eliminated_By, Elimination_Move, T1, Team, Time)
SELECT Name FROM wrestler WHERE CAST(Wrestler_ID AS TEXT) NOT IN (SELECT Wrestler_ID FROM Elimination);
where can we find a restaurant in alameda ? 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 = 'alameda';
List how many times the number of people in the room reached the maximum occupancy of the room. The number of people include adults and kids.? Schema: - Reservations(Adults, CheckIn, FirstName, Kids, LastName) - Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName)
SELECT COUNT(*) AS num_reservations FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T2.maxOccupancy = T1.Adults + T1.Kids;
List the names of players in ascending order of votes.? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
SELECT Player_name FROM player ORDER BY Votes ASC NULLS LAST;
Retrieve all the last names of authors in alphabetical order.? Schema: - Authors(fname, lname)
SELECT lname FROM Authors ORDER BY lname ASC NULLS LAST;
Find the states which do not have any employee in their record.? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) - Employees(COUNT, Date_of_Birth, Employee_ID, Employee_Name, Role_Code, employee_id, employee_name, role_code)
SELECT state_province_county FROM Addresses WHERE address_id NOT IN (SELECT employee_address_id FROM Employees);
What are the classroom number and grade number of each class in the list? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName)
SELECT DISTINCT Classroom, Grade FROM list;
what are some good places for arabic on buchanan in san francisco ? Schema: - restaurant(...) - location(...)
SELECT T2.house_number, T1.name FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'san francisco' AND T2.street_name = 'buchanan' AND T1.food_type = 'arabic' AND T1.rating > 2.5;
how many states does the missouri run through? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT COUNT(traverse) AS num_states FROM river WHERE river_name = 'missouri';
who has the most publications in syntactic parsing ? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - writes(...)
SELECT DISTINCT COUNT(T4.paperId) AS num_publications, T3.authorId FROM paperKeyphrase AS T1 JOIN keyphrase AS T2 ON T1.keyphraseId = T2.keyphraseId JOIN paper AS T4 ON T4.paperId = T1.paperId JOIN writes AS T3 ON T3.paperId = T4.paperId WHERE T2.keyphraseName = 'syntactic parsing' GROUP BY T3.authorId ORDER BY num_publications DESC NULLS LAST;
Show all majors and corresponding number of students.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT Major, COUNT(*) AS num_students FROM Student GROUP BY Major;