question
stringlengths
43
589
query
stringlengths
19
598
Which physician was trained in the procedure that costs the most.? Schema: - Physician(I, Name) - Trained_In(...) - Procedures(Cost, Name)
SELECT T1.Name FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment ORDER BY T3.Cost DESC NULLS LAST LIMIT 1;
What are the ids and names of department stores with both marketing and managing departments? Schema: - Departments(...) - Department_Stores(COUNT, dept_store_chain_id)
SELECT DISTINCT T2.dept_store_id, T2.store_name FROM Departments AS T1 JOIN Department_Stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name IN ('marketing', 'managing');
Which enzyme names have the substring "ALA"? Schema: - enzyme(Chromosome, Location, OMIM, Porphyria, Product, name)
SELECT name FROM enzyme WHERE name LIKE '%ALA%';
Show the facility codes of apartments with more than 4 bedrooms.? Schema: - Apartment_Facilities(...) - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT T1.facility_code FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4;
Return the sum of all payment amounts.? Schema: - payment(amount, payment_date)
SELECT SUM(amount) AS total_payment_amount FROM payment;
In what year was the most degrees conferred? Schema: - degrees(Campus, Degrees, SUM, Year)
SELECT "Year" FROM degrees GROUP BY "Year" ORDER BY SUM(Degrees) DESC NULLS LAST LIMIT 1;
What are the names of the sections in reverse alphabetical order? Schema: - Sections(section_description, section_name)
SELECT section_name FROM Sections ORDER BY section_name DESC NULLS LAST;
What is the maximum elevation of all airports in the country of Iceland? Schema: - airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
SELECT MAX(elevation) AS max_elevation FROM airports WHERE country = 'Iceland';
List the forename and surname of all distinct drivers who once had laptime less than 93000 milliseconds? Schema: - drivers(forename, nationality, surname) - lapTimes(...)
SELECT DISTINCT T1.forename, T1.surname FROM drivers AS T1 JOIN lapTimes AS T2 ON T1.driverId = T2.driverId WHERE T2.milliseconds < 93000;
What is the average age of 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;
Show different parties of people along with the number of people in each party.? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
SELECT Party, COUNT(*) AS num_people FROM people GROUP BY Party;
What are the names of buildings sorted in descending order of building height? Schema: - buildings(Height, Status, Stories, name)
SELECT name FROM buildings ORDER BY Height DESC NULLS LAST;
For how many clubs is "Tracy Kim" a member? 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 COUNT(*) AS num_clubs 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 T3.Fname = 'Tracy' AND T3.LName = 'Kim';
Return the maximum support rate, minimum consider rate, and minimum oppose rate across all candidates? Schema: - candidate(COUNT, Candidate_ID, Consider_rate, Oppose_rate, Poll_Source, Support_rate, Unsure_rate)
SELECT MAX(Support_rate) AS max_support_rate, MIN(Consider_rate) AS min_consider_rate, MIN(Oppose_rate) AS min_oppose_rate FROM candidate;
return me all the organizations in Databases area .? Schema: - domain_author(...) - author(...) - domain(...) - organization(continent, homepage, name)
SELECT T2.name FROM domain_author AS T4 JOIN author AS T1 ON T4.aid = T1.aid JOIN domain AS T3 ON T3.did = T4.did JOIN organization AS T2 ON T2.oid = T1.oid WHERE T3.name = 'Databases';
What is the last name of the musicians who has played back position the most? Schema: - Performance(...) - Band(...)
SELECT T2.Lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id WHERE StagePosition = 'back' AND Lastname IS NOT NULL GROUP BY Lastname ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
How many products have a price higher than the average? Schema: - Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more))
SELECT COUNT(*) AS num_products FROM Products WHERE product_price > (SELECT AVG(product_price) FROM Products);
Show the name of aircrafts with top three lowest distances.? Schema: - aircraft(Description, aid, d, distance, name)
SELECT name FROM aircraft ORDER BY distance ASC NULLS LAST LIMIT 3;
Which vocal type did the musician with last name "Heilo" played in the song with title "Der Kapitan"? 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.Lastname = 'Heilo' AND T2.Title = 'Der Kapitan';
what is the shortest river? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT river_name FROM river WHERE LENGTH = (SELECT MIN(LENGTH) FROM river);
How many different store locations are there? Schema: - shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more))
SELECT COUNT(DISTINCT Location) AS num_locations FROM shop;
Show the names of pilots and the number of records they have.? Schema: - pilot_record(...) - pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team)
SELECT T2.Pilot_name, COUNT(*) AS num_records FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.Pilot_ID = T2.Pilot_ID GROUP BY T2.Pilot_name;
For each branch id, what are the names of the branches that were registered after 2015? Schema: - membership_register_branch(...) - branch(Address_road, City, Name, Open_year, membership_amount)
SELECT T2.Name, COUNT(*) AS num_branches FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.Branch_ID = T2.Branch_ID WHERE T1.Register_Year > 2015 GROUP BY T2.Branch_ID, T2.Name;
For each location, how many gas stations are there in order? Schema: - gas_station(COUNT, Location, Manager_Name, Open_Year, Station_ID)
SELECT Location, COUNT(*) AS num_gas_stations FROM gas_station WHERE Location IS NOT NULL GROUP BY Location ORDER BY num_gas_stations ASC NULLS LAST;
What is the average miles per gallon of all the cards with 4 cylinders? Schema: - cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
SELECT AVG(MPG) AS avg_miles_per_gallon FROM cars_data WHERE Cylinders = 4;
Report the first name and last name of all the teachers.? Schema: - teachers(Classroom, FirstName, LastName)
SELECT DISTINCT FirstName, LastName FROM teachers;
What are the ids and durations of the trips with the top 3 durations? Schema: - trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code)
SELECT id, duration FROM trip ORDER BY duration DESC NULLS LAST LIMIT 3;
What are the different statement ids on accounts, and the number of accounts for each? Schema: - Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
SELECT Statement_ID, COUNT(*) AS num_accounts FROM Accounts GROUP BY Statement_ID;
List the maximum scores of the team Boston Red Stockings when the team won in postseason? Schema: - postseason(ties) - team(Name)
SELECT MAX(T1.wins) AS max_wins FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings';
What are the salaries and manager ids for employees who have managers? 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 SALARY, MANAGER_ID FROM employees WHERE MANAGER_ID IS NOT NULL;
what river flows through illinois? Schema: - river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse)
SELECT river_name FROM river WHERE traverse = 'illinois';
Give the name of the highest paid instructor.? Schema: - instructor(AVG, M, So, Stat, dept_name, name, salary)
SELECT name FROM instructor ORDER BY salary DESC NULLS LAST LIMIT 1;
What are the ids, names and genders of the architects who built two bridges or one mill? Schema: - architect(gender, id, name, nationality) - bridge(Ra, length_feet, location, name) - mill(Moul, location, name, type)
SELECT DISTINCT id, name, gender FROM (SELECT T1.id, T1.name, T1.gender FROM architect AS T1 JOIN bridge AS T2 ON T1.id = CAST(T2.architect_id AS TEXT) GROUP BY T1.id, T1.name, T1.gender HAVING COUNT(*) = 2 UNION ALL SELECT T1.id, T1.name, T1.gender FROM architect AS T1 JOIN mill AS T2 ON T1.id = CAST(T2.architect_id AS TEXT) GROUP BY T1.id, T1.name, T1.gender HAVING COUNT(*) = 1);
Show all flight numbers with aircraft Airbus A340-300.? Schema: - flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) - aircraft(Description, aid, d, distance, name)
SELECT T1.flno FROM flight AS T1 JOIN aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = 'Airbus A340-300';
How many devices are there? Schema: - device(COUNT, Carrier, Software_Platform)
SELECT COUNT(*) AS num_devices FROM device;
Which district has the least area? Schema: - district(City_Area, City_Population, District_name, d)
SELECT District_name FROM district ORDER BY City_Area ASC NULLS LAST LIMIT 1;
What are the types of every competition and in which countries are they located? Schema: - competition(COUNT, Competition_type, Country, T1, Year)
SELECT Competition_type, Country FROM competition;
What is the id of every song that has a resolution higher than that of a song with a rating below 8? Schema: - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT f_id FROM song WHERE resolution > (SELECT MAX(resolution) FROM song WHERE rating < 8);
What is the code of the school where the accounting department belongs to? Schema: - DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE)
SELECT SCHOOL_CODE FROM DEPARTMENT WHERE DEPT_NAME = 'Accounting';
Show different teams of technicians and the number of technicians in each team.? Schema: - technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name)
SELECT Team, COUNT(*) AS num_technicians FROM technician GROUP BY Team;
Which regions speak Dutch or English? 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 DISTINCT T1.Region FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" = 'English' OR T2."Language" = 'Dutch';
what is capital of texas? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT capital FROM state WHERE state_name = 'texas';
Show names of musicals and the number of actors who have appeared in the musicals.? 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 T2.Name, COUNT(*) AS num_actors FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID, T2.Name;
What are the countries for appelations with at most 3 wines? Schema: - appellations(Area, County) - wine(Appelation, Cases, Grape, M, Name, Price, Score, Winery, Year, Z, w)
SELECT T1.County FROM appellations AS T1 JOIN wine AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation, T1.County HAVING COUNT(*) <= 3;
What are the dates that have an average sea level pressure between 30.3 and 31? 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" FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31;
List the name of technicians whose team is not "NYY".? Schema: - technician(Age, COUNT, JO, Start, Starting_Year, T1, Team, name)
SELECT name FROM technician WHERE Team != 'NYY';
Return the id of the staff whose Staff Department Assignment was earlier than that of any Clerical Staff.? Schema: - Staff_Department_Assignments(COUNT, date_assigned_to, department_id, job_title_code, staff_id)
SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to < (SELECT MAX(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code = 'Clerical Staff');
Show the hometowns shared by people older than 23 and younger than 20.? Schema: - people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more))
SELECT DISTINCT p1.Hometown FROM people p1 JOIN people p2 ON p1.Hometown = p2.Hometown WHERE p1.Age > 23 AND p2.Age < 20;
Which employees do not destroy any document? Find 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 Destroyed_by_Employee_ID FROM Documents_to_be_Destroyed);
What are the different template type codes, and how many templates correspond to each? Schema: - Templates(COUNT, M, Template_ID, Template_Type_Code, Version_Number)
SELECT Template_Type_Code, COUNT(*) AS num_templates FROM Templates GROUP BY Template_Type_Code;
Find all cities in which there is a restaurant called " MGM Grand Buffet "? Schema: - category(...) - business(business_id, city, full_address, name, rating, review_count, state)
SELECT T1.city FROM category AS T2 JOIN business AS T1 ON T2.business_id = T1.business_id WHERE T1.name = 'MGM Grand Buffet';
Show the number of customers.? 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 COUNT(*) AS num_customers FROM Customers;
What is the average number of working horses of farms with more than 5000 total number of horses? Schema: - farm(Cows, Working_Horses)
SELECT AVG(Working_Horses) AS avg_working_horses FROM farm WHERE Total_Horses > 5000;
List the names of clubs that do not have any players.? Schema: - club(Region, Start_year, name) - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more))
SELECT name FROM club WHERE Club_ID NOT IN (SELECT Club_ID FROM player);
Show the players and years played for players from team "Columbus Crew".? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) - team(Name)
SELECT T1.Player, T1.Years_Played FROM player AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = 'Columbus Crew';
Find the department name and room of the course INTRODUCTION TO COMPUTER SCIENCE.? Schema: - Course(CName, Credits, Days) - Department(Building, COUNT, DNO, DName, DPhone, DepartmentID, Division, FacID, Head, LName, Room, T2)
SELECT T2.DName, T2.Room FROM Course AS T1 JOIN Department AS T2 ON T1.DNO = T2.DNO WHERE T1.CName = 'INTRODUCTION TO COMPUTER SCIENCE';
Show the average and maximum damage for all storms with max speed higher than 1000.? Schema: - storm(Damage_millions_USD, Dates_active, Name, Number_Deaths)
SELECT AVG(Damage_millions_USD) AS avg_damage_millions_USD, MAX(Damage_millions_USD) AS max_damage_millions_USD FROM storm WHERE Max_speed > 1000;
which state has the biggest population? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT state_name FROM state WHERE population = (SELECT MAX(population) FROM state);
What are the first name and department name of all 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)) - departments(DEPARTMENT_NAME, Market)
SELECT T1.FIRST_NAME, T2.DEPARTMENT_NAME FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID;
Find the distinct names of all songs that have a higher resolution than some songs in English.? Schema: - song(COUNT, M, art, artist_name, engl, f_id, genre_is, languages, rat, rating, releasedate, resolution, ... (1 more))
SELECT DISTINCT song_name FROM song WHERE resolution > (SELECT MIN(resolution) FROM song WHERE languages = 'english');
Give the number of Jetblue Airways flights.? Schema: - flights(DestAirport, FlightNo, SourceAirport) - airlines(Abbreviation, Airline, COUNT, Country, active, country, name)
SELECT COUNT(*) AS num_flights FROM flights AS T1 JOIN airlines AS T2 ON T1.Airline = T2.uid WHERE T2.Airline = 'JetBlue Airways';
List the names and emails of customers who payed by Visa card.? 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_email, customer_name FROM Customers WHERE payment_method = 'Visa';
What are the countries of perpetrators? Show each country and the corresponding number of perpetrators there.? Schema: - perpetrator(Country, Date, Injured, Killed, Location, Year)
SELECT Country, COUNT(*) AS num_perpetrators FROM perpetrator GROUP BY Country;
What are the arriving date and the departing date of all the dogs? Schema: - Dogs(abandoned_yn, age, breed_code, date_arrived, date_departed, name, size_code, weight)
SELECT date_arrived, date_departed FROM Dogs;
What are the total number of students enrolled in ACCT-211? Schema: - CLASS(CLASS_CODE, CLASS_ROOM, CLASS_SECTION, CRS_CODE, PROF_NUM) - ENROLL(...)
SELECT COUNT(*) AS num_students FROM CLASS AS T1 JOIN ENROLL AS T2 ON T1.CLASS_CODE = T2.CLASS_CODE WHERE T1.CRS_CODE = 'ACCT-211';
Show all calendar dates and day Numbers.? Schema: - Ref_Calendar(Calendar_Date, Day_Number)
SELECT Calendar_Date, Day_Number FROM Ref_Calendar;
What are the dates and locations of performances? Schema: - performance(Attendance, COUNT, Date, Location, T1)
SELECT "Date", Location FROM performance;
What is the phone and email for customer with first name Aniyah and last name Feest? 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_phone, customer_email FROM Customers WHERE customer_first_name = 'Aniyah' AND customer_last_name = 'Feest';
Count the number of different ranks of captain.? Schema: - captain(COUNT, Class, INT, Name, Rank, TRY_CAST, age, capta, l)
SELECT COUNT(DISTINCT "Rank") AS num_ranks FROM captain;
What are the names of the channels owned by CCTV or HBS? Schema: - channel(Name, Owner, Rating_in_percent, Share_in_percent)
SELECT Name FROM channel WHERE Owner = 'CCTV' OR Owner = 'HBS';
Tell me the booking status code for the apartment with number "Suite 634".? Schema: - Apartment_Bookings(booking_end_date, booking_start_date, booking_status_code) - Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count)
SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_number = 'Suite 634';
What is the minimum, maximum, and average market value for every company? Schema: - company(Bank, COUNT, Company, Headquarters, Industry, JO, Main_Industry, Market_Value, Name, Profits_in_Billion, Rank, Retail, ... (4 more))
SELECT MIN(Market_Value) AS min_market_value, MAX(Market_Value) AS max_market_value, AVG(Market_Value) AS avg_market_value FROM company;
How many users are there? Schema: - user_profiles(email, followers, name, partitionid)
SELECT COUNT(*) AS num_users FROM user_profiles;
What are the different types of forms? Schema: - Forms(form_type_code)
SELECT DISTINCT form_type_code FROM Forms;
Show the name, location, and number of platforms for all stations.? Schema: - station(Annual_entry_exit, Annual_interchanges, COUNT, Location, MAX, Main_Services, Mounta, Name, Number_of_Platforms, city, id, lat, ... (4 more))
SELECT Name, Location, Number_of_Platforms FROM station;
Show the description and code of the attraction type most tourist attractions belong to.? Schema: - Ref_Attraction_Types(...) - Tourist_Attractions(Al, COUNT, How_to_Get_There, Name, Opening_Hours, Rosal, T1, T3, Tour, Tourist_Attraction_ID, Tourist_Details, Tourist_ID, ... (2 more))
SELECT T1.Attraction_Type_Description, T2.Attraction_Type_Code FROM Ref_Attraction_Types AS T1 JOIN Tourist_Attractions AS T2 ON T1.Attraction_Type_Code = T2.Attraction_Type_Code GROUP BY T2.Attraction_Type_Code, T1.Attraction_Type_Description ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1;
What is the full name and id of the customer who has the lowest total amount of payment? Schema: - customer(COUNT, T1, acc_bal, acc_type, active, check, credit_score, cust_name, no_of_loans, sav, state, store_id) - payment(amount, payment_date)
SELECT T1.first_name, T1.last_name, T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name, T1.customer_id ORDER BY SUM(amount) ASC NULLS LAST LIMIT 1;
Which 3 players won the most player awards? List their full name and id.? Schema: - player(Age, COUNT, Gender, Occupation, Player, Player_name, Po, Points, Position, Residence, Sponsor_name, T1, ... (12 more)) - player_award(...)
SELECT T1.name_first, T1.name_last, T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id GROUP BY T1.name_first, T1.name_last, T1.player_id ORDER BY COUNT(*) DESC NULLS LAST LIMIT 3;
where is a good restaurant on buchanan in san francisco for 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 = 'san francisco' AND T2.street_name = 'buchanan' AND T1.food_type = 'arabic' AND T1.rating > 2.5;
Find the id and name of customers whose address contains WY state and do not use credit card for payment.? 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_id, customer_name FROM Customers WHERE customer_address LIKE '%WY%' AND payment_method_code != 'Credit Card';
What are the sale details and dates of transactions with amount smaller than 3000? Schema: - Sales(...) - Transactions(COUNT, DOUBLE, TRY_CAST, amount_of_transaction, date_of_transaction, investor_id, share_count, transaction_id, transaction_type_code)
SELECT T1.sales_details, T2.date_of_transaction FROM Sales AS T1 JOIN Transactions AS T2 ON T1.sales_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction < 3000;
How many countries speak both English and Dutch? 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_countries FROM (SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2."Language" IN ('English', 'Dutch') GROUP BY T1.Name HAVING COUNT(DISTINCT T2."Language") = 2) AS t;
What are the countries for each market, ordered alphabetically? Schema: - market(Country, Number_cities)
SELECT Country FROM market ORDER BY Country ASC NULLS LAST;
Find all airlines that have flights from both airports 'APG' and 'CVO'.? Schema: - airlines(Abbreviation, Airline, COUNT, Country, active, country, name) - flights(DestAirport, FlightNo, SourceAirport)
SELECT T1.Airline FROM airlines AS T1 JOIN flights AS T2 ON T1.uid = T2.Airline WHERE T2.SourceAirport IN ('APG', 'CVO') GROUP BY T1.Airline HAVING COUNT(DISTINCT T2.SourceAirport) = 2;
What are the times used by climbers who climbed mountains in the country of Uganda? Schema: - climber(Country, K, Name, Points) - mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more))
SELECT T1."Time" FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T2.Country = 'Uganda';
For each county, find the name of the county and the number of delegates from that county.? Schema: - county(County_name, Population, Zip_code) - election(Committee, Date, Delegate, District, Vote_Percent, Votes)
SELECT T1.County_name, COUNT(*) AS num_delegates FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District GROUP BY T1.County_Id, T1.County_name;
What is the latest paper by oren etzioni ? Schema: - writes(...) - author(...) - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT T2.paperId FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN paper AS T3 ON T2.paperId = T3.paperId WHERE T1.authorName = 'oren etzioni' GROUP BY T2.paperId, T3."year" ORDER BY T3."year" DESC NULLS LAST;
what is the biggest state in continental us? Schema: - state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
SELECT state_name FROM state WHERE area = (SELECT MAX(area) FROM state);
What is the product, chromosome, and porphyria of the enzymes located at 'Cytosol'? Schema: - enzyme(Chromosome, Location, OMIM, Porphyria, Product, name)
SELECT Product, Chromosome, Porphyria FROM enzyme WHERE Location = 'Cytosol';
When did Peter Mertens and Dina Barbian collaborate ? Schema: - writes(...) - author(...)
SELECT DISTINCT T3.paperId FROM writes AS T3 JOIN author AS T2 ON T3.authorId = T2.authorId JOIN writes AS T4 ON T4.paperId = T3.paperId JOIN author AS T1 ON T4.authorId = T1.authorId WHERE T2.authorName = 'Peter Mertens' AND T1.authorName = 'Dina Barbian';
Find the movies with the highest average rating. Return the movie titles and average rating.? Schema: - Rating(Rat, mID, rID, stars) - Movie(T1, director, title, year)
SELECT T2.title, AVG(T1.stars) AS avg_rating FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID, T2.title ORDER BY avg_rating DESC NULLS LAST LIMIT 1;
Give the average life expectancy for countries in Africa which are republics? Schema: - country(Capital, Continent, Country_name, Engl, GNP, GovernmentForm, HeadOfState, IndepYear, LifeExpectancy, M, Name, Official_native_language, ... (4 more))
SELECT AVG(LifeExpectancy) AS avg_life_expectancy FROM country WHERE Continent = 'Africa' AND GovernmentForm = 'Republic';
How many colleges in total? Schema: - College(M, cName, enr, state)
SELECT COUNT(*) AS num_colleges FROM College;
How many medications are prescribed for each brand? Schema: - Medication(Name) - Prescribes(...)
SELECT COUNT(*) AS num_medications, T1.Name FROM Medication AS T1 JOIN Prescribes AS T2 ON T1.Code = T2.Medication GROUP BY T1.Brand, T1.Name;
What is the sum of hours for projects that scientists with the name Michael Rogers or Carol Smith are assigned to? Schema: - AssignedTo(Scientist) - Projects(COUNT, Hours, Name, Project_Details, Project_ID, organ, organisation_id, project_details) - Scientists(Name)
SELECT SUM(T2.Hours) AS total_hours FROM AssignedTo AS T1 JOIN Projects AS T2 ON T1.Project = T2.Code JOIN Scientists AS T3 ON T1.Scientist = T3.SSN WHERE T3.Name = 'Michael Rogers' OR T3.Name = 'Carol Smith';
In the year 2000, what is the campus fee for San Francisco State University? Schema: - csu_fees(CampusFee) - Campuses(Campus, County, Franc, Location)
SELECT T1.CampusFee FROM csu_fees AS T1 JOIN Campuses AS T2 ON T1.Campus = T2.Id WHERE T2.Campus = 'San Francisco State University' AND T1."Year" = 2000;
Give me the start station and end station for the trips with the three oldest id.? Schema: - trip(COUNT, bike_id, duration, end_station_name, id, start_date, start_station_id, start_station_name, zip_code)
SELECT start_station_name, end_station_name FROM trip ORDER BY id ASC NULLS LAST LIMIT 3;
papers from 2014? Schema: - paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
SELECT DISTINCT paperId FROM paper WHERE "year" = 2014;
What is the name of the singer with the largest net worth? Schema: - singer(Age, Birth_Year, COUNT, Citizenship, Country, Name, Net_Worth_Millions, Song_Name, Song_release_year, T1, s)
SELECT Name FROM singer ORDER BY Net_Worth_Millions DESC NULLS LAST LIMIT 1;
How many assets does each maintenance contract contain? List the number and the contract id.? Schema: - Maintenance_Contracts(...) - Assets(asset_acquired_date, asset_details, asset_disposed_date, asset_id, asset_make, asset_model)
SELECT COUNT(*) AS num_assets, T1.maintenance_contract_id FROM Maintenance_Contracts AS T1 JOIN Assets AS T2 ON T1.maintenance_contract_id = T2.maintenance_contract_id GROUP BY T1.maintenance_contract_id;