text2SQL
stringlengths
192
7.27k
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the ids and first names of the 3 teachers that have the most number of assessment notes?### Response: SELECT T1.teacher_id , T2.first_name FROM Assessment_Notes AS T1 JOIN Teachers AS T2 O...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the countries that have both perpetrators with injures more than 50 and perpetrators with injures smaller than 20.### Response: SELECT Country FROM perpetrator WHERE Injured > 50 INTERSEC...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the names of perpetrators in country "China" or "Japan"?### Response: SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country = "Chin...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the names of wrestlers and the teams in elimination in descending order of days held.### Response: SELECT T2.Name , T1.Team FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: give me names of all compatible browsers and accelerators in the descending order of compatible year### Response: SELECT T2.name , T3.name FROM accelerator_compatible_browser AS T1 JOIN browser...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the staff ids and genders of all staffs whose job title is Department Manager?### Response: SELECT T1.staff_id , T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are names for top three branches with most number of membership?### Response: SELECT name FROM branch ORDER BY membership_amount DESC LIMIT 3.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the id, name and nationality of the architect who built most mills?### Response: SELECT T1.id , T1.name , T1.nationality FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of all the clubs that have at least a member from the city with city code "BAL".### Response: SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid =...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of the ships that are steered by both a captain with Midshipman rank and a captain with Lieutenant rank.### Response: SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_i...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which rank has the smallest number of faculty members?### Response: SELECT rank FROM Faculty GROUP BY rank 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 location and Representative name of the gas stations owned by the companies with top 3 Asset amounts.### Response: SELECT T3.location , T3.Representative_Name FROM station_company AS T...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many assets does each maintenance contract contain? List the number and the contract id.### Response: SELECT count(*) , T1.maintenance_contract_id FROM Maintenance_Contracts AS T1 JOIN Asse...
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: List the publication dates of publications with 3 lowest prices.### Response: SELECT Publication_Date FROM publication ORDER BY Price ASC LIMIT 3.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many types of products have Rodrick Heaney bought in total?### Response: SELECT count(DISTINCT t3.product_id) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.custome...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the total budgets of the Marketing or Finance department.### Response: SELECT sum(budget) FROM department WHERE dept_name = 'Marketing' OR dept_name = 'Finance'.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Return the lot details of lots that belong to investors with details "l"?### Response: SELECT T2.lot_details FROM INVESTORS AS T1 JOIN LOTS AS T2 ON T1.investor_id = T2.investor_id WHERE T1.I...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Among all the claims, what is the settlement amount of the claim with the largest claim amount? List both the settlement amount and claim amount.### Response: SELECT Amount_Settled , Amount_Cla...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the names of the schools without any endowment.### Response: SELECT school_name FROM school WHERE school_id NOT IN (SELECT school_id FROM endowment).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of the instructors who taught C Programming course before.### Response: SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id = T2.id JOIN course AS T3 ON T2.course_id...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the name and the nationality of the oldest host.### Response: SELECT Name , Nationality FROM HOST ORDER BY Age 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 countries and the average speed of roller coasters from each country.### Response: SELECT T1.Name , avg(T2.Speed) FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name and id of the top 3 expensive rooms.### Response: SELECT RoomId , roomName FROM Rooms ORDER BY basePrice DESC LIMIT 3;.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the customer id with most number of cards, and how many does he have?### Response: SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_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: Which country has at most 3 stadiums listed?### Response: SELECT country FROM stadium GROUP BY country HAVING count(*) <= 3.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: show the lowest low temperature and highest wind speed in miles per hour.### Response: SELECT min(low_temperature) , max(wind_speed_mph) FROM weekly_weather.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the address of all customers that live in Germany and have invoice.### Response: SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the first name and major of the students who are not allegry to soy.### Response: SELECT fname , major FROM Student WHERE StuID NOT IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Soy...
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 entrepreneurs.### Response: SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM entrepreneur).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show all student IDs with the number of sports and total number of games played### Response: SELECT StuID , count(*) , sum(gamesplayed) FROM Sportsinfo GROUP BY StuID.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which complaint status has more than 3 records on file?### Response: SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING count(*) > 3.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the party with drivers from Hartford and drivers older than 40.### Response: SELECT party FROM driver WHERE home_city = 'Hartford' AND age > 40.
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 is broadcast most frequently.### Response: SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id GROUP BY t2.program_id ORDE...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the names of mountains with height more than 5000 or prominence more than 1000.### Response: SELECT Name FROM mountain WHERE Height > 5000 OR Prominence > 1000.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which year has the most degrees conferred?### Response: SELECT YEAR FROM degrees GROUP BY YEAR ORDER BY sum(degrees) DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the last date of the staff leaving the projects?### Response: SELECT date_to FROM Project_Staff ORDER BY date_to DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name and college of students whose decisions are yes in the tryout.### Response: SELECT T1.pName , T2.cName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which month has the most happy hours?### Response: SELECT MONTH FROM happy_hour GROUP BY MONTH 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 name of each camera lens and the number of photos taken by it? Order the result by the count of photos.### Response: SELECT T1.name , count(*) FROM camera_lens AS T1 JOIN photos AS ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List all the product names with the color description "white".### Response: SELECT t1.product_name FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_des...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which last names are both used by customers and by staff?### Response: SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the name and date of the most recent race?### Response: SELECT name , date FROM races ORDER BY date DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Return the names of singers who are from UK and released an English song.### Response: SELECT artist_name FROM artist WHERE country = "UK" INTERSECT SELECT T1.artist_name FROM artist AS T1 JOI...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names and number of works of all artists who have at least one English songs.### Response: SELECT T1.artist_name , count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.a...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find names of all colleges whose enrollment is greater than that of all colleges in the FL state.### Response: SELECT cName FROM college WHERE enr > (SELECT max(enr) FROM college WHERE state ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the names of countries and the average speed of roller coasters from each country.### Response: SELECT T1.Name , avg(T2.Speed) FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the name of all the distinct customers who have orders with status "Packing".### Response: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.cus...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the ids and names of the companies that operated more than one flight?### Response: SELECT T1.id , T1.name FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id GROUP...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many states that have some college students playing in the mid position but not in the goalie position.### Response: SELECT COUNT(*) FROM (SELECT T1.state FROM college AS T1 JOIN tryout AS T...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the ids, scores, and dates of the games which caused at least two injury accidents?### Response: SELECT T1.id , T1.score , T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.gam...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of the products that have the color description "red" and have the characteristic name "fast".### Response: SELECT product_name FROM products AS t1 JOIN product_characteristics AS ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the countries that have both managers of age above 50 and managers of age below 46.### Response: SELECT Country FROM manager WHERE Age > 50 INTERSECT SELECT Country FROM manager WHERE Age...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the names of employees that work for companies with sales bigger than 200.### Response: SELECT T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the campus fee of "San Jose State University" in year 2000.### Response: SELECT t1.campusfee FROM csu_fees AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t2.campus = "San Jose Sta...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which allergy has most number of students affected?### Response: SELECT Allergy FROM Has_allergy GROUP BY Allergy 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 locations that have more than one railways.### Response: SELECT LOCATION FROM railway GROUP BY LOCATION 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 club that has the most female students.### Response: SELECT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Select the name and price of the cheapest product.### Response: SELECT name , price FROM Products ORDER BY price ASC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the manager name with most number of gas stations opened after 2000.### Response: SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY count(*) DESC ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find all the papers published by "Aaron Turon".### Response: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WH...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the driver id and number of races of all drivers who have at most participated in 30 races?### Response: SELECT T1.driverid , count(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which claim incurred the most number of settlements? List the claim id, the date the claim was made, and the number.### Response: SELECT T1.claim_id , T1.date_claim_made , count(*) FROM Claims...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the fleet series of the aircrafts flied by pilots younger than 34### Response: SELECT T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN p...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the number of dorms and total capacity for each gender.### Response: SELECT count(*) , sum(student_capacity) , gender FROM dorm GROUP BY gender.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the minimum, average, maximum order quantity of all invoices.### Response: SELECT min(Order_Quantity) , avg(Order_Quantity) , max(Order_Quantity) FROM INVOICES.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: display those employees who contain a letter z to their first name and also display their last name, city.### Response: SELECT T1.first_name , T1.last_name , T3.city FROM employees AS T1 JOIN ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many patients do each physician take care of? List their names and number of patients they take care of.### Response: SELECT T1.name , count(*) FROM physician AS T1 JOIN patient AS T2 ON T1...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the church names for the weddings of all people older than 30.### Response: SELECT T4.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which enzyme names have the substring "ALA"?### Response: SELECT name FROM enzyme WHERE name LIKE "%ALA%".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is minimum hours of the students playing in different position?### Response: SELECT min(T2.HS) , T1.pPos FROM tryout AS T1 JOIN player AS T2 ON T1.pID = T2.pID GROUP BY T1.pPos.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of all customers whose name contains "Alex".### Response: SELECT customer_name FROM customers WHERE customer_name LIKE "%Alex%".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the ids and details of the investors who have at least two transactions with type code "SALE".### Response: SELECT T2.investor_id , T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIO...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the name and gender for all artists who released songs in March.### Response: SELECT T1.artist_name , T1.gender FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the first names of all professors in the Accounting department who is teaching some course and the class room.### Response: SELECT T2.emp_fname , T1.class_room FROM CLASS AS T1 JOIN employ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the starting year of the oldest technicians?### Response: SELECT Starting_Year FROM technician 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 the addresses of the course authors who teach the course with name "operating system" or "data structure".### Response: SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Co...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the times of elimination by "Punk" or "Orton".### Response: SELECT TIME FROM elimination WHERE Eliminated_By = "Punk" OR Eliminated_By = "Orton".
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the station name with greatest number of trains.### Response: SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id ORDER BY c...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which is the email of the party that has used the services the most number of times?### Response: SELECT t1.party_email FROM parties AS t1 JOIN party_services AS t2 ON t1.party_id = t2.custome...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the names and years of the movies that has the top 3 highest rating star?### Response: SELECT T2.title , T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID ORDER BY T1.sta...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of the first 5 customers.### Response: SELECT customer_name FROM Customers ORDER BY date_became_customer LIMIT 5.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the names and decor of rooms that have a king bed. Sort the list by their price.### Response: SELECT roomName , decor FROM Rooms WHERE bedtype = 'King' ORDER BY basePrice;.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are all the policy types of the customer named "Dayana Robel"?### Response: SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.c...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the first year and last year of parties with theme "Spring" or "Teqnology".### Response: SELECT First_year , Last_year FROM party WHERE Party_Theme = "Spring" OR Party_Theme = "Teqnolo...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the wineries that have at least four wines.### Response: SELECT Winery FROM WINE GROUP BY Winery HAVING count(*) >= 4.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: A list of the top 10 countries by average invoice size. List country name and average invoice size.### Response: SELECT billing_country , AVG(total) FROM invoices GROUP BY billing_country ORDER...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the title and credits of the course that is taught in the largest classroom (with the highest capacity)?### Response: SELECT T3.title , T3.credits FROM classroom AS T1 JOIN SECTION AS T...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the average amount of transactions for different lots, ordered by average amount of transactions.### Response: SELECT T2.lot_id , avg(amount_of_transaction) FROM TRANSACTIONS AS T1 JOIN Tr...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What distinct accelerator names are compatible with the browswers that have market share higher than 15?### Response: SELECT DISTINCT T1.name FROM web_client_accelerator AS T1 JOIN accelerator_c...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: which countries did participated in both Friendly and Tournament type competitions.### Response: SELECT country FROM competition WHERE competition_type = 'Friendly' INTERSECT SELECT country FR...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which city has the highest temperature in February?### Response: SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id ORDER BY T2.Feb DESC LIMIT 1.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the details of all sales and purchases?### Response: SELECT sales_details FROM sales UNION SELECT purchase_details FROM purchases.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the average age and number of male students (with sex M) from each city.### Response: SELECT count(*) , avg(age) , city_code FROM student WHERE sex = 'M' GROUP BY city_code.
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the last names of teachers who are not involved in any detention.### Response: SELECT last_name FROM Teachers EXCEPT SELECT T1.last_name FROM Teachers AS T1 JOIN Detention AS T2 ON T1.teach...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the id of problems reported by the staff named Dameon Frami or Jolie Weber?### Response: SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id ...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the first name of students not enrolled in any course.### Response: SELECT Fname FROM STUDENT WHERE StuID NOT IN (SELECT StuID FROM ENROLLED_IN).
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the total number of people who has no friend living in the city of Austin.### Response: SELECT count(DISTINCT name) FROM PersonFriend WHERE friend NOT IN (SELECT name FROM person WHERE c...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the names of phones that have total number of stocks bigger than 2000, in descending order of the total number of stocks.### Response: SELECT T2.Name FROM phone_market AS T1 JOIN phone AS T...
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the names and main services for train stations that have the top three total number of passengers.### Response: SELECT name , main_services FROM station ORDER BY total_passengers DESC LIMI...