question
stringlengths
43
589
query
stringlengths
19
598
What are the dates that had the top 5 cloud cover rates? Also tell me the cloud cover rate.? 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 "date", cloud_cover FROM weather ORDER BY cloud_cover DESC NULLS LAST LIMIT 5;
What are the total enrollments of universities of each affiliation type? Schema: - university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School)
SELECT SUM(Enrollment) AS total_enrollments, Affiliation FROM university GROUP BY Affiliation;
What are the lot details of lots associated with transactions with share count smaller than 50? Schema: - Lots(investor_id, lot_details) - Transactions_Lots(...) - Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code)
SELECT T1.lot_details FROM Lots AS T1 JOIN Transactions_Lots AS T2 ON T1.lot_id = T2.transaction_id JOIN Transactions AS T3 ON T2.transaction_id = T3.transaction_id WHERE TRY_CAST(T3.share_count AS DOUBLE) < 50;
What year is the movie " The Imitation Game " from ? Schema: - movie(Budget_million, Director, Find, Gross_worldwide, T1, Title, Year, budget, release_year, title)
SELECT release_year FROM movie WHERE title = 'The Imitation Game';
What are the numbers of the shortest flights? Schema: - flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more))
SELECT flno FROM flight ORDER BY distance ASC NULLS LAST LIMIT 3;
When was benjamin mako hill 's first publication ? 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 is the oldest log id and its corresponding problem id? Schema: - Problem_Log(log_entry_date, log_entry_description, problem_id, problem_log_id)
SELECT problem_log_id, problem_id FROM Problem_Log ORDER BY log_entry_date ASC NULLS LAST LIMIT 1;
What are the full names of all players, sorted by birth date? Schema: - players(COUNT, birth_date, country_code, first_name, hand, last_name)
SELECT first_name, last_name FROM players ORDER BY birth_date ASC NULLS LAST;
Does sharon goldwater have any papers published ? Schema: - writes(...) - author(...)
SELECT DISTINCT T2.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'sharon goldwater';
List all every engineer's first name, last name, details and coresponding skill description.? Schema: - Maintenance_Engineers(COUNT, T1, engineer_id, first_name, last_name) - Engineer_Skills(...) - Skills(...)
SELECT T1.first_name, T1.last_name, T1.other_details, T3.skill_description FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id;
Find the arriving date and the departing date of the dogs that received a treatment.? Schema: - Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight) - Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id)
SELECT DISTINCT T1.date_arrived, T1.date_departed FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id = T2.dog_id;
What are the different names of all the races in reverse alphabetical order? Schema: - races(date, name)
SELECT DISTINCT name FROM races ORDER BY name DESC NULLS LAST;
Return all the apartment numbers sorted by the room count in ascending order.? Schema: - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT apt_number FROM Apartments ORDER BY room_count ASC NULLS LAST;
Find the first names of all the authors ordered in alphabetical order.? Schema: - Authors(fname, lname)
SELECT fname FROM Authors ORDER BY fname ASC NULLS LAST;
What are the ids of the students who registered for some courses but had the least number of courses for all students? Schema: - Student_Course_Registrations(COUNT, student_id)
SELECT student_id FROM Student_Course_Registrations WHERE student_id IS NOT NULL GROUP BY student_id ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
List the all the assets make, model, details by the disposed date ascendingly.? Schema: - Assets(asset_acquired_date, asset_details, asset_disposed_date, asset_id, asset_make, asset_model)
SELECT asset_make, asset_model, asset_details FROM Assets ORDER BY asset_disposed_date ASC NULLS LAST;
What are the names of the managers for gas stations that are operated by the ExxonMobil company? 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.Manager_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 WHERE T2.Company = 'ExxonMobil';
What is the language that is used by the largest number of Asian nations? 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 T2."Language" FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Continent = 'Asia' GROUP BY T2."Language" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
return me the number of keywords .? Schema: - keyword(keyword)
SELECT COUNT(DISTINCT keyword) AS num_keywords FROM keyword;
Find the room number of the rooms which can sit 50 to 100 students and their buildings.? Schema: - classroom(building, capacity, room_number)
SELECT building, room_number FROM classroom WHERE capacity BETWEEN 50 AND 100;
in what journals does linda shapiro publish ? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - journal(Theme, homepage, name) - writes(...) - author(...)
SELECT DISTINCT T2.journalId FROM paper AS T3 JOIN journal AS T2 ON T3.journalId = T2.journalId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T1.authorName = 'linda shapiro';
Return the rank for which there are the fewest captains.? Schema: - captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l)
SELECT "Rank" FROM captain GROUP BY "Rank" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
Show statement id, statement detail, account detail for accounts.? Schema: - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) - Statements(Statement_Details, Statement_ID)
SELECT T1.Statement_ID, T2.Statement_Details, T1.Account_Details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.Statement_ID = T2.Statement_ID;
What are the names of wines whose production year are before the year of all wines by Brander winery? Schema: - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
SELECT Name FROM wine WHERE "Year" < (SELECT MIN("Year") FROM wine WHERE Winery = 'Brander');
How many parks are there in Atlanta city? Schema: - park(city, state)
SELECT COUNT(*) AS num_parks FROM park WHERE city = 'Atlanta';
what states does the ohio run through? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT traverse FROM river WHERE river_name = 'ohio';
What is the name of the most recent movie? Schema: - Movie(T1, director, title, year)
SELECT title FROM Movie WHERE "year" = (SELECT MAX("year") FROM Movie);
Find how many school locations have the word 'NY'.? Schema: - university(Affiliation, Enrollment, Founded, Location, Nickname, Primary_conference, School)
SELECT COUNT(*) AS num_locations FROM university WHERE Location LIKE '%NY%';
What are the makers and models? Schema: - model_list(Maker, Model)
SELECT Maker, Model FROM model_list;
What is the model for the car with a weight smaller than the average? 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.Weight < (SELECT AVG(Weight) FROM cars_data);
Find the product category description of the product category with code "Spices".? Schema: - Ref_Product_Categories(product_category_code, product_category_description, unit_of_measure)
SELECT product_category_description FROM Ref_Product_Categories WHERE product_category_code = 'Spices';
Return the the "active to date" of the latest contact channel used by the customer named "Tillman Ernser".? 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_Contact_Channels(DATEDIFF, DAY, active_from_date, active_to_date, channel_code, contact_number, diff)
SELECT MAX(T2.active_to_date) AS max_active_to_date FROM Customers AS T1 JOIN Customer_Contact_Channels AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = 'Tillman Ernser';
Show all artist names and the number of exhibitions for each artist.? Schema: - exhibition(Theme, Ticket_Price, Year) - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
SELECT T2.Name, COUNT(*) AS num_exhibitions FROM exhibition AS T1 JOIN artist AS T2 ON T1.Artist_ID = T2.Artist_ID GROUP BY T1.Artist_ID, T2.Name;
What is the total time for all lessons taught by Janessa Sawayn? 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 SUM(TRY_CAST(lesson_time AS DOUBLE)) AS total_time 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';
Find the average and maximum rating of all reviews.? Schema: - review(i_id, rank, rating, text)
SELECT AVG(rating) AS avg_rating, MAX(rating) AS max_rating FROM review;
Give the state corresponding to the line number building "6862 Kaitlyn Knolls".? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode)
SELECT state_province_county FROM Addresses WHERE line_1_number_building LIKE '%6862 Kaitlyn Knolls%';
How many car models are produced by each maker ? Only list the count and the maker full name .? Schema: - model_list(Maker, Model) - car_makers(...)
SELECT COUNT(*) AS num_models, T2.FullName FROM model_list AS T1 JOIN car_makers AS T2 ON T1.Maker = T2.Id GROUP BY T2.Id, T2.FullName;
What is the average unit price of rock tracks? Schema: - Genre(Name) - Track(Milliseconds, Name, UnitPrice)
SELECT AVG(T2.UnitPrice) AS avg_unit_price FROM Genre AS T1 JOIN Track AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = 'Rock';
Which semeseter and year had the fewest students? Schema: - takes(COUNT, semester, year)
SELECT semester, "year" FROM takes GROUP BY semester, "year" ORDER BY COUNT(*) ASC NULLS LAST LIMIT 1;
Datasets with semantic parsing information? Schema: - paperDataset(...) - dataset(...) - paperKeyphrase(...) - keyphrase(...)
SELECT DISTINCT T2.datasetId FROM paperDataset AS T3 JOIN dataset AS T2 ON T3.datasetId = T2.datasetId JOIN paperKeyphrase AS T1 ON T1.paperId = T3.paperId JOIN keyphrase AS T4 ON T1.keyphraseId = T4.keyphraseId WHERE T4.keyphraseName = 'semantic parsing';
Return the average age across all artists.? Schema: - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
SELECT AVG(Age) AS avg_age FROM artist;
What are the names and descriptions of the all courses under the "Computer Science" subject? Schema: - Courses(course_description, course_name) - Subjects(subject_name)
SELECT T1.course_name, T1.course_description FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = 'Computer Science';
What is the theme and artist name for the exhibition with a ticket price higher than the average? Schema: - exhibition(Theme, Ticket_Price, Year) - artist(Age, Artist, Country, Famous_Release_date, Famous_Title, Year_Join, artist_name, country, gender)
SELECT T1.Theme, T2.Name FROM exhibition AS T1 JOIN artist AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Ticket_Price > (SELECT AVG(Ticket_Price) FROM exhibition);
What are the students' first names who have both cats and dogs as pets? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - Has_Pet(...) - Pets(PetID, PetType, pet_age, weight)
SELECT T1.Fname FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID JOIN Pets AS T3 ON T3.PetID = T2.PetID WHERE T3.PetType = 'cat' AND T1.Fname IN (SELECT T4.Fname FROM Student AS T4 JOIN Has_Pet AS T5 ON T4.StuID = T5.StuID JOIN Pets AS T6 ON T6.PetID = T5.PetID WHERE T6.PetType = 'dog');
Find the driver id and number of races of all drivers who have at most participated in 30 races? Schema: - drivers(forename, nationality, surname) - results(...) - races(date, name)
SELECT T1.driverId, COUNT(*) AS num_races 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 HAVING COUNT(*) <= 30;
What are the birth dates of employees living in Edmonton? Schema: - Employee(BirthDate, City, FirstName, LastName, Phone)
SELECT BirthDate FROM Employee WHERE City = 'Edmonton';
Who are the members of the club named "Hopkins Student Enterprises"? Show the last name.? Schema: - Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn) - Member_of_club(...) - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT T3.LName FROM Club AS T1 JOIN Member_of_club AS T2 ON T1.ClubID = T2.ClubID JOIN Student AS T3 ON T2.StuID = T3.StuID WHERE T1.ClubName = 'Hopkins Student Enterprises';
Find the average age of students who do not have any pet .? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - Has_Pet(...)
SELECT AVG(Age) AS avg_age FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_Pet);
What is the average latitude and longitude of the starting points of all trips? Schema: - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more)) - trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code)
SELECT AVG(T1.lat) AS avg_latitude, AVG(T1.long) AS avg_longitude FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id;
What is the product description of the product booked with an amount of 102.76? Schema: - Products_Booked(booked_count, product_id) - Products_for_Hire(daily_hire_cost, product_description, product_name, product_type_code)
SELECT T2.product_description FROM Products_Booked AS T1 JOIN Products_for_Hire AS T2 ON T1.product_id = T2.product_id WHERE T1.booked_amount = 102.76;
what states capital is salem? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT state_name FROM state WHERE capital = 'salem';
Find the total account balance of each customer from Utah or Texas.? Schema: - customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id)
SELECT SUM(acc_bal) AS total_balance FROM customer WHERE state = 'Utah' OR state = 'Texas';
Which building has the largest number of company offices? Give me the building name.? Schema: - Office_locations(...) - buildings(Height, Status, Stories, name) - Companies(Assets_billion, Bank, COUNT, Ch, Headquarters, Industry, Market_Value_billion, Profits_billion, Sales_billion, T1, name)
SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T1.building_id, T2.name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
List countries that have more than one swimmer.? Schema: - swimmer(Name, Nationality, meter_100, meter_200, meter_300)
SELECT Nationality, COUNT(*) AS num_swimmers FROM swimmer WHERE Nationality IS NOT NULL GROUP BY Nationality HAVING COUNT(*) > 1;
Find the name and country of origin for all artists who have release at least one song of resolution above 900.? 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 WHERE T2.resolution > 900 GROUP BY T2.artist_name, T1.artist_name, T1.country HAVING COUNT(*) >= 1;
For each stadium, how many concerts play there? Schema: - concert(COUNT, Year) - stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
SELECT T2.Name, COUNT(*) AS num_concerts FROM concert AS T1 JOIN stadium AS T2 ON T1.Stadium_ID = T2.Stadium_ID GROUP BY T1.Stadium_ID, T2.Name;
What are the details for the project whose research has been published? Schema: - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) - Project_Outcomes(outcome_code) - Research_Outcomes(...)
SELECT T1.project_details FROM Projects AS T1 JOIN Project_Outcomes AS T2 ON T1.project_id = T2.project_id JOIN Research_Outcomes AS T3 ON T2.outcome_code = T3.outcome_code WHERE T3.outcome_description LIKE '%Published%';
Show the ids of the employees who don't authorize destruction for any document.? 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);
return me the number of keywords in PVLDB .? Schema: - publication_keyword(...) - keyword(keyword) - publication(COUNT, Mak, Price, Publ, Publication_Date, Publisher, T1, abstract, citation_num, reference_num, title, year) - journal(Theme, homepage, name)
SELECT COUNT(DISTINCT T1.keyword) AS num_keywords FROM publication_keyword AS T4 JOIN keyword AS T1 ON T4.kid = T1.kid JOIN publication AS T2 ON T2.pid = T4.pid JOIN journal AS T3 ON T2.jid = T3.jid WHERE T3.name = 'PVLDB';
What is the number of car models that are produced by each maker and what is the id and full name of each maker? Schema: - model_list(Maker, Model) - car_makers(...)
SELECT COUNT(*) AS num_models, T2.FullName, T2.Id FROM model_list AS T1 JOIN car_makers AS T2 ON T1.Maker = T2.Id GROUP BY T2.Id, T2.FullName;
What are the ids of all female students who play football? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
SELECT DISTINCT T1.StuID FROM Student AS T1 JOIN SportsInfo AS T2 ON T1.StuID = T2.StuID WHERE T1.Sex = 'F' AND T2.SportName = 'Football';
How many flights depart from 'APG'? Schema: - flights(DestAirport, FlightNo, SourceAirport)
SELECT COUNT(*) AS num_flights FROM flights WHERE SourceAirport = 'APG';
Show project ids and the number of documents in each project.? 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 Project_ID, COUNT(*) AS num_documents FROM Documents GROUP BY Project_ID;
Show the most common location of performances.? Schema: - performance(Attendance, COUNT, Date, Location, T1)
SELECT Location FROM performance WHERE Location IS NOT NULL GROUP BY Location ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
what rivers flow through states that alabama borders? 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 traverse IN (SELECT border FROM border_info WHERE state_name = 'alabama');
How many invoices correspond to each order id? Schema: - Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code)
SELECT order_id, COUNT(*) AS num_invoices FROM Invoices GROUP BY order_id;
Show all the activity names and the number of faculty involved in each activity.? Schema: - Activity(activity_name) - Faculty_Participates_in(FacID)
SELECT T1.activity_name, COUNT(*) AS num_faculty FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid, T1.activity_name;
List all the policy types used by the customer enrolled in the most policies.? 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(...) - Available_Policies(COUNT, Customer_Phone, Life, policy_type_code)
SELECT DISTINCT T3.policy_type_code FROM Customers AS T1 JOIN Customers_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID JOIN Available_Policies AS T3 ON T2.Policy_ID = T3.Policy_ID WHERE T1.Customer_name = (SELECT T1.Customer_name FROM Customers AS T1 JOIN Customers_Policies AS T2 ON T1.Customer_ID = T2.Customer_ID GROUP BY T1.Customer_name ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1);
What are the distinct ages of the heads who are acting? Schema: - head(age, born_state, head_ID, name) - management(temporary_acting)
SELECT DISTINCT T1.age FROM head AS T1 JOIN management AS T2 ON T1.head_ID = T2.head_ID WHERE T2.temporary_acting = 'Yes';
What are the full names of faculties with sex M and 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';
What are the ids of all students who have advisor number 1121? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT StuID FROM Student WHERE Advisor = 1121;
How many different types of transactions are there? Schema: - Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type)
SELECT COUNT(DISTINCT transaction_type) AS num_transaction_types FROM Financial_Transactions;
What are the email addresses of the drama workshop groups with address in Alaska state? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) - Drama_Workshop_Groups(COUNT, Currency_Code, Marketing_Region_Code, Store_Name)
SELECT T2.Store_Email_Address FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = CAST(T2.Address_ID AS TEXT) WHERE T1.State_County = 'Alaska';
Show all allergy types and the number of allergies in each type.? Schema: - Allergy_Type(Allergy, AllergyType, COUNT)
SELECT AllergyType, COUNT(*) AS num_allergies FROM Allergy_Type GROUP BY AllergyType;
Count how many appointments have been made in total.? Schema: - Appointment(AppointmentID, Start)
SELECT COUNT(*) AS num_appointments FROM Appointment;
What are the maximum and minimum settlement amount on record? Schema: - Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount)
SELECT MAX(Settlement_Amount) AS max_settlement_amount, MIN(Settlement_Amount) AS min_settlement_amount FROM Settlements;
What is the name and capacity for the stadium with the highest average attendance? Schema: - stadium(Average, Average_Attendance, Capacity, Capacity_Percentage, City, Country, Home_Games, Location, Name, Opening_year, T1)
SELECT Name, Capacity FROM stadium ORDER BY Average DESC NULLS LAST LIMIT 1;
What are the official names of cities that have hosted more than one competition? Schema: - city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) - farm_competition(Hosts, Theme, Year)
SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID, T1.Official_Name HAVING COUNT(*) > 1;
What has Richard Ladner published at chi ? Schema: - venue(venueId, venueName) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) - writes(...) - author(...)
SELECT DISTINCT T3.paperId FROM venue AS T4 JOIN paper AS T3 ON T4.venueId = T3.venueId JOIN writes AS T2 ON T2.paperId = T3.paperId JOIN author AS T1 ON T2.authorId = T1.authorId WHERE T1.authorName = 'Richard Ladner' AND T4.venueName = 'chi';
Find the city the store named "FJA Filming" is in.? Schema: - Addresses(address_content, city, country, line_1, line_1_number_building, line_2, state_province_county, town_city, zip_postcode) - Stores(...)
SELECT T1.City_Town FROM Addresses AS T1 JOIN Stores AS T2 ON T1.Address_ID = CAST(T2.Address_ID AS TEXT) WHERE T2.Store_Name = 'FJA Filming';
For each classroom, show the classroom number and find how many students are using it.? Schema: - list(COUNT, Classroom, FirstName, Grade, LastName)
SELECT Classroom, COUNT(*) AS num_students FROM list GROUP BY Classroom;
Show the property type descriptions of properties belonging to that code.? Schema: - Properties(property_name, property_type_code, room_count) - Ref_Property_Types(...)
SELECT T2.property_type_description FROM Properties AS T1 JOIN Ref_Property_Types AS T2 ON T1.property_type_code = T2.property_type_code GROUP BY T1.property_type_code, T2.property_type_description;
List all role codes, role names, and role descriptions.? Schema: - Roles(Role_Code, Role_Description, Role_Name, role_code, role_description)
SELECT Role_Code, Role_Name, Role_Description FROM Roles;
What is the maximum OMIM value in the database? Schema: - enzyme(Chromosome, Location, OMIM, Porphyria, Product, name)
SELECT MAX(OMIM) AS max_omim FROM enzyme;
How many students play each sport? Schema: - SportsInfo(COUNT, GamesPlayed, OnScholarship, SportName, StuID)
SELECT SportName, COUNT(*) AS num_students FROM SportsInfo GROUP BY SportName;
List the name of all products along with the number of complaints that they have received.? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) - Complaints(complaint_status_code, complaint_type_code)
SELECT T1.product_name, COUNT(*) AS num_complaints FROM Products AS T1 JOIN Complaints AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_name;
What is the total rating of channel for each channel owner? Schema: - channel(Name, Owner, Rating_in_percent, Share_in_percent)
SELECT SUM(Rating_in_percent) AS total_rating, Owner FROM channel GROUP BY Owner;
List document type codes and the number of documents in each code.? Schema: - Documents(COUNT, Document_Description, Document_ID, Document_Name, Document_Type_Code, I, K, Project_ID, Robb, Template_ID, access_count, document_id, ... (7 more))
SELECT Document_Type_Code, COUNT(*) AS num_documents FROM Documents GROUP BY Document_Type_Code;
How many distinct governors are there? Schema: - party(COUNT, Comptroller, First_year, Governor, Last_year, Left_office, Location, Minister, Number_of_hosts, Party, Party_Theme, Party_name, ... (3 more))
SELECT COUNT(DISTINCT Governor) AS num_governors FROM party;
Return the average transaction amount, as well as the total amount of all transactions.? Schema: - Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type)
SELECT AVG(transaction_amount) AS avg_transaction_amount, SUM(transaction_amount) AS total_transaction_amount FROM Financial_Transactions;
What are the top 5 countries by number of invoices and how many do they have? Schema: - invoices(billing_city, billing_country, billing_state, total)
SELECT billing_country, COUNT(*) AS num_invoices FROM invoices WHERE billing_country IS NOT NULL GROUP BY billing_country ORDER BY num_invoices DESC NULLS LAST LIMIT 5;
where is a restaurant in mountain view that serves good arabic food ? Schema: - restaurant(...) - location(...)
SELECT T2.house_number, T1.name FROM restaurant AS T1 JOIN location AS T2 ON T1.id = T2.restaurant_id WHERE T2.city_name = 'mountain view' AND T1.food_type = 'arabic' AND T1.rating > 2.5;
What are the names of photos taken with the lens brand 'Sigma' or 'Olympus'? Schema: - camera_lens(brand, name) - photos(color, id, name)
SELECT T1.name FROM camera_lens AS T1 JOIN photos AS T2 ON T2.camera_lens_id = T1.id WHERE T1.brand = 'Sigma' OR T1.brand = 'Olympus';
Find the minimum salary for the departments whose average salary is above the average payment of all instructors.? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT MIN(salary) AS min_salary, dept_name FROM instructor WHERE dept_name IS NOT NULL GROUP BY dept_name HAVING AVG(salary) > (SELECT AVG(salary) FROM instructor WHERE dept_name IS NOT NULL);
What are full names and salaries of employees working in the city of London? 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) - locations(COUNTRY_ID)
SELECT FIRST_NAME, LAST_NAME, SALARY FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID JOIN locations AS T3 ON T2.LOCATION_ID = T3.LOCATION_ID WHERE T3.CITY = 'London';
Find the major and age of students who do not have a cat pet.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age) - Has_Pet(...) - Pets(PetID, PetType, pet_age, weight)
SELECT Major, Age FROM Student WHERE StuID NOT IN (SELECT T1.StuID FROM Student AS T1 JOIN Has_Pet AS T2 ON T1.StuID = T2.StuID JOIN Pets AS T3 ON T3.PetID = T2.PetID WHERE T3.PetType = 'cat');
What are the id and name of the photos for mountains? Schema: - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more)) - photos(color, id, name)
SELECT T1.id, T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.Height > 4000;
What are the first names and birthdates of the professors in charge of ACCT-211? Schema: - EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME) - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM)
SELECT DISTINCT T1.EMP_FNAME, T1.EMP_DOB FROM EMPLOYEE AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE CRS_CODE = 'ACCT-211';
Find the maximum age of all the students.? Schema: - Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
SELECT MAX(Age) AS max_age FROM Student;
List the number of people injured by perpetrators in ascending order.? Schema: - perpetrator(Country, Date, Injured, Killed, Location, Year)
SELECT Injured FROM perpetrator ORDER BY Injured ASC NULLS LAST;