question
stringlengths
43
589
query
stringlengths
19
598
What is the full name ( first name and last name ) for those employees who gets more salary than the employee whose id is 163? 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 FIRST_NAME, LAST_NAME FROM employees WHERE SALARY > (SELECT SALARY FROM employees WHERE EMPLOYEE_ID = 163);
Find the grade studying in room 105.? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName)
SELECT DISTINCT Grade FROM list WHERE Classroom = 105;
Find the maximum price of wins from the appelations in Central Coast area and produced before the year of 2005.? Schema: - appellations(Area, County) - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
SELECT MAX(T2.Price) AS max_price FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = 'Central Coast' AND T2."Year" < 2005;
What are the birthdays of people in ascending order of height? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
SELECT Birth_Date FROM people ORDER BY Height ASC NULLS LAST;
What is the description, code and the corresponding count of each service type? Schema: - Ref_Service_Types(...) - Services(Service_Type_Code, Service_name)
SELECT T1.Service_Type_Description, T2.Service_Type_Code, COUNT(*) AS num_services FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code GROUP BY T2.Service_Type_Code, T1.Service_Type_Description;
What is the total number of gas stations that opened between 2000 and 2005? Schema: - gas_station(COUNT, Location, Manager_Name, Open_Year, Station_ID)
SELECT COUNT(*) AS num_gas_stations FROM gas_station WHERE Open_Year BETWEEN 2000 AND 2005;
Show the name of teachers aged either 32 or 33? Schema: - teacher(Age, COUNT, D, Hometown, Name)
SELECT Name FROM teacher WHERE Age = '32' OR Age = '33';
What are the names of all the dorms that don't have any amenities? Schema: - Dorm(dorm_name, gender, student_capacity) - Has_amenity(dormid)
SELECT dorm_name FROM Dorm WHERE dormid NOT IN (SELECT dormid FROM Has_amenity);
What is the name and price of the cheapest product? 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 ORDER BY Price ASC NULLS LAST LIMIT 1;
Show the distinct director of films with market estimation in the year of 1995.? Schema: - film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more)) - film_market_estimation(High_Estimate, Low_Estimate, Type)
SELECT DISTINCT T1.Director FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID WHERE T2."Year" = 1995;
Find the names of customers who have used either the service "Close a policy" or the service "Upgrade a policy".? 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)) - First_Notification_of_Loss(...) - Services(Service_Type_Code, Service_name)
SELECT T1.Customer_name FROM Customers AS T1 JOIN First_Notification_of_Loss AS T2 ON T1.Customer_ID = T2.Customer_ID JOIN Services AS T3 ON T2.Service_ID = T3.Service_ID WHERE T3.Service_name = 'Close a policy' OR T3.Service_name = 'Upgrade a policy';
return me the abstract of " Making database systems usable " .? Schema: - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year)
SELECT abstract FROM publication WHERE title = 'Making database systems usable';
Find all Mexican restaurant in Dallas with at least 3.5 stars? Schema: - category(...) - business(business_id, city, full_address, name, rating, review_count, state)
SELECT T1.name FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id JOIN category AS T3 ON T3.business_id = T1.business_id WHERE T1.city = 'Dallas' AND T1.rating > 3.5 AND T2.category_name = 'Mexican' AND T3.category_name = 'restaurant';
For each distinct product name, show its average product price.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT Product_Name, AVG(Product_Price) AS avg_product_price FROM Products GROUP BY Product_Name;
Find the first name of students who are living in the dorm that has most number of amenities.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - Lives_in(...) - Dorm(dorm_name, gender, student_capacity) - Has_amenity(dormid) - Dorm_amenity(amenity_name)
SELECT T1.Fname FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T2.dormid FROM Dorm AS T3 JOIN Has_amenity AS T4 ON T3.dormid = T4.dormid JOIN Dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T2.dormid, T3.dormid ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1);
who does Noah A Smith collaborate with ? 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';
Which Asian countries have a population that is larger than any country in Africa? 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 = 'Asia' AND Population > (SELECT MAX(Population) FROM country WHERE Continent = 'Africa');
What are the names of the colleges that are larger than at least one college in Florida? Schema: - College(M, cName, enr, state)
SELECT DISTINCT cName FROM College WHERE enr > (SELECT MIN(enr) FROM College WHERE state = 'FL');
Count the total number of policies used by the customer named "Dayana Robel".? 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)) - Customers_Policies(...)
SELECT COUNT(*) AS num_policies FROM Customers AS T1 JOIN Customers_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID WHERE T1.Customer_name = 'Dayana Robel';
Count the number of video games with Massively multiplayer online game type .? Schema: - Video_Games(COUNT, Dest, GName, GType, onl)
SELECT COUNT(*) AS num_games FROM Video_Games WHERE GType = 'Massively multiplayer online game';
What are the names of customers who have taken both Mortgage and Auto loans? Schema: - customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) - loan(...)
SELECT m.cust_name FROM (SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_ID = T2.cust_ID WHERE T2.loan_type = 'Mortgages') AS m JOIN (SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_ID = T2.cust_ID WHERE T2.loan_type = 'Auto') AS a ON m.cust_name = a.cust_name;
where is a good arabic 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;
Find the names and number of works of all artists who have at least one English songs.? Schema: - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT T1.artist_name, COUNT(*) AS num_works FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'english' GROUP BY T2.artist_name, T1.artist_name HAVING COUNT(*) >= 1;
Find the number of employees of each gender whose salary is lower than 50000.? Schema: - employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
SELECT COUNT(*) AS num_employees, Sex FROM employee WHERE Salary < 50000 GROUP BY Sex;
Which allergy type has least number of allergies? Schema: - Allergy_Type(Allergy, AllergyType, COUNT)
SELECT AllergyType FROM Allergy_Type WHERE AllergyType IS NOT NULL GROUP BY AllergyType ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
Find the number of customers who live in the city called Lake Geovannyton.? 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_Addresses(address_type_code) - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
SELECT COUNT(*) AS num_customers FROM Customers AS T1 JOIN Customer_Addresses AS T2 ON T1.customer_id = T2.customer_id JOIN Addresses AS T3 ON T2.address_id = T3.address_id WHERE T3.city = 'Lake Geovannyton';
What is the id of the event with the most participants? Schema: - Participants_in_Events(COUNT, Event_ID, Participant_ID)
SELECT Event_ID FROM Participants_in_Events WHERE Event_ID IS NOT NULL GROUP BY Event_ID ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the party that has the largest number of representatives? Schema: - representative(JO, Lifespan, Name, Party, State, T1)
SELECT Party, COUNT(*) AS num_representatives FROM representative WHERE Party IS NOT NULL GROUP BY Party ORDER BY num_representatives DESC NULLS LAST LIMIT 1;
Find the name of project that continues for the longest time.? Schema: - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details)
SELECT Name FROM Projects ORDER BY Hours DESC NULLS LAST LIMIT 1;
What are the details of all sales and purchases? Schema: - Sales(...) - Purchases(...)
SELECT DISTINCT sales_details FROM (SELECT sales_details FROM Sales UNION ALL SELECT purchase_details FROM Purchases);
What are the the lesson ids of all staff taught by Janessa Sawayn whose nickname has the letter s? Schema: - Lessons(lesson_status_code) - 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.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn' AND nickname LIKE '%s%';
Find the first names and last names of male (sex is M) faculties who live in building NEB.? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
SELECT Fname, LName FROM Faculty WHERE Sex = 'M' AND Building = 'NEB';
Find all the policy types that are used by more than 2 customers.? Schema: - Policies(COUNT, Policy_Type_Code)
SELECT Policy_Type_Code FROM Policies WHERE Policy_Type_Code IS NOT NULL GROUP BY Policy_Type_Code HAVING COUNT(*) > 2;
What are the names of colleges that have two or more players, listed in descending alphabetical order? Schema: - match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team)
SELECT College FROM match_season WHERE College IS NOT NULL GROUP BY College HAVING COUNT(*) >= 2 ORDER BY College DESC NULLS LAST;
List all ship names in the order of built year and class.? Schema: - Ship(Built_Year, COUNT, Class, Flag, Name, Type)
SELECT Name FROM Ship ORDER BY Built_Year, Class ASC NULLS LAST;
What is the number of movies that " Brad Pitt " acts in per year ? 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 COUNT(DISTINCT T2.title) AS num_movies, T2.release_year FROM cast_ AS T3 JOIN actor AS T1 ON T3.aid = T1.aid JOIN movie AS T2 ON T2.mid = T3.msid WHERE T1.name = 'Brad Pitt' GROUP BY T2.release_year;
For each country and airline name, how many routes are there? Schema: - airlines(Abbreviation, Airline, COUNT, Country, active, country, name) - routes(...)
SELECT T1.country, T1.name, COUNT(*) AS num_routes FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.country, T1.name;
Find the student ID and login name of the student with the most course enrollments? 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.login_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id, T2.login_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
List the votes of elections in descending order.? Schema: - election(Committee, Date, Delegate, District, Vote_Percent, Votes)
SELECT Votes FROM election ORDER BY Votes DESC NULLS LAST;
Find the id and surname of the driver who participated the most number of races? 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 GROUP BY T1.driverId, T1.surname ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
How many articles were published in the Cell journal in 2015 ? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - journal(Theme, homepage, name) - paperKeyphrase(...)
SELECT DISTINCT COUNT(T3.paperId) AS num_articles FROM paper AS T3 JOIN journal AS T2 ON T3.journalId = T2.journalId JOIN paperKeyphrase AS T1 ON T3.paperId = T1.paperId WHERE T2.journalName = 'Cell' AND T3."year" = 2015;
Find the name of amenities Smith Hall dorm have. ordered the results by amenity names.? Schema: - Dorm(dorm_name, gender, student_capacity) - Has_amenity(dormid) - Dorm_amenity(amenity_name)
SELECT T3.amenity_name FROM Dorm AS T1 JOIN Has_amenity AS T2 ON T1.dormid = T2.dormid JOIN Dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' ORDER BY T3.amenity_name ASC NULLS LAST;
where are some restaurants good for french food 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;
How many students live in each city and what are their average ages? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT COUNT(*) AS num_students, AVG(Age) AS avg_age, city_code FROM Student GROUP BY city_code;
What are the names of actors and the musicals that they are in? Schema: - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more)) - musical(Award, COUNT, Name, Nom, Nominee, Result, T1)
SELECT T1.Name, T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID;
Show the minimum, average, and maximum age of all students.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT MIN(Age) AS min_age, AVG(Age) AS avg_age, MAX(Age) AS max_age FROM Student;
Which first names are used for professionals or owners but are not used as dog names? Schema: - Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street) - Owners(email_address, first_name, last_name, state) - Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
SELECT DISTINCT first_name FROM (SELECT first_name FROM Professionals UNION ALL SELECT first_name FROM Owners WHERE first_name NOT IN (SELECT name FROM Dogs));
What are the names of customers with credit score less than the average credit score across customers? Schema: - customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id)
SELECT cust_name FROM customer WHERE credit_score < (SELECT AVG(credit_score) FROM customer);
Which flight numbers correspond to United Airlines flights? Schema: - flights(DestAirport, FlightNo, SourceAirport) - airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
SELECT T1.FlightNo FROM flights AS T1 JOIN airlines AS T2 ON T2.uid = T1.Airline WHERE T2.Airline = 'United Airlines';
how large is new mexico? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT area FROM state WHERE state_name = 'new mexico';
What are the maximum, minimum and average home games each stadium held? Schema: - stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
SELECT MAX(Home_Games) AS max_home_games, MIN(Home_Games) AS min_home_games, AVG(Home_Games) AS avg_home_games FROM stadium;
Find the first name of the professor who is teaching two courses with code CIS-220 and QM-261.? Schema: - EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
SELECT T1.EMP_FNAME FROM EMPLOYEE AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE T2.CRS_CODE = 'CIS-220' AND EXISTS (SELECT 1 FROM CLASS AS T2_sub WHERE T2_sub.CRS_CODE = 'QM-261' AND T1.EMP_NUM = T2_sub.PROF_NUM);
Which country is the airport that has the highest altitude located in? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT country FROM airports ORDER BY elevation DESC NULLS LAST LIMIT 1;
display job title and average salary of employees.? 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)) - jobs(JOB_TITLE, diff)
SELECT JOB_TITLE, AVG(SALARY) AS avg_salary FROM employees AS T1 JOIN jobs AS T2 ON T1.JOB_ID = T2.JOB_ID GROUP BY T2.JOB_TITLE;
What is the title and director for the movie with highest worldwide gross in the year 2000 or before? Schema: - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
SELECT Title, Director FROM movie WHERE "Year" <= 2000 ORDER BY Gross_worldwide DESC NULLS LAST LIMIT 1;
List the distinct hometowns that are not associated with any gymnast.? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) - gymnast(Floor_Exercise_Points, Horizontal_Bar_Points)
SELECT DISTINCT T1.Hometown FROM people AS T1 LEFT JOIN (SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID) AS T3 ON T1.Hometown = T3.Hometown WHERE T3.Hometown IS NULL;
Which city has the most addresses? List the city name, number of addresses, and city id.? Schema: - address(address, district, phone, postal_code) - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT T2.city, COUNT(*) AS num_addresses, T1.city_id FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id GROUP BY T1.city_id, T2.city ORDER BY num_addresses DESC NULLS LAST LIMIT 1;
How many order items correspond to each order id? Schema: - Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
SELECT order_id, COUNT(*) AS num_order_items FROM Order_Items GROUP BY order_id;
What are the distinct salaries of all instructors who earned less than the maximum salary? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT DISTINCT salary FROM instructor WHERE salary < (SELECT MAX(salary) FROM instructor);
List all the movies directed by " Asghar Farhadi " in which " Taraneh Alidoosti " played? 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';
When was benjamin mako hill 's first paper written ? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT COUNT(T3.paperId) AS num_papers, T3."year" 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 = 'benjamin mako hill' GROUP BY T3."year" ORDER BY T3."year" ASC NULLS LAST;
what are the names of the ships ordered by ascending tonnage? Schema: - ship(COUNT, DIST, JO, K, Name, Nationality, T1, Tonnage, Type, disposition_of_ship, name, tonnage)
SELECT Name FROM ship ORDER BY Tonnage ASC NULLS LAST;
What are the different grant amounts for documents sent before '1986-08-26 20:49:27' and after the grant ended on '1989-03-16 18:27:16'? Schema: - Grants(grant_amount, organisation_id) - 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 DISTINCT T1.grant_amount FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id WHERE T2.sent_date < '1986-08-26 20:49:27' AND T1.grant_end_date > '1989-03-16 18:27:16';
What are the names of all instructors with names that include "dar"? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT name FROM instructor WHERE name LIKE '%dar%';
where is mount whitney located? Schema: - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT state_name FROM mountain WHERE mountain_name = 'whitney';
What is the location of the perpetrator with the largest kills.? Schema: - perpetrator(Country, Date, Injured, Killed, Location, Year)
SELECT Location FROM perpetrator ORDER BY Killed DESC NULLS LAST LIMIT 1;
show the titles, and authors or editors for all books made after the year 1989.? Schema: - book_club(Author_or_Editor, Book_Title, COUNT, Category, Publ, Publisher, T1)
SELECT Book_Title, Author_or_Editor FROM book_club WHERE "Year" > 1989;
What are the names and countries of origin for the artists who produced the top three highly rated songs.? Schema: - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender) - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name ORDER BY T2.rating DESC NULLS LAST LIMIT 3;
which state has the lowest elevation? Schema: - highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
SELECT state_name FROM highlow WHERE lowest_elevation = (SELECT MIN(lowest_elevation) FROM highlow);
What are the names of mountains that have a height of over 5000 or a prominence of over 1000? Schema: - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT Name FROM mountain WHERE Height > 5000 OR Prominence > 1000;
Find the description and code of the service type that is performed the most times.? Schema: - Ref_Service_Types(...) - Services(Service_Type_Code, Service_name)
SELECT T1.Service_Type_Description, T1.Service_Type_Code FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code GROUP BY T1.Service_Type_Code, T1.Service_Type_Description ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the names of high schoolers who have a grade of over 5 and have 2 or more friends? Schema: - Friend(student_id) - Highschooler(COUNT, ID, grade, name)
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.ID WHERE T2.grade > 5 GROUP BY T1.student_id, T2.name HAVING COUNT(*) >= 2;
Show ids for all templates not used by any document.? Schema: - Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number) - 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 Template_ID FROM Templates WHERE Template_ID NOT IN (SELECT Template_ID FROM Documents);
How many tips has Michelle written in 2010? Schema: - user_(name) - tip(month, text)
SELECT COUNT(DISTINCT T1."text") AS num_tips FROM user_ AS T2 JOIN tip AS T1 ON T2.user_id = T1.user_id WHERE T1."year" = 2010 AND T2.name = 'Michelle';
Show all headquarters without a company in banking industry.? Schema: - company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more))
SELECT DISTINCT T1.Headquarters FROM company AS T1 LEFT JOIN company AS T2 ON T1.Headquarters = T2.Headquarters AND T2.Main_Industry = 'Banking' WHERE T2.Headquarters IS NULL;
Which department has more than 1 head at a time? List the id, name and the number of heads.? Schema: - department(Budget_in_Billions, COUNT, Creation, Dname, F, Market, Mgr_start_date, budget, building, dept_name, name) - management(temporary_acting)
SELECT T1.department_ID, T1.name, COUNT(*) AS num_heads FROM department AS T1 JOIN management AS T2 ON T1.department_ID = T2.department_ID GROUP BY T1.department_ID, T1.name HAVING COUNT(*) > 1;
Find the number of people who is under 40 for each gender.? Schema: - Person(M, age, city, eng, gender, job, name)
SELECT COUNT(*) AS num_people, gender FROM Person WHERE age < 40 GROUP BY gender;
Find all actors who are from Afghanistan? Schema: - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
SELECT name FROM actor WHERE nationality = 'Afghanistan';
what keywords are used by papers at uist? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - venue(venueId, venueName)
SELECT DISTINCT T1.keyphraseId 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 T4.venueName = 'uist';
Find the names of stadiums that some Australian swimmers have been to.? Schema: - swimmer(Name, Nationality, meter_100, meter_200, meter_300) - record(...) - event(Date, Event_Attendance, Name, Venue, Year) - stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
SELECT T4.Name FROM swimmer AS T1 JOIN record AS T2 ON T1.ID = T2.Swimmer_ID JOIN event AS T3 ON T2.Event_ID = T3.ID JOIN stadium AS T4 ON T4.ID = T3.Stadium_ID WHERE T1.Nationality = 'Australia';
give me 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;
What is the membership level with the most people? Schema: - member_(Address, Age, COUNT, Card_Number, Country, Hometown, Level, Member_ID, Member_Name, Membership_card, Name, Party_ID, ... (1 more))
SELECT Level FROM member_ WHERE Level IS NOT NULL GROUP BY Level ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
how long is the rio grande? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT LENGTH FROM river WHERE river_name = 'rio grande';
Return the staff ids and genders for any staff with the title Department Manager.? 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_id, T1.staff_gender FROM Staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = 'Department Manager';
what is the longest river that runs through a state that borders tennessee? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) - border_info(T1, border, state_name)
SELECT river_name FROM river WHERE LENGTH = (SELECT MAX(LENGTH) FROM river WHERE traverse IN (SELECT border FROM border_info WHERE state_name = 'tennessee')) AND traverse IN (SELECT border FROM border_info WHERE state_name = 'tennessee');
What is the total amount of grant money for research? Schema: - Grants(grant_amount, organisation_id) - Organisations(...) - Organisation_Types(...)
SELECT SUM(grant_amount) AS total_grant_money FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id JOIN Organisation_Types AS T3 ON T2.organisation_type = T3.organisation_type WHERE T3.organisation_type_description = 'Research';
What are the names of the races held after 2017 in Spain? Schema: - races(date, name) - circuits(circuitId, country, location, name)
SELECT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitId = T2.circuitId WHERE T2.country = 'Spain' AND T1."year" > 2017;
In how many different states are banks located? Schema: - bank(SUM, bname, city, morn, no_of_customers, state)
SELECT COUNT(DISTINCT state) AS num_states FROM bank;
Show the countries that have both managers of age above 50 and managers of age below 46.? Schema: - manager(Age, Country, Level, Name, Working_year_starts, m1)
SELECT DISTINCT m1.Country FROM manager m1 JOIN manager m2 ON m1.Country = m2.Country WHERE m1.Age > 50 AND m2.Age < 46;
Find all the stores in the district with the most population.? Schema: - store(Type) - store_district(...) - district(City_Area, City_Population, District_name, d)
SELECT T1.Store_Name FROM store AS T1 JOIN store_district AS T2 ON T1.Store_ID = T2.Store_ID WHERE District_ID = (SELECT District_ID FROM district ORDER BY City_Population DESC NULLS LAST LIMIT 1);
What is the average age and how many male students are there in each city? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT COUNT(*) AS num_students, AVG(Age) AS avg_age, city_code FROM Student WHERE Sex = 'M' GROUP BY city_code;
Find the name and revenue of the company that earns the highest revenue in each city.? Schema: - Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue)
SELECT Name, MAX(Revenue) AS max_revenue, Headquarter FROM Manufacturers GROUP BY Headquarter, Name;
Find the average access count of documents with the least popular structure.? 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 AVG(access_count) AS avg_access_count FROM Documents WHERE document_structure_code IS NOT NULL GROUP BY document_structure_code ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
Which employees do not authorize destruction for any document? Give me their employee ids.? Schema: - Employees(COUNT, Date_of_Birth, Employee_ID, Employee_Name, Role_Code, employee_id, employee_name, role_code) - Documents_to_be_Destroyed(Destroyed_by_Employee_ID, Destruction_Authorised_by_Employee_ID)
SELECT Employee_ID FROM Employees WHERE Employee_ID NOT IN (SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_Destroyed);
Find each student's first name.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT DISTINCT Fname FROM Student;
What is the name of the product with the highest 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 DESC NULLS LAST LIMIT 1;
What are the names and release years for all the songs of the youngest singer? Schema: - singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
SELECT Song_Name, Song_release_year FROM singer ORDER BY Age ASC NULLS LAST LIMIT 1;
Count the number of different statuses.? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT COUNT(DISTINCT Status) AS num_statuses FROM city;
What are the names of all the circuits that are in the UK or Malaysia? Schema: - circuits(circuitId, country, location, name)
SELECT name FROM circuits WHERE country = 'UK' OR country = 'Malaysia';
Show the name of singers whose birth year is either 1948 or 1949? Schema: - singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
SELECT Name FROM singer WHERE Birth_Year = 1948 OR Birth_Year = 1949;