context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE cookbook (ingredient_id integer, category text, name text, plural text, recipe_id integer, title text, subtitle text, servings integer, yield_unit text, prep_min integer, cook_min integer, stnd_min integer, source text, intro text, directions text, recipe_id integer, protein real, carbo real, alcohol real, total_fat real, sat_fat real, cholestrl real, sodium real, iron real, vitamin_c real, vitamin_a real, fiber real, pcnt_cal_carb real, pcnt_cal_fat real, pcnt_cal_prot real, calories real, quantity_id integer, recipe_id integer, ingredient_id integer, max_qty real, min_qty real, unit text, preparation text, optional text)
List all the ingredients of Apricot Yogurt Parfaits.
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'
bird
CREATE TABLE cookbook (ingredient_id integer, category text, name text, plural text, recipe_id integer, title text, subtitle text, servings integer, yield_unit text, prep_min integer, cook_min integer, stnd_min integer, source text, intro text, directions text, recipe_id integer, protein real, carbo real, alcohol real, total_fat real, sat_fat real, cholestrl real, sodium real, iron real, vitamin_c real, vitamin_a real, fiber real, pcnt_cal_carb real, pcnt_cal_fat real, pcnt_cal_prot real, calories real, quantity_id integer, recipe_id integer, ingredient_id integer, max_qty real, min_qty real, unit text, preparation text, optional text)
Identify recipes with different maximum and minimum quantities.
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
bird
CREATE TABLE cookbook (ingredient_id integer, category text, name text, plural text, recipe_id integer, title text, subtitle text, servings integer, yield_unit text, prep_min integer, cook_min integer, stnd_min integer, source text, intro text, directions text, recipe_id integer, protein real, carbo real, alcohol real, total_fat real, sat_fat real, cholestrl real, sodium real, iron real, vitamin_c real, vitamin_a real, fiber real, pcnt_cal_carb real, pcnt_cal_fat real, pcnt_cal_prot real, calories real, quantity_id integer, recipe_id integer, ingredient_id integer, max_qty real, min_qty real, unit text, preparation text, optional text)
What ingredients does the longest cooking time recipe have?
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
bird
CREATE TABLE cookbook (ingredient_id integer, category text, name text, plural text, recipe_id integer, title text, subtitle text, servings integer, yield_unit text, prep_min integer, cook_min integer, stnd_min integer, source text, intro text, directions text, recipe_id integer, protein real, carbo real, alcohol real, total_fat real, sat_fat real, cholestrl real, sodium real, iron real, vitamin_c real, vitamin_a real, fiber real, pcnt_cal_carb real, pcnt_cal_fat real, pcnt_cal_prot real, calories real, quantity_id integer, recipe_id integer, ingredient_id integer, max_qty real, min_qty real, unit text, preparation text, optional text)
Calculate the percentage of recipes with no cholesterol included and have a cooking time less than 20 minutes among all recipes.
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
bird
CREATE TABLE cookbook (ingredient_id integer, category text, name text, plural text, recipe_id integer, title text, subtitle text, servings integer, yield_unit text, prep_min integer, cook_min integer, stnd_min integer, source text, intro text, directions text, recipe_id integer, protein real, carbo real, alcohol real, total_fat real, sat_fat real, cholestrl real, sodium real, iron real, vitamin_c real, vitamin_a real, fiber real, pcnt_cal_carb real, pcnt_cal_fat real, pcnt_cal_prot real, calories real, quantity_id integer, recipe_id integer, ingredient_id integer, max_qty real, min_qty real, unit text, preparation text, optional text)
Among all recipes containing cheese, what is the percentage of recipes with calories greater than 200?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Which employee has the highest salary? Please give his or her full name.
SELECT firstname, lastname FROM employee ORDER BY salary DESC LIMIT 1
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
How many emplyees have a good job performance?
SELECT COUNT(*) FROM employee WHERE performance = 'Good'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Please list the social security numbers of the male employees with a salary of over $70,000 a year.
SELECT ssn FROM employee WHERE gender = 'M' AND CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) > 70000
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
What is the required education for the position of regional manager?
SELECT educationrequired FROM position WHERE positiontitle = 'Regional Manager'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Which position has a lower minimum salary, Account Representative or Trainee?
SELECT positiontitle FROM position WHERE positiontitle = 'Account Representative' OR positiontitle = 'Trainee' ORDER BY minsalary ASC LIMIT 1
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
In which city's office does Sandy Adams work at?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Among the employees working at the office in New York, how many of them have a good job performance?
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'NY' AND T1.performance = 'Good'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
What is the office phone number of the location at which Sandy Adams works?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
How many male employees work at the address 450 Peachtree Rd?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
How many employees work as an Account Representative?
SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Account Representative'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
How much higher is James Johnson's salary from the minimum salary of his title?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Among the employees who are Trainees, how many of them work in New York?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Please list the full names of the employees who are working as a Trainee.
SELECT T1.firstname, T1.lastname FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Which employee's job position requires a higher education level, Jose Rodriguez or Sandy Adams?
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
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Please list the zip codes of the offices where all the male employees with a good job performance work at.
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Please list the social security numbers of all the employees who work in California.
SELECT T1.ssn FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'CA'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Among the employees who work as a Trainee, how many of them have a salary of over &20,000 a year?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
What is the average salary of the employees who work as a Trainee?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
By what percentage is the average salary of Trainees higher than the minimum salary of this postion?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Give the number of female employees.
SELECT COUNT(*) FROM employee WHERE gender = 'F'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
State the name of the city where Jose Rodriguez works.
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
In which state does Emily Wood work?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
What is the education required for David Whitehead to reach his current position?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
How many employees are there in the "Miami" office?
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.locationcity = 'Miami'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Who is the highest paid employee in "Boston"? Give the full name.
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
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Who is the employee in “New York City” with a good performance? Give the social security number of the employee.
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
How many "account representatives" are there in Chicago with a good performance?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
What is Kenneth Charles's position title?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Give the full address of the office of the highest paid manager.
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
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
What is the max salary for 'Tracy Coulter' if he/she stays on his/her position?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
If Jose Rodriguez tried his best, how many percentage can his salary raise without changing his position?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
How many employees whose performance is poor have a salary of over $50,000 per year?
SELECT COUNT(*) FROM employee WHERE performance = 'Poor' AND CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) > 50000
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Who is the employee with the highest salary? Specify his/her full name.
SELECT firstname, lastname FROM employee WHERE CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) = ( SELECT MAX(CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL)) FROM employee )
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
How many positions have a maximum salary of no more than US$1000,000?
SELECT COUNT(*) FROM position WHERE CAST(REPLACE(SUBSTR(maxsalary, 4), ',', '') AS REAL) < 100000
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
How much is the salary of the first ever employee that was hired?
SELECT salary FROM employee ORDER BY hiredate ASC LIMIT 1
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
How much is the minimum salary given to the position with the most complex work?
SELECT minsalary FROM position ORDER BY educationrequired DESC LIMIT 1
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
What is the full office location address where most of the employees work at?
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
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
What is the average salary of all employees with a 2 year degree position?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
How many male Regional Managers are there?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Which position has the highest amount of poor performing employees?
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
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Which position has the highest number of female employees with a 2 year degree?
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
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
How many Account Representatives are there in Illinois with satisfying performance?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
What is the average salary of the worst performing managers?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
In which state can you find the highest amount of good performing Account Representatives?
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
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Mention the employee's full name and performance status who got the lowest in salary per year.
SELECT firstname, lastname, performance FROM employee ORDER BY salary ASC LIMIT 1
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
List the location cities in the Western states.
SELECT locationcity FROM location WHERE state IN ('CO', 'UT', 'CA')
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Which city and address has zip code of above 90000?
SELECT locationcity, address FROM location WHERE zipcode > 90000
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Which positions are suitable with 4 years degree education?
SELECT positiontitle FROM position WHERE educationrequired = '4 year degree'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
What is the maximum salary of position "Trainer"?
SELECT maxsalary FROM position WHERE positiontitle = 'Trainee'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
List the full name and social security number of the account representative with average performance.
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
When was Emily Wood hired? Mention her position and salary.
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
What are the maximum and minimum salary range and position title of Bill Marlin?
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
List the full names, gender and positions who's location is in New York city.
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Mention the full name, hired date and performance status of the employee whose location is in Utah state.
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Among the employees with poor performance, provide the managers' full names, location city, address and its zip code.
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
What is the education required to be account representative? Mention account representative full name and salary who got poor in performance status.
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Write down the full name, performance status and located city of the employee who's social security number is "767-74-7373".
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Describe the employees' full name, positions, located city and office phone number within Colorado state.
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'
bird
CREATE TABLE human_resources (locationID integer, locationcity text, address text, state text, zipcode integer, officephone text, positionID integer, positiontitle text, educationrequired text, minsalary text, maxsalary text, ssn text, lastname text, firstname text, hiredate text, salary text, gender text, performance text, positionID integer, locationID integer)
Calculate the monthly average salary of the employee with highest salary. Mention his name, position title and location city.
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 )
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
Which trip had the longest duration? State the start and end station.
SELECT start_station_name, end_station_name FROM trip WHERE duration = ( SELECT MAX(duration) FROM trip )
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
What is the percentage of the trip were done by a subscriber?
SELECT CAST(COUNT(subscription_type) AS REAL) * 100 / ( SELECT COUNT(subscription_type) FROM trip ) FROM trip WHERE subscription_type = 'Subscriber'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
State the final station of bike id 13. Which city was it at?
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
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
Name all the trips where the bike was borrowed and returned on a different day. State the city where the bike was returned.
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)
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
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.
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
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
Name the station and city with the most borrowed bike.
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
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
What was the hottest temperature on the day of trip ID 4080?
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
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
At what date and time did San Jose Diridon Caltrain Station have most bikes available.
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' )
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
Name all the trip on the days when it rained. State the duration of the trip
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%'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
List all trips where bikes were returned at location 37.331415, -121.8932. State the date the bike was borrowed.
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
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
Among the trips in August 2013, how many bikes were borrowed from Redwood City.
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'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
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.
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
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
Among all the trips, which day had the most bikes borrowed? What was the average coldest temperature on that day?
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
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
Calculate the average usage of each bike in the third quarter of year 2013. Find the average wind direction within the same period.
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'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
How many bike stations were installed in San Jose in 2014? Indicate the names of the stations.
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'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
What is the longest trip duration that started and ended August 29, 2013?
SELECT MAX(duration) FROM trip WHERE start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
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.
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%'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
On 8/29/2013, who took the longest to arrive in California Ave Caltrain Station from University and Emerson? Indicate the bike id.
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' )
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
How many stations in San Francico can hold more than 20 bikes?
SELECT SUM(CASE WHEN city = 'San Francisco' AND dock_count > 20 THEN 1 ELSE 0 END) FROM station
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
When was the hottest temperature recorded? If there are multiple dates with the hottest temperature, indicate all of the dates.
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 '' )
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
What is the maximum dew point in Fahrenheit degree on 7/15/2014 in the area with a zip code of 94301?
SELECT DISTINCT CASE WHEN date = '7/15/2014' AND zip_code = 94301 THEN max_dew_point_f END FROM weather
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
Which year experienced the most rain?
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
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
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.
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
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
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.
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'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
What is the maximum humidity in Powell Street BART when bike 496 was borrowed from the station on 8/29/2013?
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'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
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?
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'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
What is the name of the station that is less used by customers who borrow bikes from? Indicate when was the station installed.
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
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
On 11/3/2013, which stations are often empty? Indicate the names of the stations.
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%'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
What is the average duration of bike trips in the city of Palo Alto?
SELECT AVG(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'Palo Alto'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
What is the route that has the longest duration? Indicate the city of where the stations are located.
SELECT T1.start_station_name, T1.end_station_name, T2.city FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.duration = ( SELECT MAX(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name )
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
List the name of stations that were installed from 8/5/2013 to 12/31/2013. Indicate their installation date and city name.
SELECT name, installation_date, city FROM station WHERE (SUBSTR(CAST(installation_date AS TEXT), 1, INSTR(installation_date, '/') - 1) = '5' AND SUBSTR(CAST(installation_date AS TEXT), INSTR(installation_date, '/') + 1, -6) >= '8' AND SUBSTR(CAST(installation_date AS TEXT), -4) = '2013') OR (SUBSTR(CAST(installation_date AS TEXT), 1, INSTR(installation_date, '/') - 1) IN ( '6', '7', '8', '9', '10', '11', '12' ) AND SUBSTR(CAST(installation_date AS TEXT), -4) = '2013')
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
What is the average duration of trips which are started at Adobe on Almaden station to Ryland Park?
SELECT AVG(duration) FROM trip WHERE start_station_name = 'Adobe on Almaden' AND end_station_name = 'Ryland Park'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
Write down the times when there is no available bike to borrow in a station. List down the stations name and location coordinate.
SELECT T2.time, T1.name, T1.lat, T1.long FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T2.bikes_available = 0
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
List down the trips in which their start and end station are similar. Give me their trip IDs and location coordinates.
SELECT T1.id, T2.lat, T2.long FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.start_station_name = T1.end_station_name
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
On 8/29/2013 at 6:14:01 PM, how many bikes were borrowed from San Jose Diridon Caltrain Station?
SELECT SUM(T1.dock_count - T2.bikes_available) FROM station AS T1 INNER JOIN status AS T2 ON T1.id = T2.station_id WHERE T1.name = 'San Jose Diridon Caltrain Station' AND T2.time = '2013/08/29 06:14:01'
bird
CREATE TABLE bike_share_1 (id integer, name text, lat real, long real, dock_count integer, city text, installation_date text, station_id integer, bikes_available integer, docks_available integer, time text, id integer, duration integer, start_date text, start_station_name text, start_station_id integer, end_date text, end_station_name text, end_station_id integer, bike_id integer, subscription_type text, zip_code integer, date text, max_temperature_f integer, mean_temperature_f integer, min_temperature_f integer, max_dew_point_f integer, mean_dew_point_f integer, min_dew_point_f integer, max_humidity integer, mean_humidity integer, min_humidity integer, max_sea_level_pressure_inches real, mean_sea_level_pressure_inches real, min_sea_level_pressure_inches real, max_visibility_miles integer, mean_visibility_miles integer, min_visibility_miles integer, max_wind_Speed_mph integer, mean_wind_speed_mph integer, max_gust_speed_mph integer, precipitation_inches text, cloud_cover integer, events text, wind_dir_degrees integer, zip_code text)
List down the trip IDs when bike no. 10 was used by subscribers and the weather's mean temperature is no less than 62 degress Fahrenheit.
SELECT T1.id FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.bike_id = 10 AND T2.mean_temperature_f > 62 AND T1.subscription_type = 'Subscriber'
bird