text2SQL
stringlengths
192
7.27k
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the states which have between 2 to 4 staffs living there.### Response: SELECT T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which countries has the most number of airlines whose active status is 'Y'?### Response: SELECT country FROM airlines WHERE active = 'Y' GROUP BY country ORDER BY count(*) DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the name of tracks belongs to genre Rock or media type is MPEG audio file.### Response: SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of items whose rank is higher than 3 and whose average rating is above 5.### Response: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rank > 3...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'?### Response: SELECT T1.name , T1.num_employees FROM department AS T1 JOIN manag...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the id and detail of the vehicle used in lessons for most of the times?### Response: SELECT T1.vehicle_id , T1.vehicle_details FROM Vehicles AS T1 JOIN Lessons AS T2 ON T1.vehicle_id =...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which institution does "Katsuhiro Ueno" belong to?### Response: SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.in...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of department that offers the class whose description has the word "Statistics".### Response: SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dep...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: For each station, find its latitude and the minimum duration of trips that ended at the station.### Response: SELECT T1.name , T1.lat , min(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which services type had both successful and failure event details?### Response: SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id = T2.service_id WHERE T2.even...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the email of the student with first name "Emma" and last name "Rohan"?### Response: SELECT email_address FROM Students WHERE first_name = "Emma" AND last_name = "Rohan".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which engineer has visited the most times? Show the engineer id, first name and last name.### Response: SELECT T1.engineer_id , T1.first_name , T1.last_name FROM Maintenance_Engineers AS T1 JO...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the id of users who are followed by Mary and Susan.### Response: SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = "Mary" INTERSECT SELECT T2.f1...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many customers have email that contains "gmail.com"?### Response: SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE "%gmail.com%".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the most common hometown of gymnasts?### Response: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown ORDER BY COUNT(*) DESC L...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which position is most popular among players in the tryout?### Response: SELECT pPos FROM tryout GROUP BY pPos ORDER BY count(*) DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of the organization that has published the largest number of papers.### Response: SELECT t1.name FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name, city, and country of the airport that has the lowest altitude.### Response: SELECT name , city , country FROM airports ORDER BY elevation LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the hometowns of gymnasts and the corresponding number of gymnasts?### Response: SELECT T2.Hometown , COUNT(*) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GR...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Display the first and last name, and salary for those employees whose first name is ending with the letter m.### Response: SELECT first_name , last_name , salary FROM employees WHERE first_nam...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many students are not involved in any behavior incident?### Response: SELECT count(*) FROM STUDENTS WHERE student_id NOT IN ( SELECT student_id FROM Behavior_Incident ).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'?### Response: SELECT T1.name , T1.num_employees FROM department AS T1 JOIN manag...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the titles of all movies that have no ratings.### Response: SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the first names of faculties of rank Professor in alphabetic order.### Response: SELECT Fname FROM FACULTY WHERE Rank = "Professor" ORDER BY Fname.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find names of all students who took some course and the course description.### Response: SELECT T1.stu_fname , T1.stu_lname , T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which city does has most number of customers?### Response: SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY count(*) D...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are names of the movies that are either made after 2000 or reviewed by Brittany Harris?### Response: SELECT DISTINCT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Re...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the state of the college which player Charles is attending.### Response: SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName JOIN player AS T3 ON T2.pID = T3.pID...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the names of editors that are on the committee of journals with sales bigger than 3000.### Response: SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Edi...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the names of counties that do not have any cities.### Response: SELECT Name FROM county_public_safety WHERE County_ID NOT IN (SELECT County_ID FROM city).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the papers published under the institution "Indiana University"?### Response: SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many distinct official languages are there among countries of players whose positions are defenders.### Response: SELECT count(DISTINCT T1.Official_native_language) FROM country AS T1 JOIN m...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: what are the names and classes of the ships that do not have any captain yet?### Response: SELECT name , CLASS FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: For all directors who directed more than one movie, return the titles of all movies directed by them, along with the director name. Sort by director name, then movie title.### Response: SELECT T...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show last names for all student who are on scholarship.### Response: SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y'.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the opening year in whcih at least two churches opened.### Response: SELECT open_date FROM church GROUP BY open_date HAVING count(*) >= 2.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the organisation type and id of the organisation which has the most number of research staff?### Response: SELECT T1.organisation_type , T1.organisation_id FROM Organisations AS T1 JOIN...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the name of courses that have at least five enrollments?### Response: SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID = T2.CID GROUP BY T2.CID HAVING COUNT(*) >= ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: In which year did the least people enter hall of fame?### Response: SELECT yearid FROM hall_of_fame GROUP BY yearid ORDER BY count(*) ASC LIMIT 1;.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of persons who are friends with Bob.### Response: SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Bob'.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the max, average and min training hours of all players.### Response: SELECT avg(HS) , max(HS) , min(HS) FROM Player.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of the organization that has published the largest number of papers.### Response: SELECT t1.name FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of all patients who have an undergoing treatment and are staying in room 111.### Response: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN J...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find out the first name and last name of staff lived in city Damianfort.### Response: SELECT T2.first_name , T2.last_name FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_addre...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show ids for all documents with budget types described as 'Government'.### Response: SELECT T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_code ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the average score and average staff number of all shops?### Response: SELECT avg(num_of_staff) , avg(score) FROM shop.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the name of the party that has at least two records.### Response: SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: When was the first asset acquired?### Response: SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date ASC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the most common nationality of pilots.### Response: SELECT Nationality FROM pilot GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Please show the most common reigns of wrestlers.### Response: SELECT Reign FROM wrestler GROUP BY Reign ORDER BY COUNT(*) DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the ids of all employees who don't destroy any document.### Response: SELECT employee_id FROM Employees EXCEPT SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the male friend of Alice whose job is a doctor?### Response: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many classes are professor whose last name is Graztevski has?### Response: SELECT count(*) FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE T1.EMP_LNAME = 'Graztevs...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Give me the average prices of wines that are produced by appelations in Sonoma County.### Response: SELECT AVG(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelatio...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the name of track with most number of races.### Response: SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY count(*) DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What were all the salary values of players in 2010 and 2001?### Response: SELECT salary FROM salary WHERE YEAR = 2010 UNION SELECT salary FROM salary WHERE YEAR = 2001.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the names of journalists and the dates of the events they reported.### Response: SELECT T3.Name , T2.Date FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journa...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the average age of students living in each dorm and the name of dorm.### Response: SELECT avg(T1.age) , T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN do...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of stadiums that some Australian swimmers have been to.### Response: SELECT t4.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id JOIN event AS t3 ON t2.event_id...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the names of parties with at least 2 events?### Response: SELECT T2.party_name FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id HAVING count(...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Select the name of each manufacturer along with the name and price of its most expensive product.### Response: SELECT T1.Name , max(T1.Price) , T2.name FROM products AS T1 JOIN Manufacturers A...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the average hours for the students whose tryout decision is no.### Response: SELECT avg(T1.HS) FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'no'.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the name of all projects that are operated longer than the average working hours of all projects.### Response: SELECT name FROM projects WHERE hours > (SELECT avg(hours) FROM projects).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the saving balance of the account with the highest checking balance.### Response: SELECT T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the names and descriptions of the products that are of 'Cutlery' type and have daily hire cost lower than 20?### Response: SELECT product_name , product_description FROM products_for_h...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the names of the tourist attractions and the dates when the tourists named Vincent or Vivian visited there?### Response: SELECT T1.Name , T3.Visit_Date FROM Tourist_Attractions AS T1 J...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the names of people that have not been on the affirmative side of debates.### Response: SELECT Name FROM people WHERE People_id NOT IN (SELECT Affirmative FROM debate_people).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Return the cities with more than 3 airports in the United States.### Response: SELECT city FROM airports WHERE country = 'United States' GROUP BY city HAVING count(*) > 3.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which artist does the album "Balls to the Wall" belong to?### Response: SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = "Balls to the Wall".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are names of the movies that are either made before 1980 or directed by James Cameron?### Response: SELECT title FROM Movie WHERE director = "James Cameron" OR YEAR < 1980.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the statuses of roller coasters longer than 3300 or higher than 100.### Response: SELECT Status FROM roller_coaster WHERE LENGTH > 3300 OR Height > 100.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many documents were shipped by USPS?### Response: SELECT count(*) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the GDP and population of the city that already served as a host more than once?### Response: SELECT t1.gdp , t1.Regional_Population FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the ids of the employees who don't authorize destruction for any document.### Response: SELECT employee_id FROM Employees EXCEPT SELECT Destruction_Authorised_by_Employee_ID FROM Documents_...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the movies with the highest average rating. Return the movie titles and average rating.### Response: SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many games are played for all football games by students on scholarship?### Response: SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y'.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the names of aircrafts and that won matches at least twice.### Response: SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winnin...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the last name and age of the student who has allergy to both milk and cat.### Response: SELECT lname , age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Mil...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: For each nomination, show the name of the artwork and name of the festival where it is nominated.### Response: SELECT T2.Name , T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.A...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which paper is published in an institution in "USA" and have "Turon" as its second author?### Response: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN p...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: For each user, return the name and the average rating of reviews given by them.### Response: SELECT T1.name , avg(T2.rating) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP B...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the full names of faculties who are members of department with department number 520.### Response: SELECT T1.Fname , T1.Lname FROM FACULTY AS T1 JOIN MEMBER_OF AS T2 ON T1.FacID = T2.Fac...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Select the names of manufacturer whose products have an average price higher than or equal to $150.### Response: SELECT avg(T1.Price) , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of all stores in Khanewal District.### Response: SELECT t1.store_name FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the most common apartment type code among apartments with more than 1 bathroom.### Response: SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show me the departure date and arrival date for all flights from Los Angeles to Honolulu.### Response: SELECT departure_date , arrival_date FROM Flight WHERE origin = "Los Angeles" AND destin...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: When was the order placed whose shipment tracking number is 3452? Give me the date.### Response: SELECT T1.date_order_placed FROM orders AS T1 JOIN shipments AS T2 ON T1.order_id = T2.order_id W...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the titles of books in descending order of publication price.### Response: SELECT T1.Title FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T2.Price DESC.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the patient who most recently stayed in room 111.### Response: SELECT patient FROM stay WHERE room = 111 ORDER BY staystart DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: For each product type, return the maximum and minimum price.### Response: SELECT product_type_code , max(product_price) , min(product_price) FROM products GROUP BY product_type_code.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the papers published under the institution "Indiana University"?### Response: SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of the courses that do not have any prerequisite?### Response: SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which events id does not have any participant with detail 'Kenyatta Kuhn'?### Response: SELECT event_id FROM EVENTS EXCEPT SELECT T1.event_id FROM Participants_in_Events AS T1 JOIN Participants ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the title of the prerequisite class of International Finance course?### Response: SELECT title FROM course WHERE course_id IN (SELECT T1.prereq_id FROM prereq AS T1 JOIN course AS T2 ON ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the names of customers who have the most mailshots.### Response: SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1....
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which part has the least chargeable amount? List the part id and amount.### Response: SELECT part_id , chargeable_amount FROM Parts ORDER BY chargeable_amount ASC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the total savings balance of all accounts except the account with name ‘Brown’.### Response: SELECT sum(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Where does the staff member with the first name Elsa live?### Response: SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa'.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the least common media type in all tracks?### Response: SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the name and opening year for three churches that opened most recently.### Response: SELECT name , open_date FROM church ORDER BY open_date DESC LIMIT 3.