question stringlengths 43 589 | query stringlengths 19 598 |
|---|---|
which state has the highest peak in the country?
Schema:
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more)) | SELECT state_name FROM mountain WHERE mountain_altitude = (SELECT MAX(mountain_altitude) FROM mountain); |
Find the latest logon date of the students whose family name is "Jaskolski" or "Langosh".?
Schema:
- Students(cell_mobile_number, current_address_id, date_first_registered, date_left, date_of_latest_logon, email_address, family_name, first_name, last_name, login_name, middle_name, other_student_details, ... (1 more)) | SELECT date_of_latest_logon FROM Students WHERE family_name = 'Jaskolski' OR family_name = 'Langosh'; |
How many students does one classroom have?
Schema:
- list(COUNT, Classroom, FirstName, Grade, LastName) | SELECT COUNT(*) AS num_students, Classroom FROM list GROUP BY Classroom; |
How many assessment notes are there in total?
Schema:
- Assessment_Notes(date_of_notes) | SELECT COUNT(*) AS num_notes FROM Assessment_Notes; |
How many different kinds of information sources are there for injury accidents?
Schema:
- injury_accident(Source) | SELECT COUNT(DISTINCT Source) AS num_sources FROM injury_accident; |
What is the first and last name of artist who performed "Le Pop"?
Schema:
- Performance(...)
- Band(...)
- Songs(Title) | SELECT T2.Firstname, T2.Lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.Bandmate = T2.Id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = 'Le Pop'; |
What are names of patients who made an appointment?
Schema:
- Appointment(AppointmentID, Start)
- Patient(...) | SELECT Name FROM Appointment AS T1 JOIN Patient AS T2 ON T1.Patient = T2.SSN; |
What are the vocal types used in song "Le Pop"?
Schema:
- Vocals(COUNT, Type)
- Songs(Title) | SELECT Type FROM Vocals AS T1 JOIN Songs AS T2 ON T1.SongId = T2.SongId WHERE Title = 'Le Pop'; |
Show all product colors.?
Schema:
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT DISTINCT product_color FROM Products; |
Find the names of customers who never ordered product Latte.?
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_Orders(customer_id, order_date, order_id, order_shipping_charges)
- Order_Items(COUNT, DOUBLE, INT, TRY_CAST, order_id, order_item_id, order_quantity, product_id, product_quantity)
- Products(COUNT, Code, Din, Manufacturer, Name, Price, Product_Name, Product_Price, Product_Type_Code, T1, Trad, cum, ... (11 more)) | SELECT customer_name FROM Customers WHERE customer_name NOT IN (SELECT T1.customer_name FROM Customers AS T1 JOIN Customer_Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_Items AS T3 ON T2.order_id = T3.order_id JOIN Products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_details = 'Latte'); |
What years did Pedro Domingos publish papers in ?
Schema:
- writes(...)
- author(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year) | SELECT DISTINCT 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 = 'Pedro Domingos' GROUP BY T3."year"; |
What is the name of the department with the most credits?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title) | SELECT dept_name FROM course WHERE dept_name IS NOT NULL GROUP BY dept_name ORDER BY SUM(credits) DESC NULLS LAST LIMIT 1; |
What are the names of all races held after 2000 in Spain?
Schema:
- races(date, name)
- circuits(circuitId, country, location, name) | SELECT DISTINCT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitId = T2.circuitId WHERE T2.country = 'Spain' AND T1."year" > 2000; |
How many times does ROY SWEAZY has reserved a room.?
Schema:
- Reservations(Adults, CheckIn, FirstName, Kids, LastName) | SELECT COUNT(*) AS num_reservations FROM Reservations WHERE FirstName = 'ROY' AND LastName = 'SWEAZY'; |
How many papers related to deep reinforcement learning in nips ?
Schema:
- paperKeyphrase(...)
- keyphrase(...)
- paper(For, Switch, journalId, juic, learn, mach, paperId, title, venueId, year)
- venue(venueId, venueName) | SELECT DISTINCT COUNT(T3.paperId) AS num_papers FROM paperKeyphrase AS T2 JOIN keyphrase AS T1 ON T2.keyphraseId = T1.keyphraseId JOIN paper AS T3 ON T3.paperId = T2.paperId JOIN venue AS T4 ON T4.venueId = T3.venueId WHERE T1.keyphraseName = 'deep reinforcement learning' AND T4.venueName = 'nips'; |
find the total checkins in Moroccan restaurant in " Los Angeles " on Friday?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state)
- checkin(...) | SELECT SUM(T4."count") AS total_checkins 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 JOIN checkin AS T4 ON T4.business_id = T1.business_id WHERE T1.city = 'Los Angeles' AND T2.category_name = 'Moroccan' AND T3.category_name = 'restaurant' AND T4."day" = 'Friday'; |
Which range contains the most mountains?
Schema:
- mountain(AVG, COUNT, Country, Height, JO, Name, Prominence, Range, T1, mck, mounta, mountain_altitude, ... (3 more)) | SELECT "Range" FROM mountain GROUP BY "Range" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
what state has the largest 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); |
In how many different cities are banks located?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state) | SELECT COUNT(DISTINCT city) AS num_cities FROM bank; |
return me the keywords, which have been contained by more than 100 papers 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 T1.keyword 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' GROUP BY T1.keyword HAVING COUNT(DISTINCT T2.title) > 100; |
Show the attendances of the performances at location "TD Garden" or "Bell Centre"?
Schema:
- performance(Attendance, COUNT, Date, Location, T1) | SELECT Attendance FROM performance WHERE Location = 'TD Garden' OR Location = 'Bell Centre'; |
Return the number of routes with destination airport in Italy operated by the airline with name 'American Airlines'.?
Schema:
- routes(...)
- airports(AirportCode, AirportName, Argent, COUNT, City, Country, city, country, elevation, name)
- airlines(Abbreviation, Airline, COUNT, Country, active, country, name) | SELECT COUNT(*) AS num_routes FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid JOIN airlines AS T3 ON T1.alid = T3.alid WHERE T2.country = 'Italy' AND T3.name = 'American Airlines'; |
Please show the police forces and the number of counties with each police force.?
Schema:
- county_public_safety(COUNT, Case_burden, Crime_rate, Location, Name, Police_force, Police_officers, Population, T1) | SELECT Police_force, COUNT(*) AS num_counties FROM county_public_safety GROUP BY Police_force; |
Show the account id and the number of transactions for each account?
Schema:
- Financial_Transactions(COUNT, F, SUM, account_id, invoice_number, transaction_amount, transaction_id, transaction_type) | SELECT account_id, COUNT(*) AS num_transactions FROM Financial_Transactions GROUP BY account_id; |
Count the number of credit cards that the customer with first name Blanche and last name Huels has.?
Schema:
- Customers_Cards(COUNT, card_id, card_number, card_type_code, customer_id, date_valid_from, date_valid_to)
- 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_credit_cards FROM Customers_Cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Blanche' AND T2.customer_last_name = 'Huels' AND T1.card_type_code = 'Credit'; |
Show the id and salary of 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'; |
What are the type codes and descriptions of each budget type?
Schema:
- Ref_Budget_Codes(Budget_Type_Code, Budget_Type_Description) | SELECT Budget_Type_Code, Budget_Type_Description FROM Ref_Budget_Codes; |
List the name of the county with the largest population.?
Schema:
- county_public_safety(COUNT, Case_burden, Crime_rate, Location, Name, Police_force, Police_officers, Population, T1) | SELECT Name FROM county_public_safety ORDER BY Population DESC NULLS LAST LIMIT 1; |
Find the name of customers who are living in Colorado?
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 T1.customer_name 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.state_province_county = 'Colorado'; |
What is the name of the instructor who advises the student with the greatest number of total credits?
Schema:
- advisor(s_ID)
- instructor(AVG, M, So, Stat, dept_name, name, salary)
- student(COUNT, H, dept_name, name, tot_cred) | SELECT T2.name FROM advisor AS T1 JOIN instructor AS T2 ON T1.i_ID = T2.ID JOIN student AS T3 ON T1.s_ID = T3.ID ORDER BY T3.tot_cred DESC NULLS LAST LIMIT 1; |
What are the countries that participated in both friendly and tournament type competitions?
Schema:
- competition(COUNT, Competition_type, Country, T1, Year) | SELECT DISTINCT T1.Country FROM competition AS T1 JOIN competition AS T2 ON T1.Country = T2.Country WHERE T1.Competition_type = 'Friendly' AND T2.Competition_type = 'Tournament'; |
Show the number of locations.?
Schema:
- Ref_Locations(Location_Code, Location_Description, Location_Name) | SELECT COUNT(*) AS num_locations FROM Ref_Locations; |
what are the populations of the states through which the mississippi runs?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom)
- river(COUNT, DIST, LENGTH, M, country_name, illino, m, river_name, traverse) | SELECT population FROM state WHERE state_name IN (SELECT traverse FROM river WHERE river_name = 'mississippi'); |
Find the first names of teachers whose email address contains the word "man".?
Schema:
- Teachers(email_address, first_name, gender, last_name) | SELECT first_name FROM Teachers WHERE email_address LIKE '%man%'; |
What are the the full names and ids for all customers, and how many accounts does each have?
Schema:
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details)
- 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 T1.customer_id, T2.customer_first_name, T2.customer_last_name, COUNT(*) AS num_accounts FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id, T2.customer_first_name, T2.customer_last_name; |
Find the name of rooms booked by some customers whose first name contains ROY.?
Schema:
- Reservations(Adults, CheckIn, FirstName, Kids, LastName)
- Rooms(K, RoomId, basePrice, bedType, beds, decor, maxOccupancy, roomName) | SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE FirstName LIKE '%ROY%'; |
find the total checkins in Moroccan restaurant in " Los Angeles " per day?
Schema:
- category(...)
- business(business_id, city, full_address, name, rating, review_count, state)
- checkin(...) | SELECT T4."day", SUM(T4."count") AS num_checkins 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 JOIN checkin AS T4 ON T4.business_id = T1.business_id WHERE T1.city = 'Los Angeles' AND T2.category_name = 'Moroccan' AND T3.category_name = 'restaurant' GROUP BY T4."day"; |
List names of all pilot aged 30 or younger in descending alphabetical order.?
Schema:
- pilot(Age, COUNT, Join_Year, Name, Nationality, Pilot_name, Position, Rank, Team) | SELECT Name FROM pilot WHERE Age <= 30 ORDER BY Name DESC NULLS LAST; |
What is the id of the reviewer whose name includes the word "Mike"?
Schema:
- Reviewer(Lew, name, rID) | SELECT rID FROM Reviewer WHERE name LIKE '%Mike%'; |
what state has the largest capital?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more))
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT state_name FROM city WHERE population = (SELECT MAX(T1.population) FROM state AS T2 JOIN city AS T1 ON T2.capital = T1.city_name); |
List the year in which there are more than one festivals.?
Schema:
- festival_detail(Chair_Name, Festival_Name, Location, T1, Year) | SELECT "Year" FROM festival_detail GROUP BY "Year" HAVING COUNT(*) > 1; |
Which authors have last name "Ueno"? List their first names.?
Schema:
- Authors(fname, lname) | SELECT fname FROM Authors WHERE lname = 'Ueno'; |
What are the names of the different bank branches, and what are their total loan amounts?
Schema:
- bank(SUM, bname, city, morn, no_of_customers, state)
- loan(...) | SELECT SUM(amount) AS total_loan_amount, T1.bname FROM bank AS T1 JOIN loan AS T2 ON CAST(T1.branch_ID AS TEXT) = T2.branch_ID GROUP BY T1.bname; |
Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300.?
Schema:
- employee(Address, Age, Bdate, City, Fname, Lname, Name, Salary, Sex, eid, name, salary)
- certificate(eid)
- aircraft(Description, aid, d, distance, name) | SELECT DISTINCT T4.name FROM (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') T4, (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 = 'Airbus A340-300') AS T5 WHERE T4.name = T5.name; |
Show the names of editors of age either 24 or 25.?
Schema:
- editor(Age, COUNT, Name) | SELECT Name FROM editor WHERE Age = 24 OR Age = 25; |
What are the ids and last names of all drivers who participated in the most 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; |
count the states which have elevations lower than what alabama has?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name) | SELECT COUNT(state_name) AS num_states FROM highlow WHERE lowest_elevation < (SELECT lowest_elevation FROM highlow WHERE state_name = 'alabama'); |
Which student visited restaurant most often? List student's first name and last name.?
Schema:
- Student(Advisor, Age, COUNT, Fname, L, LName, M, Major, Sex, StuID, city_code, oldest_age)
- Visits_Restaurant(ResID, StuID) | SELECT Student.Fname, Student.LName FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID GROUP BY Student.StuID, Student.Fname, Student.LName ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What is the name of the person whose age is below 30?
Schema:
- Person(M, age, city, eng, gender, job, name) | SELECT name FROM Person WHERE age < 30; |
what is the highest point in the smallest state?
Schema:
- highlow(M, highest_elevation, highest_point, lowest_elevation, lowest_point, state_name)
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT T2.highest_point FROM highlow AS T2 JOIN state AS T1 ON T1.state_name = T2.state_name WHERE T1.area = (SELECT MIN(area) FROM state); |
How many gymnasts are from each hometown?
Schema:
- gymnast(Floor_Exercise_Points, Horizontal_Bar_Points)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T2.Hometown, COUNT(*) AS num_gymnasts FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown; |
List all media types.?
Schema:
- media_types(name) | SELECT name FROM media_types; |
return me the number of papers 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) | SELECT COUNT(DISTINCT T4.title) AS num_papers FROM organization AS T2 JOIN author AS T1 ON T2.oid = T1.oid JOIN writes AS T3 ON T3.aid = T1.aid JOIN publication AS T4 ON T3.pid = T4.pid WHERE T2.name = 'University of Michigan'; |
What are the manager name and district of the shop that sells the largest number of products?
Schema:
- shop(Address, District, INT, Location, Manager_name, Name, Number_products, Open_Year, Score, Shop_ID, Shop_Name, T1, ... (1 more)) | SELECT Manager_name, District FROM shop ORDER BY Number_products DESC NULLS LAST LIMIT 1; |
Find the first name and office of the professor who is in the history department and has a Ph.D. degree.?
Schema:
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME)
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT T1.EMP_FNAME, T2.PROF_OFFICE FROM EMPLOYEE AS T1 JOIN PROFESSOR AS T2 ON T1.EMP_NUM = T2.EMP_NUM JOIN DEPARTMENT AS T3 ON T3.DEPT_CODE = T2.DEPT_CODE WHERE T3.DEPT_NAME = 'History' AND T2.PROF_HIGH_DEGREE = 'Ph.D.'; |
How many high schoolers are there in grade 9 or 10?
Schema:
- Highschooler(COUNT, ID, grade, name) | SELECT COUNT(*) AS num_highschoolers FROM Highschooler WHERE grade = 9 OR grade = 10; |
Which apartment type code is the most common among apartments with more than one bathroom?
Schema:
- Apartments(AVG, COUNT, INT, SUM, TRY_CAST, apt_number, apt_type_code, bathroom_count, bedroom_count, room_count) | SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 AND apt_type_code IS NOT NULL GROUP BY apt_type_code ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the titles of all the albums alphabetically ascending?
Schema:
- albums(I, title) | SELECT title FROM albums ORDER BY title ASC NULLS LAST; |
For grants that have descriptions of Regular and Initial Applications, what are their start dates?
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))
- Document_Types(document_description, document_type_code) | SELECT T1.grant_start_date FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id JOIN Document_Types AS T3 ON T2.document_type_code = T3.document_type_code WHERE T3.document_description = 'Regular' AND T1.grant_start_date IN (SELECT T1.grant_start_date FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id JOIN Document_Types AS T3 ON T2.document_type_code = T3.document_type_code WHERE T3.document_description = 'Initial Application'); |
How many students have a food allergy?
Schema:
- Has_Allergy(Allergy, COUNT, StuID)
- Allergy_Type(Allergy, AllergyType, COUNT) | SELECT COUNT(*) AS num_students FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = 'food'; |
How many customers don't have an account?
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))
- Accounts(Account_Details, Account_ID, Statement_ID, account_id, account_name, customer_id, date_account_opened, other_account_details) | SELECT COUNT(*) AS num_customers FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Accounts); |
what is the size of 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'; |
List the medicine name and trade name which can both interact as 'inhibitor' and 'activitor' with enzymes.?
Schema:
- medicine(FDA_approved, Trade_Name, name)
- medicine_enzyme_interaction(interaction_type) | SELECT DISTINCT T1.name, T1.Trade_Name FROM (SELECT T1.name, T1.Trade_Name, T1.id FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE T2.interaction_type = 'inhibitor') AS T1 JOIN (SELECT T1.name, T1.Trade_Name, T1.id FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE T2.interaction_type = 'activitor') AS T2 ON T1.name = T2.name AND T1.Trade_Name = T2.Trade_Name AND T1.id = T2.id; |
How many railways are there?
Schema:
- railway(Builder, COUNT, Location) | SELECT COUNT(*) AS num_railways FROM railway; |
Which customers have both "On Road" and "Shipped" as order status? List 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))
- Orders(customer_id, date_order_placed, order_id) | SELECT DISTINCT T1.customer_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Orders AS T3 ON T1.customer_id = T3.customer_id WHERE (T2.order_status = 'On Road' AND T3.order_status = 'Shipped'); |
how many papers has Mirella Lapata cited ?
Schema:
- writes(...)
- author(...)
- cite(...) | SELECT DISTINCT COUNT(T3.citedPaperId) AS num_papers FROM writes AS T2 JOIN author AS T1 ON T2.authorId = T1.authorId JOIN cite AS T3 ON T2.paperId = T3.citingPaperId WHERE T1.authorName = 'Mirella Lapata'; |
What are the names of companies with revenue less than the lowest revenue of any manufacturer in Austin?
Schema:
- Manufacturers(Aust, Beij, Founder, Headquarter, I, M, Name, Revenue) | SELECT Name FROM Manufacturers WHERE Revenue < (SELECT MIN(Revenue) FROM Manufacturers WHERE Headquarter = 'Austin'); |
how many people are there in california?
Schema:
- state(M, area, aust, capital, country_name, density, population, population_per_square_km, rhode, state_name, wyom) | SELECT population FROM state WHERE state_name = 'california'; |
Find the id of the courses that do not have any prerequisite?
Schema:
- course(COUNT, JO, SUM, Stat, T1, course_id, credits, dept_name, title)
- prereq(...) | SELECT course_id FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq); |
How many professionals did not operate any treatment on dogs?
Schema:
- Professionals(Wiscons, cell_number, city, email_address, home_phone, role_code, state, street)
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT COUNT(*) AS num_professionals FROM Professionals WHERE professional_id NOT IN (SELECT professional_id FROM Treatments); |
What are the first names and offices of history professors who don't have Ph.D.s?
Schema:
- PROFESSOR(DEPT_CODE, PROF_HIGH_DEGREE)
- EMPLOYEE(EMP_DOB, EMP_FNAME, EMP_JOBCODE, EMP_LNAME)
- DEPARTMENT(Account, DEPT_ADDRESS, DEPT_NAME, H, SCHOOL_CODE) | SELECT T2.EMP_FNAME, T1.PROF_OFFICE FROM PROFESSOR AS T1 JOIN EMPLOYEE AS T2 ON T1.EMP_NUM = T2.EMP_NUM JOIN DEPARTMENT AS T3 ON T1.DEPT_CODE = T3.DEPT_CODE WHERE T3.DEPT_NAME = 'History' AND T1.PROF_HIGH_DEGREE != 'Ph.D.'; |
Which problem id and log id are assigned to the staff named Rylan Homenick?
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)
- Problem_Log(log_entry_date, log_entry_description, problem_id, problem_log_id) | SELECT DISTINCT T2.problem_id, T2.problem_log_id FROM Staff AS T1 JOIN Problem_Log AS T2 ON T1.staff_id = T2.assigned_to_staff_id WHERE T1.staff_first_name = 'Rylan' AND T1.staff_last_name = 'Homenick'; |
What airline serves the most flights?
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 GROUP BY T1.Airline ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the names of all schools that have students trying out for the position of goal and 'mid'-field.?
Schema:
- Tryout(COUNT, EX, T1, cName, decision, pPos) | SELECT DISTINCT T1.cName FROM Tryout AS T1 WHERE EXISTS (SELECT 1 FROM Tryout AS T2 WHERE T1.cName = T2.cName AND T2.pPos = 'goalie') AND EXISTS (SELECT 1 FROM Tryout AS T3 WHERE T1.cName = T3.cName AND T3.pPos = 'mid'); |
What are the different models wthat are lighter than 3500 but were not built by the Ford Motor Company?
Schema:
- model_list(Maker, Model)
- car_names(COUNT, Model)
- cars_data(Accelerate, Cylinders, Horsepower, MPG, T1, Weight, Year)
- car_makers(...) | SELECT DISTINCT T1.Model FROM model_list AS T1 JOIN car_names AS T2 ON T1.Model = T2.Model JOIN cars_data AS T3 ON T2.MakeId = T3.Id JOIN car_makers AS T4 ON T1.Maker = T4.Id WHERE T3.Weight < 3500 AND T4.FullName != 'Ford Motor Company'; |
How many products have prices of at least 180?
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 Price >= 180; |
List the hardware model name for the phones that have screen mode type "Text" or RAM size greater than 32.?
Schema:
- chip_model(Launch_year, Model_name, RAM_MiB, WiFi)
- phone(Accreditation_level, Accreditation_type, COUNT, Carrier, Company_name, Hardware_Model_name, Memory_in_G, Name, Spr, chip_model, p1, screen_mode)
- screen_mode(used_kb) | SELECT T2.Hardware_Model_name FROM chip_model AS T1 JOIN phone AS T2 ON T1.Model_name = T2.chip_model JOIN screen_mode AS T3 ON T2.screen_mode = T3.Graphics_mode WHERE T3.Type = 'Text' OR T1.RAM_MiB > 32; |
What are the product id and product type 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 product_id, product_type_code FROM Products ORDER BY product_price ASC NULLS LAST LIMIT 1; |
Of all the claims, what was the earliest date when any claim was made?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled) | SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC NULLS LAST LIMIT 1; |
What is the zip code the county named "Howard" is located in?
Schema:
- county(County_name, Population, Zip_code) | SELECT Zip_code FROM county WHERE County_name = 'Howard'; |
What are the names , themes , and number of singers for every concert ?
Schema:
- singer_in_concert(...)
- concert(COUNT, Year) | SELECT T2.concert_Name, T2.Theme, COUNT(*) AS num_singers FROM singer_in_concert AS T1 JOIN concert AS T2 ON T1.concert_ID = T2.concert_ID GROUP BY T2.concert_ID, T2.concert_Name, T2.Theme; |
what are the populations of the major cities of wisconsin?
Schema:
- city(COUNT, City, District, GDP, M, Name, Official_Name, Population, Regional_Population, SUM, Status, T1, ... (10 more)) | SELECT population FROM city WHERE population > 150000 AND state_name = 'wisconsin'; |
What is the total count of enzymes?
Schema:
- enzyme(Chromosome, Location, OMIM, Porphyria, Product, name) | SELECT COUNT(*) AS num_enzymes FROM enzyme; |
What are all the course names of the courses which ever have students enrolled in?
Schema:
- Courses(course_description, course_name)
- Student_Enrolment_Courses(...) | SELECT DISTINCT T1.course_name FROM Courses AS T1 JOIN Student_Enrolment_Courses AS T2 ON T1.course_id = T2.course_id; |
What is the average price for flights from LA to Honolulu?
Schema:
- flight(Altitude, COUNT, Date, Pilot, Vehicle_Flight_number, Velocity, arrival_date, departure_date, destination, distance, flno, origin, ... (1 more)) | SELECT AVG(price) AS avg_price FROM flight WHERE origin = 'Los Angeles' AND destination = 'Honolulu'; |
What are the emails of employees with null commission, salary between 7000 and 12000, and who work in department 50?
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 EMAIL FROM employees WHERE COMMISSION_PCT IS NULL AND SALARY BETWEEN 7000 AND 12000 AND DEPARTMENT_ID = 50; |
What are the names of the teachers ordered by ascending age?
Schema:
- teacher(Age, COUNT, D, Hometown, Name) | SELECT Name FROM teacher ORDER BY Age ASC NULLS LAST; |
Which claims had exactly one settlement? For each, tell me the the date the claim was made, the date it was settled and the amount settled.?
Schema:
- Claims(Amount_Claimed, Amount_Settled, Date_Claim_Made, Date_Claim_Settled)
- Settlements(Amount_Settled, Date_Claim_Made, Date_Claim_Settled, Settlement_Amount) | SELECT T1.Claim_ID, T1.Date_Claim_Made, T1.Date_Claim_Settled FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_ID = T2.Claim_ID GROUP BY T1.Claim_ID, T1.Date_Claim_Made, T1.Date_Claim_Settled HAVING COUNT(*) = 1; |
Show me the cost of the most recently performed treatment.?
Schema:
- Treatments(cost_of_treatment, date_of_treatment, dog_id, professional_id) | SELECT cost_of_treatment FROM Treatments ORDER BY date_of_treatment DESC NULLS LAST LIMIT 1; |
Show all home cities except for those having a driver older than 40.?
Schema:
- driver(Age, Home_city, Name, Party) | SELECT DISTINCT Home_city FROM driver WHERE Home_city NOT IN (SELECT Home_city FROM driver WHERE Age > 40); |
What are the names of body builders in descending order of total scores?
Schema:
- body_builder(Clean_Jerk, Snatch, Total)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Total DESC NULLS LAST; |
Return the names of entrepreneurs.?
Schema:
- entrepreneur(COUNT, Company, Investor, Money_Requested)
- people(Age, Birth_Date, Birth_Place, COUNT, Country, Date_of_Birth, Height, Hometown, Is_Male, Name, Nationality, Party, ... (3 more)) | SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID; |
How many clubs are there?
Schema:
- Club(ClubDesc, ClubLocation, ClubName, Enterpr, Gam, Hopk, Tenn) | SELECT COUNT(*) AS num_clubs FROM Club; |
What are the names of people in ascending alphabetical order?
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 ORDER BY Name ASC NULLS LAST; |
Find the id of the product ordered the most often on invoices.?
Schema:
- Invoices(COUNT, DOUBLE, Order_Quantity, Product_ID, TRY_CAST, invoice_date, invoice_details, invoice_number, order_id, payment_method_code) | SELECT Product_ID FROM Invoices WHERE Product_ID IS NOT NULL GROUP BY Product_ID ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1; |
What are the ids of students who registered for the least number of courses (but registered for at least one course)?
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; |
Which shipping agent shipped the most documents? List the shipping agent name and the number of documents.?
Schema:
- Ref_Shipping_Agents(shipping_agent_code, shipping_agent_name)
- 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 Ref_Shipping_Agents.shipping_agent_name, COUNT(Documents.document_id) AS num_documents FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code GROUP BY Ref_Shipping_Agents.shipping_agent_code, Ref_Shipping_Agents.shipping_agent_name ORDER BY num_documents DESC NULLS LAST LIMIT 1; |
Find the names and opening hours of the tourist attractions that we get to by bus or walk.?
Schema:
- 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 Name, Opening_Hours FROM Tourist_Attractions WHERE How_to_Get_There = 'bus' OR How_to_Get_There = 'walk'; |
List the names of orchestras that have no performance.?
Schema:
- orchestra(COUNT, Major_Record_Format, Record_Company, Year_of_Founded)
- performance(Attendance, COUNT, Date, Location, T1) | SELECT Orchestra FROM orchestra WHERE Orchestra_ID NOT IN (SELECT Orchestra_ID FROM performance); |
what is the state with the smallest area?
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 MIN(area) FROM state); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.