text2SQL
stringlengths
192
7.27k
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which customer is associated with the latest policy?### Response: SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.start_date = ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: find the name of the program that was launched most recently.### Response: SELECT name FROM program ORDER BY launch DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the average unit price of rock tracks?### Response: SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Rock".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the average price and score of wines grouped by appelation?### Response: SELECT avg(Price) , avg(Score) , Appelation FROM WINE GROUP BY Appelation.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List total amount of invoice from Chicago, IL.### Response: SELECT sum(total) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL";.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the times used by climbers to climb mountains in Country Uganda.### Response: SELECT T1.Time FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T2.Country = ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the email addresses of teachers whose address has zip code "918"?### Response: SELECT T2.email_address FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the id of the most recent order?### Response: SELECT order_id FROM orders ORDER BY date_order_placed DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many professors who are from either Accounting or Biology department?### Response: SELECT count(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T2.dept_n...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the count and code of the job has most employees.### Response: SELECT emp_jobcode , count(*) FROM employee GROUP BY emp_jobcode 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 is the publisher with most number of books?### Response: SELECT publisher FROM book_club GROUP BY publisher ORDER BY count(*) DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many artists do not have any album?### Response: SELECT count(*) FROM ARTIST WHERE artistid NOT IN(SELECT artistid FROM ALBUM).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the date of ceremony of music festivals with category "Best Song" and result "Awarded"?### Response: SELECT Date_of_ceremony FROM music_festival WHERE Category = "Best Song" AND RESUL...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the country of origin for the artist who made the least number of songs?### Response: SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.ar...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many documents do not have any expense?### Response: SELECT count(*) FROM Documents WHERE document_id NOT IN ( SELECT document_id FROM Documents_with_expenses ).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the total number of enrollment of schools that do not have any goalie player?### Response: SELECT sum(enr) FROM college WHERE cName NOT IN (SELECT cName FROM tryout WHERE pPos = "goali...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the race class with most number of races.### Response: SELECT CLASS FROM race GROUP BY CLASS 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 names of actors that have appeared in musical with name "The Phantom of the Opera".### Response: SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID WHERE ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the maximum and minimum share count of different transaction types.### Response: SELECT transaction_type_code , max(share_count) , min(share_count) FROM TRANSACTIONS GROUP BY transaction_...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the year in which there are more than one festivals.### Response: SELECT YEAR FROM festival_detail GROUP BY YEAR HAVING COUNT(*) > 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the name of the customer that made the order with the largest quantity?### Response: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.cust...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: For each account type, find the average account balance of customers with credit score lower than 50.### Response: SELECT avg(acc_bal) , acc_type FROM customer WHERE credit_score < 50 GROUP B...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the id, forename and number of races of all drivers who have at least participated in two races?### Response: SELECT T1.driverid , T1.forename , count(*) FROM drivers AS T1 JOIN results A...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many students enrolled in class ACCT-211?### Response: SELECT count(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code WHERE T1.crs_code = 'ACCT-211'.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the total number of products that are in orders with status "Cancelled"?### Response: SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the names of the songs whose rating is below the rating of all songs in English?### Response: SELECT song_name FROM song WHERE rating < (SELECT min(rating) FROM song WHERE languages ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the location with the most cinemas opened in year 2010 or later?### Response: SELECT LOCATION FROM cinema WHERE openning_year >= 2010 GROUP BY LOCATION 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 is the entry name of the most expensive catalog (in USD)?### Response: SELECT catalog_entry_name FROM catalog_contents ORDER BY price_in_dollars DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the top 10 customers by total gross sales. List customers' first and last name and total gross sales.### Response: SELECT T1.first_name , T1.last_name , SUM(T2.total) FROM customers AS T1...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the names of members in ascending order of their rank in rounds.### Response: SELECT T1.Name FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID ORDER BY Rank_in_Round ASC.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the names of products whose availability equals to 1?### Response: SELECT T2.product_name FROM view_product_availability AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.produ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the distinct name, location and products of the enzymes which has any 'inhibitor' interaction?### Response: SELECT DISTINCT T1.name , T1.location , T1.product FROM enzyme AS T1 JOIN m...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of songs whose genre is modern or language is English.### Response: SELECT song_name FROM song WHERE genre_is = "modern" OR languages = "english".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of the customers who have at most two orders.### Response: SELECT T2.customer_name FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the average and oldest age for students with different sex.### Response: SELECT avg(age) , max(age) , sex FROM student GROUP BY sex.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of students who have taken any course in the fall semester of year 2003.### Response: SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester = 'Fall' AND YEAR...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show all official native languages that contain the word "English".### Response: SELECT Official_native_language FROM country WHERE Official_native_language LIKE "%English%".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the campus that have between 600 and 1000 faculty lines in year 2004.### Response: SELECT T1.campus FROM campuses AS t1 JOIN faculty AS t2 ON t1.id = t2.campus WHERE t2.faculty >= 600 A...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the name of the entrepreneur with the greatest weight?### Response: SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Weight DESC LIMI...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the checking balance of the accounts whose savings balance is higher than the average savings balance.### Response: SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid =...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Return the gender and name of artist who produced the song with the lowest resolution.### Response: SELECT T1.gender , T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2....
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of customers who have used either the service "Close a policy" or the service "Upgrade a policy".### Response: SELECT t1.customer_name FROM customers AS t1 JOIN first_notification...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show all headquarters without a company in banking industry.### Response: SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry = 'Banking'.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the musical nominee with award "Bob Fosse" or "Cleavant Derricks".### Response: SELECT Nominee FROM musical WHERE Award = "Tony Award" OR Award = "Cleavant Derricks".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the member name and hometown who registered a branch in 2016.### Response: SELECT T2.name , T2.hometown FROM membership_register_branch AS T1 JOIN member AS T2 ON T1.member_id = T2.membe...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the color code and description of the product named "chervil"?### Response: SELECT t1.color_code , t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the denomination shared by more than one school.### Response: SELECT Denomination FROM school GROUP BY Denomination HAVING COUNT(*) > 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of the teacher who teaches the largest number of students.### Response: SELECT T2.firstname , T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom GROU...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the apartment type code that has the largest number of total rooms, together with the number of bathrooms and number of bedrooms.### Response: SELECT apt_type_code , bathroom_count , bedr...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the names of editors of age either 24 or 25.### Response: SELECT Name FROM editor WHERE Age = 24 OR Age = 25.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the birth date and birth place of the body builder with the highest total points?### Response: SELECT T2.Birth_Date , T2.Birth_Place FROM body_builder AS T1 JOIN people AS T2 ON T1.Peo...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which assets did not incur any fault log? List the asset model.### Response: SELECT asset_model FROM Assets WHERE asset_id NOT IN (SELECT asset_id FROM Fault_Log).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List lesson id of all lessons taught by staff with first name as Janessa, last name as Sawayn and nickname containing letter 's'.### Response: SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff A...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the name of employees with three lowest salaries.### Response: SELECT name FROM Employee ORDER BY salary ASC LIMIT 3.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the countries that have more than one mountain.### Response: SELECT Country FROM mountain GROUP BY Country HAVING COUNT(*) > 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the maximum and minimum budget of the departments?### Response: SELECT max(budget_in_billions) , min(budget_in_billions) FROM department.
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: Show the number of cities in counties that have a population more than 20000.### Response: SELECT count(*) FROM city WHERE county_ID IN (SELECT county_ID FROM county_public_safety WHERE populati...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many games has each stadium held?### Response: SELECT T1.id , count(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many settlements does each claim correspond to? List the claim id and the number of settlements.### Response: SELECT T1.Claim_id , count(*) FROM Claims AS T1 JOIN Settlements AS T2 ON T1.cl...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of customers whose name contains "Diana".### Response: SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show all church names that have hosted least two weddings.### Response: SELECT T1.name FROM church AS T1 JOIN wedding AS T2 ON T1.church_id = T2.church_id GROUP BY T1.church_id HAVING count(*)...
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 or Susan.### Response: SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = "Mary" OR T1.name = "Susan".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the names of players coached by the rank 1 coach.### Response: SELECT T3.Player_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_I...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'?### Response: SELECT DISTINCT T1.creation FROM department AS T1 JOIN management AS T2 ON T1...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the names of the cameras that have taken picture of the most mountains?### Response: SELECT T2.name FROM photos AS T1 JOIN camera_lens AS T2 ON T1.camera_lens_id = T2.id GROUP BY T2.i...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many transaction does account with name 337 have?### Response: SELECT count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find names and times of trains that run through stations for the local authority Chiltern.### Response: SELECT t3.name , t3.time FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id J...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Who are the customers that had more than 1 policy? List the customer details and id.### Response: SELECT T1.customer_details , T1.customer_id FROM Customers AS T1 JOIN Customer_Policies AS T2 O...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many orders does Lucas Mancini has?### Response: SELECT count(*) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = "Lucas" AND T1.last_name = "Mancini"...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the name of aircraft which fewest people have its certificate.### Response: SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid GROUP BY T1.aid ORDER BY count(*) ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find name of the project that needs the least amount of time to finish and the name of scientists who worked on it.### Response: SELECT T2.name , T3.name FROM assignedto AS T1 JOIN projects AS ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many cities are there that have more than 3 airports?### Response: SELECT count(*) FROM (SELECT city FROM airports GROUP BY city HAVING count(*) > 3).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How long is the total lesson time taught by staff with first name as Janessa and last name as Sawayn?### Response: SELECT sum(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the schools that were either founded after 1850 or public.### Response: SELECT school FROM university WHERE founded > 1850 OR affiliation = 'Public'.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Please show the nominee who has been nominated the greatest number of times.### Response: SELECT Nominee FROM musical GROUP BY Nominee 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 names of journalists from "England" or "Wales".### Response: SELECT Name FROM journalist WHERE Nationality = "England" OR Nationality = "Wales".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show home city where at least two drivers older than 40 are from.### Response: SELECT home_city FROM driver WHERE age > 40 GROUP BY home_city HAVING count(*) >= 2.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the names of people that are not perpetrators.### Response: SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM perpetrator).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the last names of faculties who are members of computer science department.### Response: SELECT T2.Lname FROM DEPARTMENT AS T1 JOIN FACULTY AS T2 ON T1.DNO = T3.DNO JOIN MEMBER_OF AS T3 O...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: when is the hire date for those employees whose first name does not containing the letter M?### Response: SELECT hire_date FROM employees WHERE first_name NOT LIKE '%M%'.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the name and population of the country that has the highest roller coaster.### Response: SELECT T1.Name , T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: which course has most number of registered students?### Response: SELECT T1.course_name FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_Id GROUP BY T1.cour...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the name of the movie that is rated by most of times?### Response: SELECT T2.title , T1.mID FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY count(*) DES...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the name of the player with the largest number of votes?### Response: SELECT Player_name FROM player ORDER BY Votes DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names and total checking and savings balances of accounts whose savings balance is higher than the average savings balance.### Response: SELECT T1.name , T2.balance + T3.balance FROM a...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: what is the name of the instructor who is in Statistics department and earns the lowest salary?### Response: SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary 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: Find the names and publication dates of all catalogs that have catalog level number greater than 5.### Response: SELECT t1.catalog_name , t1.date_of_publication FROM catalogs AS t1 JOIN catalog...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the total and average amount paid in claim headers.### Response: SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many players were in the team Boston Red Stockings in 2000?### Response: SELECT count(*) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stocki...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the stories of the building with the largest height.### Response: SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the female friends of Alice.### Response: SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'female'.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the name of the oldest manager?### Response: SELECT Name FROM manager ORDER BY Age DESC LIMIT 1.
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 got A or C.### Response: SELECT T1.stu_fname , T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the number of classes in each school.### Response: SELECT count(*) , T3.school_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T2.dept_code ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of either colleges in LA with greater than 15000 size or in state AZ with less than 13000 enrollment.### Response: SELECT cName FROM College WHERE enr < 13000 AND state = "AZ" U...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show all cities along with the number of drama workshop groups in each city.### Response: SELECT T1.City_Town , count(*) FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the name of the most recent movie?### Response: SELECT title FROM Movie WHERE YEAR = (SELECT max(YEAR) FROM Movie).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the minister who took office after 1961 or before 1959.### Response: SELECT minister FROM party WHERE took_office > 1961 OR took_office < 1959.