problem
stringlengths
121
422
db_id
stringclasses
69 values
solution
stringlengths
23
804
Write SQL query to solve given problem: What is the percentage calories protein of Raspberry Chiffon Pie?. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT pcnt_cal_prot FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Raspberry Chiffon Pie'
Write SQL query to solve given problem: How many ingredients are required to make the Raspberry Chiffon Pie?. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT COUNT(*) FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Raspberry Chiffon Pie'
Write SQL query to solve given problem: List the names of alcohol free recipes.. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.alcohol = 0
Write SQL query to solve given problem: What is the average vitamin C amount of all cakes?. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT AVG(T1.vitamin_c) FROM Nutrition AS T1 INNER JOIN Recipe AS T2 ON T2.recipe_id = T1.recipe_id WHERE T2.title LIKE '%cake%'
Write SQL query to solve given problem: How many dairy recipes can serve more than 10 people?. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT COUNT(*) FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T3.category = 'dairy' AND T1.servings > 10
Write SQL query to solve given problem: List the names of recipes that can lead to constipation.. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.iron > 20
Write SQL query to solve given problem: Which recipe has the highest calories?. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.calories DESC LIMIT 1
Write SQL query to solve given problem: How many recipes are non-dairy?. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT COUNT(T2.recipe_id) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T2.ingredient_id = T1.ingredient_id INNER JOIN Nutrition AS T3 ON T3.recipe_id = T2.recipe_id WHERE T1.category NOT LIKE '%dairy%'
Write SQL query to solve given problem: List all the ingredients of Apricot Yogurt Parfaits.. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT T3.name, T3.category FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Apricot Yogurt Parfaits'
Write SQL query to solve given problem: Identify recipes with different maximum and minimum quantities.. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT T1.title FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.max_qty <> T2.min_qty
Write SQL query to solve given problem: What ingredients does the longest cooking time recipe have?. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT T3.name FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id ORDER BY T1.cook_min DESC LIMIT 1
Write SQL query to solve given problem: Calculate the percentage of recipes with no cholesterol included and have a cooking time less than 20 minutes among all recipes.. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT CAST(SUM(CASE WHEN T1.cook_min < 20 AND T2.cholestrl = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id
Write SQL query to solve given problem: Among all recipes containing cheese, what is the percentage of recipes with calories greater than 200?. Keep the solution inside sql tag ```sql [SQL-Query] ```
cookbook
SELECT CAST(SUM(CASE WHEN T4.calories > 200 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id INNER JOIN Nutrition AS T4 ON T4.recipe_id = T1.recipe_id WHERE T3.category = 'cheese'
Write SQL query to solve given problem: Which employee has the highest salary? Please give his or her full name.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT firstname, lastname FROM employee ORDER BY salary DESC LIMIT 1
Write SQL query to solve given problem: How many emplyees have a good job performance?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM employee WHERE performance = 'Good'
Write SQL query to solve given problem: Please list the social security numbers of the male employees with a salary of over $70,000 a year.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT ssn FROM employee WHERE gender = 'M' AND CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) > 70000
Write SQL query to solve given problem: What is the required education for the position of regional manager?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT educationrequired FROM position WHERE positiontitle = 'Regional Manager'
Write SQL query to solve given problem: Which position has a lower minimum salary, Account Representative or Trainee?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT positiontitle FROM position WHERE positiontitle = 'Account Representative' OR positiontitle = 'Trainee' ORDER BY minsalary ASC LIMIT 1
Write SQL query to solve given problem: In which city's office does Sandy Adams work at?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.lastname = 'Adams' AND T1.firstname = 'Sandy'
Write SQL query to solve given problem: Among the employees working at the office in New York, how many of them have a good job performance?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'NY' AND T1.performance = 'Good'
Write SQL query to solve given problem: What is the office phone number of the location at which Sandy Adams works?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.officephone FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.lastname = 'Adams' AND T1.firstname = 'Sandy'
Write SQL query to solve given problem: How many male employees work at the address 450 Peachtree Rd?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.address = '450 Peachtree Rd' AND T1.gender = 'M'
Write SQL query to solve given problem: How many employees work as an Account Representative?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Account Representative'
Write SQL query to solve given problem: How much higher is James Johnson's salary from the minimum salary of his title?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) - CAST(REPLACE(SUBSTR(T2.minsalary, 4), ',', '') AS REAL) AS diff FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.lastname = 'Johnson' AND T1.firstname = 'James'
Write SQL query to solve given problem: Among the employees who are Trainees, how many of them work in New York?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Trainee' AND T2.state = 'NY'
Write SQL query to solve given problem: Please list the full names of the employees who are working as a Trainee.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T1.firstname, T1.lastname FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee'
Write SQL query to solve given problem: Which employee's job position requires a higher education level, Jose Rodriguez or Sandy Adams?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T1.firstname, T1.lastname FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE (T1.lastname = 'Adams' AND T1.firstname = 'Sandy') OR (T1.lastname = 'Rodriguez' AND T1.firstname = 'Jose') ORDER BY T2.educationrequired DESC LIMIT 1
Write SQL query to solve given problem: Please list the zip codes of the offices where all the male employees with a good job performance work at.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.zipcode FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.gender = 'M' AND T1.performance = 'Good'
Write SQL query to solve given problem: Please list the social security numbers of all the employees who work in California.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T1.ssn FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'CA'
Write SQL query to solve given problem: Among the employees who work as a Trainee, how many of them have a salary of over &20,000 a year?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) > 20000 AND T2.positiontitle = 'Trainee'
Write SQL query to solve given problem: What is the average salary of the employees who work as a Trainee?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT AVG(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) AS avg FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee'
Write SQL query to solve given problem: By what percentage is the average salary of Trainees higher than the minimum salary of this postion?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT 100 * (AVG(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) - CAST(REPLACE(SUBSTR(T2.minsalary, 4), ',', '') AS REAL)) / CAST(REPLACE(SUBSTR(T2.minsalary, 4), ',', '') AS REAL) AS per FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee'
Write SQL query to solve given problem: Give the number of female employees.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM employee WHERE gender = 'F'
Write SQL query to solve given problem: State the name of the city where Jose Rodriguez works.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.firstname = 'Jose' AND T1.lastname = 'Rodriguez'
Write SQL query to solve given problem: In which state does Emily Wood work?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.state FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.firstname = 'Emily' AND T1.lastname = 'Wood'
Write SQL query to solve given problem: What is the education required for David Whitehead to reach his current position?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.educationrequired FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'David' AND T1.lastname = 'Whitehead' AND T1.gender = 'M'
Write SQL query to solve given problem: How many employees are there in the "Miami" office?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.locationcity = 'Miami'
Write SQL query to solve given problem: Who is the highest paid employee in "Boston"? Give the full name.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T1.firstname, T1.lastname FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.locationcity = 'Boston' ORDER BY T1.salary DESC LIMIT 1
Write SQL query to solve given problem: Who is the employee in “New York City” with a good performance? Give the social security number of the employee.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T1.firstname, T1.lastname, T1.ssn FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.locationcity = 'New York City' AND T1.performance = 'Good'
Write SQL query to solve given problem: How many "account representatives" are there in Chicago with a good performance?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Account Representative' AND T2.locationcity = 'Chicago' AND T1.performance = 'Good'
Write SQL query to solve given problem: What is Kenneth Charles's position title?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Kenneth' AND T1.lastname = 'Charles'
Write SQL query to solve given problem: Give the full address of the office of the highest paid manager.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.address FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Manager' ORDER BY T1.salary DESC LIMIT 1
Write SQL query to solve given problem: What is the max salary for 'Tracy Coulter' if he/she stays on his/her position?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.maxsalary FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Tracy' AND T1.lastname = 'Coulter'
Write SQL query to solve given problem: If Jose Rodriguez tried his best, how many percentage can his salary raise without changing his position?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT 100 * (CAST(REPLACE(SUBSTR(T2.maxsalary, 4), ',', '') AS REAL) - CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) / CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) AS per FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Jose' AND T1.lastname = 'Rodriguez'
Write SQL query to solve given problem: How many employees whose performance is poor have a salary of over $50,000 per year?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM employee WHERE performance = 'Poor' AND CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) > 50000
Write SQL query to solve given problem: Who is the employee with the highest salary? Specify his/her full name.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT firstname, lastname FROM employee WHERE CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) = ( SELECT MAX(CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL)) FROM employee )
Write SQL query to solve given problem: How many positions have a maximum salary of no more than US$1000,000?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM position WHERE CAST(REPLACE(SUBSTR(maxsalary, 4), ',', '') AS REAL) < 100000
Write SQL query to solve given problem: How much is the salary of the first ever employee that was hired?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT salary FROM employee ORDER BY hiredate ASC LIMIT 1
Write SQL query to solve given problem: How much is the minimum salary given to the position with the most complex work?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT minsalary FROM position ORDER BY educationrequired DESC LIMIT 1
Write SQL query to solve given problem: What is the full office location address where most of the employees work at?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.address, T2.locationcity, T2.state, T2.zipcode FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID GROUP BY T2.address, T2.locationcity, T2.state, T2.zipcode ORDER BY COUNT(*) DESC LIMIT 1
Write SQL query to solve given problem: What is the average salary of all employees with a 2 year degree position?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT AVG(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.educationrequired = '2 year degree'
Write SQL query to solve given problem: How many male Regional Managers are there?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Regional Manager' AND T1.gender = 'M'
Write SQL query to solve given problem: Which position has the highest amount of poor performing employees?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Poor' GROUP BY T2.positiontitle ORDER BY COUNT(T2.positiontitle) DESC LIMIT 1
Write SQL query to solve given problem: Which position has the highest number of female employees with a 2 year degree?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.educationrequired = '2 year degree' AND T1.gender = 'F' GROUP BY T2.positiontitle ORDER BY COUNT(T2.positiontitle) DESC LIMIT 1
Write SQL query to solve given problem: How many Account Representatives are there in Illinois with satisfying performance?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Account Representative' AND T1.performance = 'Good' AND T2.state = 'IL'
Write SQL query to solve given problem: What is the average salary of the worst performing managers?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT AVG(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Poor' AND T2.positiontitle = 'Manager'
Write SQL query to solve given problem: In which state can you find the highest amount of good performing Account Representatives?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.state FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Account Representative' AND T1.performance = 'Good' GROUP BY T2.state ORDER BY COUNT(T2.state) DESC LIMIT 1
Write SQL query to solve given problem: Mention the employee's full name and performance status who got the lowest in salary per year.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT firstname, lastname, performance FROM employee ORDER BY salary ASC LIMIT 1
Write SQL query to solve given problem: List the location cities in the Western states.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT locationcity FROM location WHERE state IN ('CO', 'UT', 'CA')
Write SQL query to solve given problem: Which city and address has zip code of above 90000?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT locationcity, address FROM location WHERE zipcode > 90000
Write SQL query to solve given problem: Which positions are suitable with 4 years degree education?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT positiontitle FROM position WHERE educationrequired = '4 year degree'
Write SQL query to solve given problem: What is the maximum salary of position "Trainer"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT maxsalary FROM position WHERE positiontitle = 'Trainee'
Write SQL query to solve given problem: List the full name and social security number of the account representative with average performance.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T1.firstname, T1.lastname, T1.ssn FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Average'
Write SQL query to solve given problem: When was Emily Wood hired? Mention her position and salary.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T1.hiredate, T2.positiontitle, T1.salary FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Emily' AND T1.lastname = 'Wood'
Write SQL query to solve given problem: What are the maximum and minimum salary range and position title of Bill Marlin?. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.maxsalary, T2.minsalary, T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Bill' AND T1.lastname = 'Marlin'
Write SQL query to solve given problem: List the full names, gender and positions who's location is in New York city.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T1.firstname, T1.lastname, T1.gender, T3.positiontitle FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T2.locationcity = 'New York City'
Write SQL query to solve given problem: Mention the full name, hired date and performance status of the employee whose location is in Utah state.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T1.firstname, T1.lastname, T1.hiredate, T1.performance FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'UT'
Write SQL query to solve given problem: Among the employees with poor performance, provide the managers' full names, location city, address and its zip code.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T1.firstname, T1.lastname, T2.locationcity, T2.address, T2.zipcode FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Manager' AND T1.performance = 'Poor'
Write SQL query to solve given problem: What is the education required to be account representative? Mention account representative full name and salary who got poor in performance status.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T2.educationrequired, T1.firstname, T1.lastname, T1.salary FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Poor' AND T2.positiontitle = 'Account Representative'
Write SQL query to solve given problem: Write down the full name, performance status and located city of the employee who's social security number is "767-74-7373".. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T1.firstname, T1.lastname, T2.state, T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.ssn = '767-74-7373'
Write SQL query to solve given problem: Describe the employees' full name, positions, located city and office phone number within Colorado state.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT T1.firstname, T1.lastname, T3.positiontitle, T2.locationcity, T2.officephone FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T2.state = 'CO'
Write SQL query to solve given problem: Calculate the monthly average salary of the employee with highest salary. Mention his name, position title and location city.. Keep the solution inside sql tag ```sql [SQL-Query] ```
human_resources
SELECT SUM(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) / 12 AS avg, T1.firstname, T1.lastname , T2.positiontitle, T3.locationcity FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID INNER JOIN location AS T3 ON T1.locationID = T3.locationID WHERE CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) = ( SELECT MAX(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID INNER JOIN location AS T3 ON T1.locationID = T3.locationID )
Write SQL query to solve given problem: Which trip had the longest duration? State the start and end station.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT start_station_name, end_station_name FROM trip WHERE duration = ( SELECT MAX(duration) FROM trip )
Write SQL query to solve given problem: What is the percentage of the trip were done by a subscriber?. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT CAST(COUNT(subscription_type) AS REAL) * 100 / ( SELECT COUNT(subscription_type) FROM trip ) FROM trip WHERE subscription_type = 'Subscriber'
Write SQL query to solve given problem: State the final station of bike id 13. Which city was it at?. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT T2.end_station_id, T1.city FROM station AS T1 INNER JOIN trip AS T2 ON T1.name = T2.end_station_name WHERE T2.bike_id = 13 ORDER BY T2.end_date DESC LIMIT 1
Write SQL query to solve given problem: Name all the trips where the bike was borrowed and returned on a different day. State the city where the bike was returned.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT DISTINCT T1.city FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE SUBSTR(CAST(T2.start_date AS TEXT), INSTR(T2.start_date, '/') + 1) - SUBSTR(CAST(T2.start_date AS TEXT), INSTR(T2.start_date, ' ') - 5) <> SUBSTR(CAST(T2.end_date AS TEXT), INSTR(T2.end_date, '/') + 1) - SUBSTR(CAST(T2.end_date AS TEXT), INSTR(T2.end_date, ' ') - 5)
Write SQL query to solve given problem: Which is the station where no bike could not be borrowed form on the 2013/11/03 02:01:01? State the location of the station.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT T1.name, T1.long FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T2.time = '2013/11/03 02:01:01' AND T2.bikes_available = 0
Write SQL query to solve given problem: Name the station and city with the most borrowed bike.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT T2.start_station_name, T1.city FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name GROUP BY T2.start_station_name ORDER BY COUNT(T2.start_station_name) DESC LIMIT 1
Write SQL query to solve given problem: What was the hottest temperature on the day of trip ID 4080?. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT MAX(T2.max_temperature_f) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code AND T2.date = SUBSTR(CAST(T1.start_date AS TEXT), 1, INSTR(T1.start_date, ' ') - 1) WHERE T1.id = 4080
Write SQL query to solve given problem: At what date and time did San Jose Diridon Caltrain Station have most bikes available.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT T2.time FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T1.name = 'San Jose Diridon Caltrain Station' AND T2.bikes_available = ( SELECT MAX(T2.bikes_available) FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T1.name = 'San Jose Diridon Caltrain Station' )
Write SQL query to solve given problem: Name all the trip on the days when it rained. State the duration of the trip. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT T1.id, T1.duration FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code AND T2.date = SUBSTR(CAST(T1.start_date AS TEXT), 1, INSTR(T1.start_date, ' ') - 1) WHERE T2.events LIKE '%Rain%' OR T2.events LIKE '%rain%'
Write SQL query to solve given problem: List all trips where bikes were returned at location 37.331415, -121.8932. State the date the bike was borrowed.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT T2.end_station_name, T2.start_date FROM station AS T1 INNER JOIN trip AS T2 ON T2.end_station_name = T1.name WHERE T1.lat = 37.331415 AND T1.long = -121.8932
Write SQL query to solve given problem: Among the trips in August 2013, how many bikes were borrowed from Redwood City.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT COUNT(T2.start_date) FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T2.start_date LIKE '8/%/2013%' AND T1.city = 'Redwood City'
Write SQL query to solve given problem: For all trips which took less 5 minutes, state the station name where the bike were borrowed and returned. Indicate mean temperature of the day.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT T1.start_station_name, T1.end_station_name, T2.mean_temperature_f FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.duration < 300
Write SQL query to solve given problem: Among all the trips, which day had the most bikes borrowed? What was the average coldest temperature on that day?. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT T2.date, AVG(T2.min_temperature_f) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code GROUP BY T2.date ORDER BY COUNT(T1.start_date) DESC LIMIT 1
Write SQL query to solve given problem: Calculate the average usage of each bike in the third quarter of year 2013. Find the average wind direction within the same period.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT AVG(T1.duration), AVG(T2.wind_dir_degrees) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE SUBSTR(CAST(T2.date AS TEXT), 1, INSTR(T2.date, '/') - 1) IN ('7', '8', '9') AND SUBSTR(CAST(T2.date AS TEXT), -4) = '2013'
Write SQL query to solve given problem: How many bike stations were installed in San Jose in 2014? Indicate the names of the stations.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT SUM(CASE WHEN city = 'San Jose' AND SUBSTR(installation_date, -4) = '2014' THEN 1 ELSE 0 END) FROM station UNION SELECT name FROM station WHERE city = 'San Jose' AND SUBSTR(installation_date, -4) = '2014'
Write SQL query to solve given problem: What is the longest trip duration that started and ended August 29, 2013?. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT MAX(duration) FROM trip WHERE start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%'
Write SQL query to solve given problem: How long did it take for bike id 426 to reach 2nd at South Park from Market at 4th on 8/29/2013? Indicate the duration in minutes.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT CAST(duration AS REAL) / 60 FROM trip WHERE bike_id = 426 AND end_station_name = '2nd at South Park' AND start_station_name = 'Market at 4th' AND start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%'
Write SQL query to solve given problem: On 8/29/2013, who took the longest to arrive in California Ave Caltrain Station from University and Emerson? Indicate the bike id.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT bike_id FROM trip WHERE start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%' AND end_station_name = 'California Ave Caltrain Station' AND start_station_name = 'University and Emerson' AND duration = ( SELECT MAX(duration) FROM trip WHERE start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%' AND end_station_name = 'California Ave Caltrain Station' AND start_station_name = 'University and Emerson' )
Write SQL query to solve given problem: How many stations in San Francico can hold more than 20 bikes?. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT SUM(CASE WHEN city = 'San Francisco' AND dock_count > 20 THEN 1 ELSE 0 END) FROM station
Write SQL query to solve given problem: When was the hottest temperature recorded? If there are multiple dates with the hottest temperature, indicate all of the dates.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT max_temperature_f, date FROM weather WHERE max_temperature_f = ( SELECT MAX(max_temperature_f) FROM weather WHERE max_temperature_f IS NOT NULL AND max_temperature_f IS NOT '' )
Write SQL query to solve given problem: What is the maximum dew point in Fahrenheit degree on 7/15/2014 in the area with a zip code of 94301?. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT DISTINCT CASE WHEN date = '7/15/2014' AND zip_code = 94301 THEN max_dew_point_f END FROM weather
Write SQL query to solve given problem: Which year experienced the most rain?. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT SUBSTR(CAST(date AS TEXT), -4) FROM weather GROUP BY SUBSTR(CAST(date AS TEXT), -4) ORDER BY SUM(CASE WHEN events LIKE '%Rain%' OR events LIKE '%rain%' THEN 1 ELSE 0 END) DESC LIMIT 1
Write SQL query to solve given problem: On 10/20/2014, what is the duration of the fastest trip which started from the station with latitude and longitudes of 37.789625 and -122.400811, respectively? Indicate the bike id.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT MIN(T2.duration), T2.bike_id FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T2.start_date LIKE '10/20/2014%' AND T1.lat = 37.789625 AND T1.long = -122.400811
Write SQL query to solve given problem: Among the subscribers who rented a bike from South Van Ness at Market on 12/1/2013, whose duration was the shortest and to which station was the bike returned to? Indicate South Van Ness's dock count.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT MIN(T2.duration), T2.end_station_name, COUNT(T2.start_station_name) FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T2.start_date LIKE '12/1/2013%' AND T2.start_station_name = 'South Van Ness at Market' AND T2.subscription_type = 'Subscriber'
Write SQL query to solve given problem: What is the maximum humidity in Powell Street BART when bike 496 was borrowed from the station on 8/29/2013?. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT T2.max_humidity FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.start_date LIKE '8/29/2013%' AND T1.bike_id = 496 AND T1.start_station_name = 'Powell Street BART'
Write SQL query to solve given problem: Which day in the month of November, 2014 have a foggy weather in the zip code 94301 and in total, how many bikes were borrowed by subscribers from all of the stations in the said day?. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT T2.date, COUNT(T1.start_station_name) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '11/%/2014%' AND T2.zip_code = 94301 AND T2.events = 'Fog' AND T1.subscription_type = 'Subscriber'
Write SQL query to solve given problem: What is the name of the station that is less used by customers who borrow bikes from? Indicate when was the station installed.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT T1.start_station_name, T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.subscription_type = 'Customer' GROUP BY T1.start_station_name ORDER BY COUNT(T1.subscription_type) LIMIT 1
Write SQL query to solve given problem: On 11/3/2013, which stations are often empty? Indicate the names of the stations.. Keep the solution inside sql tag ```sql [SQL-Query] ```
bike_share_1
SELECT DISTINCT T1.name FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T2.bikes_available = 0 AND T2.time LIKE '2013/11/03%'