text2SQL stringlengths 192 7.27k |
|---|
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Give me a list of cities whose temperature in Mar is lower than that in Dec and which have never been host cities.### Response: SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_i... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many friends does Dan have?### Response: SELECT count(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan'. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the first, last name, gpa of the youngest one among students whose GPA is above 3?### Response: SELECT stu_fname , stu_lname , stu_gpa FROM student WHERE stu_gpa > 3 ORDER BY stu_dob... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the title and star rating of the movie that got the least rating star for each reviewer.### Response: SELECT T2.title , T1.rID , T1.stars , min(T1.stars) FROM Rating AS T1 JOIN Movie AS ... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the total number of purchases for members with level 6?### Response: SELECT count(*) FROM purchase AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T2.level = 6. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the facility codes of apartments with more than 4 bedrooms.### Response: SELECT T1.facility_code FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.be... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: how many people are there whose weight is higher than 85 for each gender?### Response: SELECT count(*) , sex FROM people WHERE weight > 85 GROUP BY sex. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which product has been ordered most number of times?### Response: SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id O... |
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: Which gender makes up the majority of the staff?### Response: SELECT gender FROM staff GROUP BY gender 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 residents does each property have? List property id and resident count.### Response: SELECT T1.property_id , count(*) FROM properties AS T1 JOIN residents AS T2 ON T1.property_id = T... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the aircraft name for the flight with number 99### Response: SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which sport has most number of students on scholarship?### Response: SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname 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 address content of the customer named "Maudie Kertzmann"?### Response: SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which country is the airport that has the highest altitude located in?### Response: SELECT country FROM airports ORDER BY elevation DESC LIMIT 1. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the number of people who is under 40 for each gender.### Response: SELECT count(*) , gender FROM Person WHERE age < 40 GROUP BY gender. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: find the ids of reviewers who did not give 4 star.### Response: SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars = 4. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the document name and the document date for all documents on project with details 'Graph Database project'.### Response: SELECT document_name , document_date FROM Documents AS T1 JOIN proj... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show all the activity names and the number of faculty involved in each activity.### Response: SELECT T1.activity_name , count(*) FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.act... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the id of the trip that has the shortest duration?### Response: SELECT id FROM trip ORDER BY duration LIMIT 1. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the budget type code with most number of documents.### Response: SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY count(*) DESC LIMIT 1. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: For each user, find their name and the number of reviews written by them.### Response: SELECT T1.name , count(*) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the product type whose average price is higher than the average price of all products.### Response: SELECT product_type_code FROM products GROUP BY product_type_code HAVING avg(product_pric... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many instruments does the song "Le Pop" use?### Response: SELECT count(DISTINCT instrument) FROM instruments AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = "Le Pop". |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: display the employee number and job id for all employees whose salary is smaller than any salary of those employees whose job title is MK_MAN.### Response: SELECT employee_id , job_id FROM empl... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the names of aircrafts that are associated with both an airport named "London Heathrow" and an airport named "London Gatwick"### Response: SELECT T1.Aircraft FROM aircraft AS T1 JOIN airpor... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List first name and last name of customers lived in city Lockmanfurt.### Response: SELECT T1.first_name , T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.a... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the grape, appelation and name of wines whose score is higher than 93 ordered by Name.### Response: SELECT Grape , Appelation , Name FROM WINE WHERE Score > 93 ORDER BY Name. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of the ship that is steered by the youngest captain.### Response: SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id ORDER BY t2.age LIMIT 1. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the number of states that has some college whose enrollment is larger than the average enrollment?### Response: SELECT count(DISTINCT state) FROM college WHERE enr > (SELECT avg(enr) F... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List all the contact channel codes that were used less than 5 times.### Response: SELECT channel_code FROM customer_contact_channels GROUP BY channel_code HAVING count(customer_id) < 5. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the shortest duration and lowest rating of songs grouped by genre and ordered by genre?### Response: SELECT min(T1.duration) , min(T2.rating) , T2.genre_is FROM files AS T1 JOIN song ... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the shipping charge and customer id for customer orders with order status Cancelled or Paid.### Response: SELECT order_shipping_charges , customer_id FROM customer_orders WHERE order_statu... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many clubs does the student named "Eric Tai" belong to?### Response: SELECT count(DISTINCT t1.clubname) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the name of the highest mountain?### Response: SELECT Name FROM mountain ORDER BY Height DESC LIMIT 1. |
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: Find the state and country of all cities with post code starting with 4.### Response: SELECT state_province_county , country FROM addresses WHERE zip_postcode LIKE "4%". |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the state in the US with the most invoices.### Response: SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state 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 total market rate of the furnitures that have the top 2 market shares.### Response: SELECT sum(market_rate) FROM furniture ORDER BY market_rate DESC LIMIT 2. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: When did the first staff for the projects started working?### Response: SELECT date_from FROM Project_Staff ORDER BY date_from ASC LIMIT 1. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show all the ranks and the number of male and female faculty for each rank.### Response: SELECT rank , sex , count(*) FROM Faculty GROUP BY rank , sex. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of departments that are either in division AS or in division EN and in Building NEB.### Response: SELECT DName FROM DEPARTMENT WHERE Division = "AS" UNION SELECT DName FROM DEPA... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the role description and the id of the project staff involved in most number of project outcomes?### Response: SELECT T1.role_description , T2.staff_id FROM Staff_Roles AS T1 JOIN Project_... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born.### Response: SELECT T3.born_state FROM department AS T1 JOIN management AS T... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show all the locations where no cinema has capacity over 800.### Response: SELECT LOCATION FROM cinema EXCEPT SELECT LOCATION FROM cinema WHERE capacity > 800. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find all the policy types that are used by more than 2 customers.### Response: SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*) > 2. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the ids of stations that are located in San Francisco and have average bike availability above 10.### Response: SELECT id FROM station WHERE city = "San Francisco" INTERSECT SELECT st... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the location shared by most counties?### Response: SELECT LOCATION FROM county_public_safety 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: Which project made the most number of outcomes? List the project details and the project id.### Response: SELECT T1.project_details , T1.project_id FROM Projects AS T1 JOIN Project_outcomes AS ... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the login name of the course author that teaches the course with name "advanced database".### Response: SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.au... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the name of the product with the color description 'yellow'?### Response: SELECT T1.product_name FROM products AS T1 JOIN ref_colors AS T2 ON T1.color_code = T2.color_code WHERE T2.col... |
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: How many cards does customer Art Turcotte have?### Response: SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = ... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the id, forname and surname of the driver who had the first position in terms of laptime at least twice?### Response: SELECT T1.driverid , T1.forename , T1.surname FROM drivers AS T1 J... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: For each injury accident, find the date of the game and the name of the injured player in the game, and sort the results in descending order of game season.### Response: SELECT T1.date , T2.pla... |
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 rooms whose price is higher than the average price.### Response: SELECT roomName FROM Rooms WHERE basePrice > ( SELECT avg(basePrice) FROM Rooms );. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the residences that have both a player of gender "M" and a player of gender "F".### Response: SELECT Residence FROM player WHERE gender = "M" INTERSECT SELECT Residence FROM player WHERE ... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the first names and last names of students with address in Wisconsin state?### Response: SELECT T2.first_name , T2.last_name FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id ... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which countries do not have a stadium that was opened after 2006?### Response: SELECT country FROM stadium EXCEPT SELECT country FROM stadium WHERE opening_year > 2006. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the titles of items whose rating is higher than the average review rating of all items.### Response: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which film is rented at a fee of 0.99 and has less than 3 in the inventory? List the film title and id.### Response: SELECT title , film_id FROM film WHERE rental_rate = 0.99 INTERSECT SELECT... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show names of ships involved in a mission launched after 1928.### Response: SELECT T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T1.Launched_Year > 1928. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the song in the volume with the maximum weeks on top?### Response: SELECT Song FROM volume ORDER BY Weeks_on_Top 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 age of the person who is a friend of both Dan and Alice.### Response: SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend ... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of the products with length smaller than 3 or height greater than 5.### Response: SELECT catalog_entry_name FROM catalog_contents WHERE LENGTH < 3 OR width > 5. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the durations of the longest and the shortest tracks in milliseconds?### Response: SELECT max(Milliseconds) , min(Milliseconds) FROM TRACK. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the actual delivery dates of orders with quantity 1?### Response: SELECT T1.Actual_Delivery_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID WHERE T... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the sale details and dates of transactions with amount smaller than 3000?### Response: SELECT T1.sales_details , T2.date_of_transaction FROM SALES AS T1 JOIN TRANSACTIONS AS T2 ON T1.s... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List the hardware model name for the phons that were produced by "Nokia Corporation" but whose screen mode type is not Text.### Response: SELECT DISTINCT T2.Hardware_Model_name FROM screen_mode ... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What are the maximum and minimum age of students with major 600?### Response: SELECT max(Age) , min(Age) FROM STUDENT WHERE Major = 600. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How long does student Linda Smith spend on the restaurant in total?### Response: SELECT sum(Spent) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fn... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show the locations of parties and the names of the party hosts in ascending order of the age of the host.### Response: SELECT T3.Location , T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.H... |
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: Find the different first names and cities of the students who have allergy to milk or cat.### Response: SELECT DISTINCT T1.fname , T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.s... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the number of different products that are produced by companies at different headquarter cities.### Response: SELECT count(DISTINCT T1.name) , T2.Headquarter FROM products AS T1 JOIN manuf... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the names of customers who either have an deputy policy or uniformed policy.### Response: SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = ... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: For each Orange county campus, report the number of degrees granted after 2000.### Response: SELECT T1.campus , sum(T2.degrees) FROM campuses AS T1 JOIN degrees AS T2 ON T1.id = T2.campus WHE... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed?### Response: SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the season of the game which causes the player 'Walter Samuel' to get injured?### Response: SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.p... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the city_code of the city that the most students live in?### Response: SELECT city_code FROM STUDENT GROUP BY city_code 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 are the names of tourist attractions that can be reached by walk or is at address 660 Shea Crescent?### Response: SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Lo... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the average height of the players from the college named 'Yale University'?### Response: SELECT avg(T1.height) FROM player AS T1 JOIN player_college AS T2 ON T1.player_id = T2.player_i... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which customer, who has made at least one payment, has spent the least money? List his or her first name, last name, and the id.### Response: SELECT T1.first_name , T1.last_name , T1.customer_... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Select the project names which are not assigned yet.### Response: SELECT Name FROM Projects WHERE Code NOT IN (SELECT Project FROM AssignedTo). |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the name and job title of the staff who was assigned the latest?### Response: SELECT T1.staff_name , T2.job_title_code FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.sta... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of project that continues for the longest time.### Response: SELECT name FROM projects ORDER BY hours DESC LIMIT 1. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show institution names along with the number of proteins for each institution.### Response: SELECT T1.institution , count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: What is the last name and office of the professor from the history department?### Response: SELECT T1.emp_lname , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.em... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the name of the department that has the fewest members.### Response: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LI... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Show director with the largest number of show times in total.### Response: SELECT T2.directed_by FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.directed_by ORDER BY... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: List all tracks bought by customer Daan Peeters.### Response: SELECT T1.name FROM tracks AS T1 JOIN invoice_lines AS T2 ON T1.id = T2.track_id JOIN invoices AS T3 ON T3.id = T2.invoice_id JOIN c... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find the total account balance of each customer from Utah or Texas.### Response: SELECT sum(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas'. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Which origin has most number of flights?### Response: SELECT origin FROM Flight GROUP BY origin 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 are the mascots for schools with enrollments above the average?### Response: SELECT mascot FROM school WHERE enrollment > (SELECT avg(enrollment) FROM school). |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: Find number of tracks in each genre?### Response: SELECT count(*) , T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name;. |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: CREATE TABLE 明星 (
词条id,
姓名,
年龄,
毕业院校,
毕业时间)
CREATE TABLE 明星夫妻 (
明星id,
配偶id,
结婚时间,
子女数量)
CREATE TABLE 离异明星 (
明星id,
配偶id,
离异时间,
子女数量)
CREATE TABLE 明星好友 (
明星id,
好友id,
关系)
-- Using valid SQLite... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: CREATE TABLE 明星 (
词条id,
姓名,
年龄,
毕业院校,
毕业时间)
CREATE TABLE 明星夫妻 (
明星id,
配偶id,
结婚时间,
子女数量)
CREATE TABLE 离异明星 (
明星id,
配偶id,
离异时间,
子女数量)
CREATE TABLE 明星好友 (
明星id,
好友id,
关系)
-- Using valid SQLite... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: CREATE TABLE 重要赛事 (
词条id,
赛事名称,
人群,
成立时间,
比赛间隔年,
比赛项目数量)
CREATE TABLE 冠军国家 (
国家名称,
赛事id,
冠军数量)
CREATE TABLE 羽毛球球员 (
词条id,
中文名,
性别,
国籍,
出生日期,
身高)
CREATE TABLE 奥运会冠亚军 (
奥运会名称,
项目名称,
金牌获得者id,
银牌... |
Below is an instruction that describes a task. Write a MySQL query that appropriately completes the request. ### Instruction: CREATE TABLE 重要赛事 (
词条id,
赛事名称,
人群,
成立时间,
比赛间隔年,
比赛项目数量)
CREATE TABLE 冠军国家 (
国家名称,
赛事id,
冠军数量)
CREATE TABLE 羽毛球球员 (
词条id,
中文名,
性别,
国籍,
出生日期,
身高)
CREATE TABLE 奥运会冠亚军 (
奥运会名称,
项目名称,
金牌获得者id,
银牌... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.