question
stringlengths
43
589
query
stringlengths
19
598
What is the forename and surname of the driver with the shortest laptime? Schema: - drivers(forename, nationality, surname) - lapTimes(...)
SELECT T1.forename, T1.surname FROM drivers AS T1 JOIN lapTimes AS T2 ON T1.driverId = T2.driverId ORDER BY T2.milliseconds ASC NULLS LAST LIMIT 1;
What are all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona.? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
SELECT DISTINCT address_content FROM (SELECT address_content FROM Addresses WHERE city = 'East Julianaside' AND state_province_county = 'Texas' UNION ALL SELECT address_content FROM Addresses WHERE city = 'Gleasonmouth' AND state_province_county = 'Arizona');
Which city has the most frequent destination airport? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name) - flights(DestAirport, FlightNo, SourceAirport)
SELECT T1.City FROM airports AS T1 JOIN flights AS T2 ON T1.AirportCode = T2.DestAirport GROUP BY T1.City ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the id and salary of the employee named Mark Young? Schema: - employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
SELECT eid, salary FROM employee WHERE name = 'Mark Young';
return me the homepage of " University of Michigan " .? Schema: - organization(continent, homepage, name)
SELECT homepage FROM organization WHERE name = 'University of Michigan';
For each injury accident, find the date of the game and the name of the injured player in the game, and sort the results in descending order of game season.? Schema: - game(Date, Home_team, Season) - injury_accident(Source)
SELECT T1."Date", T2.Player FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id ORDER BY T1.Season DESC NULLS LAST;
List the names of buildings with at least 200 feet of height and with at least 20 floors.? Schema: - building(Floors, Height_feet, Name, build)
SELECT Name FROM building WHERE Height_feet >= 200 AND Floors >= 20;
What is the charge amount of the most expensive charge type? Schema: - Charges(charge_amount, charge_type)
SELECT MAX(charge_amount) AS max_charge_amount FROM Charges;
Who is the youngest employee in the company? List employee's first and last name.? 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 ORDER BY birth_date DESC NULLS LAST LIMIT 1;
what is the name and position of the head whose department has least number of employees? Schema: - Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2) - Physician(I, Name)
SELECT T2.Name, T2."Position" FROM Department AS T1 JOIN Physician AS T2 ON T1.Head = T2.EmployeeID GROUP BY T2.Name, T2."Position", DepartmentID ORDER BY COUNT(DepartmentID) ASC NULLS LAST LIMIT 1;
Return the different statuses of cities, ascending by frequency.? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
SELECT Status FROM city WHERE Status IS NOT NULL GROUP BY Status ORDER BY COUNT(*) ASC NULLS LAST;
What are the names of instructors who didn't teach courses in the Spring? 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 WHERE semester = 'Spring');
Return the different countries for artists.? Schema: - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
SELECT DISTINCT Country FROM artist;
What is the list of school locations sorted in descending order of school foundation year? Schema: - school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type)
SELECT Location FROM school ORDER BY Founded DESC NULLS LAST;
What are the names and damage in millions for storms, ordered by their max speeds descending? Schema: - storm(Damage_millions_USD, Dates_active, Name, Number_Deaths)
SELECT Name, Damage_millions_USD FROM storm ORDER BY Max_speed DESC NULLS LAST;
How many budget record has a budget amount smaller than the invested amount? Schema: - budget(Budgeted)
SELECT COUNT(*) AS num_budget_records FROM budget WHERE Budgeted < Invested;
List all the names of schools with an endowment amount smaller than or equal to 10.? Schema: - endowment(School_id, amount, donator_name) - School(County, Enrollment, Location, Mascot, School_name)
SELECT T2.School_name FROM endowment AS T1 JOIN School AS T2 ON CAST(T1.School_id AS TEXT) = T2.School_id GROUP BY T1.School_id, T2.School_name HAVING SUM(T1.amount) <= 10;
Sort all the distinct products in alphabetical order.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT DISTINCT product_name FROM Products ORDER BY product_name ASC NULLS LAST;
Show all directors.? Schema: - film(COUNT, Directed_by, Director, Gross_in_dollar, JO, LENGTH, Studio, T1, Title, language_id, rating, rental_rate, ... (3 more))
SELECT DISTINCT Directed_by FROM film;
Find the market shares and names of furnitures which no any company is producing in our records.? Schema: - furniture(Furniture_ID, Market_Rate, Name) - furniture_manufacte(...)
SELECT Market_Rate, Name FROM furniture WHERE Furniture_ID NOT IN (SELECT Furniture_ID FROM furniture_manufacte);
What is the description of the marketing region China? Schema: - Marketing_Regions(Ch, Marketing_Region_Descriptrion, Marketing_Region_Name)
SELECT Marketing_Region_Descriptrion FROM Marketing_Regions WHERE Marketing_Region_Name = 'China';
What are the names of people who have a height greater than 200 or less than 190? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
SELECT Name FROM people WHERE Height > 200 OR Height < 190;
Give me the best restaurant in san francisco for french 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 = 'san francisco' AND T1.food_type = 'french' AND T1.rating = (SELECT MAX(T1.rating) FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'san francisco' AND T1.food_type = 'french');
Give the total population and average surface area corresponding to countries in North America that have a surface area greater than 3000 .? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
SELECT SUM(Population) AS total_population, AVG(SurfaceArea) AS avg_surface_area FROM country WHERE Continent = 'North America' AND SurfaceArea > 3000;
Show the name of employees with three lowest salaries.? Schema: - employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
SELECT name FROM employee ORDER BY salary ASC NULLS LAST LIMIT 3;
What are the first name, last name, and gender of all the good customers? Order by their last name.? 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 first_name, last_name, gender_mf FROM Customers WHERE good_or_bad_customer = 'good' ORDER BY last_name ASC NULLS LAST;
return me the number of papers published in PVLDB in each year .? Schema: - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - journal(Theme, homepage, name)
SELECT COUNT(DISTINCT T2.title) AS num_papers, T2."year" FROM publication AS T2 JOIN journal AS T1 ON T2.jid = T1.jid WHERE T1.name = 'PVLDB' GROUP BY T2."year";
What is the zip code of staff with first name as Janessa and last name as Sawayn lived? 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';
Give the phones for departments in room 268.? Schema: - Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2)
SELECT DPhone FROM Department WHERE Room = '268';
Return the names and locations of shops, ordered by name in alphabetical order.? Schema: - shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more))
SELECT Shop_Name, Location FROM shop ORDER BY Shop_Name ASC NULLS LAST;
Give me a list of id and status of orders which belong to the customer named "Jeramie".? Schema: - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more)) - Orders(customer_id, date_order_placed, order_id)
SELECT T2.order_id, T2.order_status FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = 'Jeramie';
What is the invoice number and invoice date corresponding to the invoice with the greatest number of transactions? Schema: - Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type) - Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code)
SELECT T2.invoice_number, T2.invoice_date FROM Financial_Transactions AS T1 JOIN Invoices AS T2 ON T1.invoice_number = T2.invoice_number GROUP BY T2.invoice_number, T2.invoice_date ORDER BY COUNT(T2.invoice_date) DESC NULLS LAST LIMIT 1;
What are the titles and authors or editors that correspond to books made after 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;
Find the number of rooms with more than 50 capacity for each building.? Schema: - classroom(building, capacity, room_number)
SELECT COUNT(*) AS num_rooms, building FROM classroom WHERE capacity > 50 GROUP BY building;
Which vocal type did the musician with first name "Solveig" played in the song with title "A Bar in Amsterdam"? Schema: - Vocals(COUNT, Type) - Songs(Title) - Band(...)
SELECT Type FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId JOIN Band AS T3 ON T1.Bandmate = T3.Id WHERE T3.Firstname = 'Solveig' AND T2.Title = 'A Bar In Amsterdam';
Show the names of all the employees with role "HR".? Schema: - Employees(COUNT, Date_of_Birth, Employee_ID, Employee_Name, Role_Code, employee_id, employee_name, role_code)
SELECT Employee_Name FROM Employees WHERE Role_Code = 'HR';
What are the maximum and minimum age of students with major 600? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT MAX(Age) AS max_age, MIN(Age) AS min_age FROM Student WHERE Major = 600;
List all the types of forms.? Schema: - Forms(form_type_code)
SELECT DISTINCT form_type_code FROM Forms;
Find the names of all instructors whose name includes the substring “dar”.? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT name FROM instructor WHERE name LIKE '%dar%';
What are the names of all the clubs ordered in descending alphabetical order? Schema: - club(Region, Start_year, name)
SELECT name FROM club ORDER BY name DESC NULLS LAST;
What are the names of all employees who have a certificate to fly Boeing 737-800? Schema: - employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary) - certificate(eid) - aircraft(Description, aid, d, distance, name)
SELECT T1.name FROM employee AS T1 JOIN certificate AS T2 ON T1.eid = T2.eid JOIN aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = 'Boeing 737-800';
For each college, return the college name and the count of authors with submissions from that college.? Schema: - submission(Author, COUNT, College, Scores)
SELECT College, COUNT(*) AS num_authors FROM submission GROUP BY College;
Count the number of institutions.? Schema: - Inst(...)
SELECT COUNT(*) AS num_institutions FROM Inst;
where can i eat some good 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 destination has the fewest number of flights? Schema: - flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more))
SELECT destination FROM flight WHERE destination IS NOT NULL GROUP BY destination ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
For the cars with 4 cylinders, which model has the largest horsepower? Schema: - car_names(COUNT, Model) - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT T1.Model FROM car_names AS T1 JOIN cars_data AS T2 ON T1.MakeId = T2.Id WHERE T2.Cylinders = 4 ORDER BY T2.Horsepower DESC NULLS LAST LIMIT 1;
Find the maximum weight for each type of pet. List the maximum weight and pet type.? Schema: - Pets(PetID, PetType, pet_age, weight)
SELECT MAX(weight) AS max_weight, PetType FROM Pets GROUP BY PetType;
What are the names of the directors who made exactly one movie excluding director NULL? Schema: - Movie(T1, director, title, year)
SELECT director FROM Movie WHERE director IS not null AND director IS NOT NULL GROUP BY director HAVING COUNT(*) = 1;
Find the name of the most expensive hardware product.? 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 WHERE product_type_code = 'Hardware' ORDER BY product_price DESC NULLS LAST LIMIT 1;
Show the name of track and the number of races in each track.? Schema: - race(Class, Date, Name) - track(Location, Name, Seat, Seating, T1, Year_Opened)
SELECT T2.Name, COUNT(*) AS num_races FROM race AS T1 JOIN track AS T2 ON T1.Track_ID = CAST(T2.Track_ID AS TEXT) GROUP BY T1.Track_ID, T2.Name;
Find the visit date and details of the tourist whose detail is 'Vincent'? Schema: - Visitors(Tourist_Details) - Visits(Visit_Date)
SELECT T2.Visit_Date, T2.Visit_Details FROM Visitors AS T1 JOIN Visits AS T2 ON T1.Tourist_ID = T2.Tourist_ID WHERE T1.Tourist_Details = 'Vincent';
What are the full names of faculty members who are a part of department 520? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex) - Member_of(...)
SELECT T1.Fname, T1.LName FROM Faculty AS T1 JOIN Member_of AS T2 ON T1.FacID = T2.FacID WHERE T2.DNO = 520;
Who has friends that are older than the average age? Print their friends and their ages as well? Schema: - Person(M, age, city, eng, gender, job, name) - PersonFriend(M, friend, name)
SELECT DISTINCT T2.name, T2.friend, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT AVG(age) FROM Person);
How many trips stated from a station in Mountain View and ended at one in Palo Alto? Schema: - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
SELECT COUNT(*) AS num_trips FROM station AS T1, trip AS T2, station AS T3, trip AS T4 WHERE T1.id = T2.start_station_id AND T2.id = T4.id AND T3.id = T4.end_station_id AND T1.city = 'Mountain View' AND T3.city = 'Palo Alto';
What are the names of all directors who have made one movie except for the director named NULL? Schema: - Movie(T1, director, title, year)
SELECT director FROM Movie WHERE director IS not null AND director IS NOT NULL GROUP BY director HAVING COUNT(*) = 1;
name the rivers in illinois? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT river_name FROM river WHERE traverse = 'illinois';
What are the descriptions of the service types with product price above 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;
parsing papers with most citations? Schema: - paperKeyphrase(...) - keyphrase(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - cite(...)
SELECT DISTINCT T4.citedPaperId, COUNT(T4.citedPaperId) AS num_citations FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN cite AS T4 ON T3.paperId = T4.citedPaperId WHERE T1.keyphraseName = 'parsing' GROUP BY T4.citedPaperId ORDER BY num_citations DESC NULLS LAST;
Which assets did not incur any fault log? List the asset model.? Schema: - Assets(asset_acquired_date, asset_details, asset_disposed_date, asset_id, asset_make, asset_model) - Fault_Log(...)
SELECT asset_model FROM Assets WHERE asset_id NOT IN (SELECT asset_id FROM Fault_Log);
What is the name of the district with the smallest area? Schema: - district(City_Area, City_Population, District_name, d)
SELECT District_name FROM district ORDER BY City_Area ASC NULLS LAST LIMIT 1;
Find the average ram mib size of the chip models that are never used by any phone.? 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 AVG(RAM_MiB) AS avg_ram_mib FROM chip_model WHERE Model_name NOT IN (SELECT chip_model FROM phone);
How many car models are produced in the usa? Schema: - model_list(Maker, Model) - car_makers(...) - countries(...)
SELECT COUNT(*) AS num_models FROM model_list AS T1 JOIN car_makers AS T2 ON T1.Maker = T2.Id JOIN countries AS T3 ON T2.CountryId = T3.CountryId WHERE T3.CountryName = 'usa';
What are the citizenships that are shared by singers with a birth year before 1945 and after 1955? Schema: - singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
SELECT Citizenship FROM singer WHERE Birth_Year < 1945 OR Birth_Year > 1955 AND Citizenship IS NOT NULL GROUP BY Citizenship HAVING COUNT(DISTINCT CASE WHEN Birth_Year < 1945 THEN Singer_ID END) > 0 AND COUNT(DISTINCT CASE WHEN Birth_Year > 1955 THEN Singer_ID END) > 0;
How many official languages are spoken in Afghanistan? 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 COUNT(*) AS num_languages FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = 'Afghanistan' AND IsOfficial = 'T';
Give me the payment Id, the date and the amount for all the payments processed with Visa.? Schema: - Payments(Amount_Payment, COUNT, Date_Payment_Made, Payment_ID, Payment_Method_Code, V, amount_due, amount_paid, payment_date, payment_type_code)
SELECT Payment_ID, Date_Payment_Made, Amount_Payment FROM Payments WHERE Payment_Method_Code = 'Visa';
what is the density of wyoming? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT density FROM state WHERE state_name = 'wyoming';
What are the locations and representatives' names of the gas stations owned by the companies with the 3 largest amounts of assets? Schema: - station_company(...) - company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more)) - gas_station(COUNT, Location, Manager_Name, Open_Year, Station_ID)
SELECT T3.Location, T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.Company_ID = T2.Company_ID JOIN gas_station AS T3 ON T1.Station_ID = T3.Station_ID ORDER BY T2.Assets_billion DESC NULLS LAST LIMIT 3;
How many Professors are in building NEB? Schema: - Faculty(Building, COUNT, FacID, Fname, LName, Lname, Phone, Pr, Rank, Room, Sex)
SELECT COUNT(*) AS num_professors FROM Faculty WHERE "Rank" = 'Professor' AND Building = 'NEB';
List the number of different series names and contents in the TV Channel table.? Schema: - TV_Channel(Content, Country, Engl, Hight_definition_TV, Language, Package_Option, Pixel_aspect_ratio_PAR, id, series_name)
SELECT COUNT(DISTINCT series_name) AS num_series_names, COUNT(DISTINCT Content) AS num_contents FROM TV_Channel;
List the names of teachers who have not been arranged to teach courses.? Schema: - teacher(Age, COUNT, D, Hometown, Name) - course_arrange(...)
SELECT Name FROM teacher WHERE Teacher_ID NOT IN (SELECT Teacher_ID FROM course_arrange);
Which customers use "Cash" for payment method? Return the customer names.? Schema: - Customers(BIGINT, COUNT, Customer_Details, Customer_ID, Customer_name, Mar, Rat, TRY_CAST, V, address_line_1, address_line_2, amount_outstanding, ... (25 more))
SELECT customer_name FROM Customers WHERE payment_method = 'Cash';
What are the coupon amount of the coupons owned by both good and bad customers? Schema: - Discount_Coupons(...) - 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 DISTINCT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN Customers AS T2 ON T1.coupon_id = T2.coupon_id JOIN Customers AS T3 ON T1.coupon_id = T3.coupon_id WHERE (T2.good_or_bad_customer = 'good' AND T3.good_or_bad_customer = 'bad');
Show the locations of schools that have more than 1 player.? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) - school(Denom, Denomination, EX, Enrollment, Founded, Location, School_Colors, T1, Type)
SELECT T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID, T2.Location HAVING COUNT(*) > 1;
What are the shipping agent names? Schema: - Ref_Shipping_Agents(shipping_agent_code, shipping_agent_name)
SELECT shipping_agent_name FROM Ref_Shipping_Agents;
Show the distinct venues of debates? Schema: - debate(Date, Venue)
SELECT DISTINCT Venue FROM debate;
Return the colleges that have players who play the Midfielder position, as well as players who play the Defender position.? Schema: - match_season(COUNT, College, Draft_Class, Draft_Pick_Number, JO, Player, Position, T1, Team)
SELECT DISTINCT T1.College FROM (SELECT College FROM match_season WHERE "Position" = 'Midfielder') AS T1 JOIN (SELECT College FROM match_season WHERE "Position" = 'Defender') AS T2 ON T1.College = T2.College;
how many states are in the usa? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT COUNT(state_name) AS num_states FROM state WHERE country_name = 'United States';
Find the first names of students studying in room 108.? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName)
SELECT FirstName FROM list WHERE Classroom = 108;
List all the log ids and their descriptions from the problem logs.? Schema: - Problem_Log(log_entry_date, log_entry_description, problem_id, problem_log_id)
SELECT problem_log_id, log_entry_description FROM Problem_Log;
List the names of editors who are older than 25.? Schema: - editor(Age, COUNT, Name)
SELECT Name FROM editor WHERE Age > 25;
What are the ids of all stations that have a latitude above 37.4 and have never had less than 7 bikes available? Schema: - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) - status(...)
SELECT id FROM station WHERE lat > 37.4 AND id NOT IN (SELECT station_id FROM status WHERE station_id IS NOT NULL GROUP BY station_id HAVING MIN(bikes_available) < 7);
Return the maximum and minimum population among all counties.? Schema: - county(County_name, Population, Zip_code)
SELECT MAX(Population) AS max_population, MIN(Population) AS min_population FROM county;
Find the name of customers who have loans of both Mortgages and Auto.? 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;
What are the names of wines, sorted in alphabetical order? Schema: - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
SELECT DISTINCT Name FROM wine ORDER BY Name ASC NULLS LAST;
What are the characters of actors in descending order of age? Schema: - actor(Afghan, Aust, COUNT, Character, Chr, Duration, Kev, Name, age, birth_city, birth_year, first_name, ... (4 more))
SELECT "Character" FROM actor ORDER BY age DESC NULLS LAST;
Find the name of account that has the lowest total checking and saving balance.? Schema: - ACCOUNTS(name) - CHECKING(balance) - SAVINGS(SAV, balance)
SELECT T1.name FROM ACCOUNTS AS T1 JOIN CHECKING AS T2 ON T1.custid = T2.custid JOIN SAVINGS AS T3 ON T1.custid = T3.custid ORDER BY T2.balance + T3.balance ASC NULLS LAST LIMIT 1;
Find the name of the item with the lowest average rating.? 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 T2.i_id, T1.title ORDER BY AVG(T2.rating) ASC NULLS LAST LIMIT 1;
Find the name of companies that do not make DVD drive.? Schema: - Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT Name FROM Manufacturers WHERE Name NOT IN (SELECT T2.Name FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code WHERE T1.Name = 'DVD drive');
return me all the papers in PVLDB in " 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) - journal(Theme, homepage, name)
SELECT T5.title FROM organization AS T2 JOIN author AS T1 ON T2.oid = T1.oid JOIN writes AS T4 ON T4.aid = T1.aid JOIN publication AS T5 ON T4.pid = T5.pid JOIN journal AS T3 ON T5.jid = T3.jid WHERE T3.name = 'PVLDB' AND T2.name = 'University of Michigan';
What are the SSN and names of scientists working on the project with the most hours? Schema: - AssignedTo(Scientist) - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) - Scientists(Name)
SELECT T3.SSN, T3.Name FROM AssignedTo AS T1 JOIN Projects AS T2 ON T1.Project = T2.Code JOIN Scientists AS T3 ON T1.Scientist = T3.SSN WHERE T2.Hours = (SELECT MAX(Hours) FROM Projects);
What are the descriptions for the aircrafts? Schema: - aircraft(Description, aid, d, distance, name)
SELECT Description FROM aircraft;
What are the ids of the problems which are reported before 1978-06-26? Schema: - Problems(date_problem_reported, problem_id)
SELECT problem_id FROM Problems WHERE date_problem_reported < DATE '1978-06-26';
In which year are there festivals both inside the 'United States' and outside the 'United States'? Schema: - festival_detail(Chair_Name, Festival_Name, Location, T1, Year)
SELECT T1."Year" FROM festival_detail AS T1 JOIN festival_detail AS T2 ON T1."Year" = T2."Year" WHERE T1.Location = 'United States' AND T2.Location != 'United States';
Show the party that has the most people.? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
SELECT Party FROM people WHERE Party IS NOT NULL GROUP BY Party ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What are the names of the county that the delegates on "Appropriations" committee belong to? Schema: - county(County_name, Population, Zip_code) - election(Committee, Date, Delegate, District, Vote_Percent, Votes)
SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District WHERE T2.Committee = 'Appropriations';
How many females does this network has? Schema: - Person(M, age, city, eng, gender, job, name)
SELECT COUNT(*) AS num_females FROM Person WHERE gender = 'female';
Find users whose average review rating is below 3? Schema: - user_(name) - review(i_id, rank, rating, text)
SELECT T2.name FROM user_ AS T2 JOIN review AS T1 ON T2.user_id = T1.user_id GROUP BY T2.name HAVING AVG(T1.rating) < 3;
What are the forenames and surnames of drivers who participated in the races named Australian Grand Prix but not the races named Chinese Grand Prix? Schema: - races(date, name) - results(...) - drivers(forename, nationality, surname)
SELECT T3.forename, T3.surname FROM races AS T1 JOIN results AS T2 ON T1.raceId = T2.raceId JOIN drivers AS T3 ON T2.driverId = T3.driverId WHERE T1.name = 'Chinese Grand Prix';
what is the city in wyoming with the largest population? 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 MAX(population) FROM city WHERE state_name = 'wyoming') AND state_name = 'wyoming';
What journals has Takashi Matsumoto published in ? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT T3.journalId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'Takashi Matsumoto' GROUP BY T3.journalId;