db_id
stringclasses
69 values
question
stringlengths
24
325
evidence
stringlengths
1
673
SQL
stringlengths
23
804
schema
stringclasses
69 values
cookbook
How many servings does the recipe with the highest unsaturated fat have?
with the highest unsaturated fat refers MAX(SUBTRACT(total_fat, sat_fat))
SELECT COUNT(T1.title) FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.total_fat - T2.sat_fat DESC LIMIT 1
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Among the recipes whose source is the National Potato Board, which recipe has the highest calories?
the National Potato Board is a source; the highest calories refers to MAX(calories)
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.source = 'National Potato Board' ORDER BY T2.calories DESC LIMIT 1
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Which recipe has the highest number of ingredients? Calculate the said recipe's total time of cooking.
the highest number of ingredients refers to MAX(ingredient_id); total time refers to recipe_id, total time of cooking refers to TOTAL(prep_min, cook_min, stnd_min)
SELECT T2.recipe_id, T1.prep_min + T1.cook_min + T1.stnd_min FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id GROUP BY T2.recipe_id ORDER BY COUNT(T2.ingredient_id) DESC LIMIT 1
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Which ingredient appeared the most in recipes? Calculate its amount of appearance in percentage.
ingredient appeared the most in recipes refers to MAX(COUNT(ingredient_id)); calculation = MULTIPLY(DIVIDE(COUNT(MAX(ingredient_id)), COUNT(ingredient_id)), 100)
SELECT T1.name, CAST(COUNT(T2.ingredient_id) AS FLOAT) * 100 / ( SELECT COUNT(T2.ingredient_id) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T2.ingredient_id = T1.ingredient_id ) AS "percentage" FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T2.ingredient_id = T1.ingredient_id GROUP BY T2.ingredient_id ORDER BY COUNT(T2.ingredient_id) DESC LIMIT 1
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Provide the title and total time of the recipe which has the highest possibility of gaining weight.
the highest possibility of gaining weight refers to MAX(total_fat); total time refers to recipe_id, total time refers to TOTAL(prep_min, cook_min, stnd_min)
SELECT T1.title, T1.prep_min + T1.cook_min + T1.stnd_min FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.total_fat DESC LIMIT 1
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Which recipes contain almond extract?
almond extract is a name of an ingredient
SELECT T1.title 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.name = 'almond extract'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
List the ingredients in Tomato-Cucumber Relish.
Tomato-Cucumber Relish refers to title
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 WHERE T1.title = 'Tomato-Cucumber Relish'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
How many ingredients are needed to prepare Idaho Potato Supreme?
Idaho Potato Supreme refers to title
SELECT COUNT(*) FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Idaho Potato Supreme'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Provide the ingredients that are rationed in the recipe with the highest carbohydrate content.
the highest carbohydrate content refers to MAX(carbo)
SELECT T1.name FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id INNER JOIN Nutrition AS T3 ON T3.recipe_id = T2.recipe_id WHERE T2.max_qty = T2.min_qty ORDER BY T3.carbo DESC LIMIT 1
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Name the recipes which can lead to constipation.
can lead to constipation refers to iron > 20
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.iron > 20
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Describe the ingredients in the recipe with the highest vitamin that helps vision in dim light.
the highest vitamin that helps vision in dim light refers to MAX(vitamin_a)
SELECT T1.name FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id INNER JOIN Nutrition AS T3 ON T3.recipe_id = T2.recipe_id ORDER BY T3.vitamin_a DESC LIMIT 1
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Provide the ingredients and maximum quantities of the recipe which can serve 7 people.
can serve 7 people refers to servings = 7
SELECT T3.name, T2.max_qty 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.servings = 7
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Among the recipes from The California Tree Fruit Agreement, calculate the percentage of sodium-free recipes.
The California Tree Fruit Agreement is a source; calculation = MULTIPLY(DIVIDE(COUNT(sodium BETWEEN 0 AND 5 THEN recipe_id), COUNT(recipe_id)), 100)
SELECT CAST(SUM(CASE WHEN T2.sodium < 5 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 WHERE T1.source = 'The California Tree Fruit Agreement'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
List the ingredients which measure in slices.
slices refers to unit = 'slice(s)'
SELECT T1.name FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T2.unit = 'slice(s)'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
How many recipes can be made with canned dairy?
canned dairy is a category
SELECT COUNT(*) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T1.category = 'canned dairy'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Provide the title and total time of the recipe which can be made with only lima beans.
total time refers to total time refers to TOTAL(prep_min, cook_min, stnd_min); lima beans is a name of an ingredient
SELECT T1.title, T1.prep_min + T1.cook_min + T1.stnd_min 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.name = 'lima beans'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Among the recipes with sea bass, how many percent of recipes can serve 10 people and above?
sea bass is a name of an ingredient; can serve 10 people and above refers to servings > = 10; calculation = MULTIPLY(DIVIDE(COUNT(servings > = 10 THEN recipe_id)), COUNT(recipe_id), 100)
SELECT CAST(SUM(CASE WHEN T1.servings >= 10 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 WHERE T3.name = 'sea bass steak'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
How much fat does the Raspberry Chiffon Pie have?
Raspberry Chiffon Pie refers to title
SELECT T2.total_fat FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Raspberry Chiffon Pie'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
What is the percentage calories protein of Raspberry Chiffon Pie?
Raspberry Chiffon Pie refers title; percentage calories protein refers to pcnt_cal_prot
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'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
How many ingredients are required to make the Raspberry Chiffon Pie?
Raspberry Chiffon Pie refer to title
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'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
List the names of alcohol free recipes.
alcohol free refers to alcohol = 0
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.alcohol = 0
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
What is the average vitamin C amount of all cakes?
average vitamin C refers to AVG(vitamin_c); all cakes refers to title LIKE '%cake%'
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%'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
How many dairy recipes can serve more than 10 people?
dairy recipes refers to category = 'dairy'; serve more than 10 people refers to servings > 10
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
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
List the names of recipes that can lead to constipation.
lead to constipation refers to iron > 20
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.iron > 20
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Which recipe has the highest calories?
the highest calories refers to MAX(calories)
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
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
How many recipes are non-dairy?
non-dairy refers to category NOT LIKE '%dairy"
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%'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
List all the ingredients of Apricot Yogurt Parfaits.
Apricot Yogurt Parfaits refers to title
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'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Identify recipes with different maximum and minimum quantities.
maximum quantities refers to max_qty; minimum quantities refers to max_qty <> min_qty
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
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
What ingredients does the longest cooking time recipe have?
the longest cooking time refers to MAX(cook_min)
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
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Calculate the percentage of recipes with no cholesterol included and have a cooking time less than 20 minutes among all recipes.
no cholesterol refers to cholestrl = 0; cooking time less than 20 minutes refers to cook_min < 20; calculation = MULTIPLY(DIVIDE(COUNT(cholestrl = 0 THEN recipe_id), COUNT(recipe_id)), 100)
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
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
cookbook
Among all recipes containing cheese, what is the percentage of recipes with calories greater than 200?
cheese is a category; calories greater than 200 refers to calories > 200; calculation = MULTIPLY(DIVIDE(COUNT(calories > 200 THEN recipe_id), COUNT(recipe_id)), 100)
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'
database name:db_id cookbook Ingredient table Ingredient Cols: ingredient id dtype integer, category dtype text, name dtype text, plural dtype text, Recipe table Recipe Cols: recipe id dtype integer, title dtype text, subtitle dtype text, servings dtype integer, yield unit dtype text, preparation minute dtype integer, cooked minute dtype integer, stand minute dtype integer, source dtype text, introduction dtype text, directions dtype text, Nutrition table Nutrition Cols: recipe id dtype integer, protein dtype real, carbo dtype real, alcohol dtype real, total fat dtype real, saturated fat dtype real, cholesterol dtype real, sodium dtype real, iron dtype real, vitamin c dtype real, vitamin a dtype real, fiber dtype real, percentage calculation carbo dtype real, percentage calculation fat dtype real, percentage calculation protein dtype real, calories dtype real, Quantity table Quantity Cols: quantity id dtype integer, recipe id dtype integer, ingredient id dtype integer, maximum quantity dtype real, minimum quantity dtype real, unit dtype text, preparation dtype text, optional dtype text,
human_resources
Which employee has the highest salary? Please give his or her full name.
the highest salary refers to MAX(salary); full name = firstname, lastname
SELECT firstname, lastname FROM employee ORDER BY salary DESC LIMIT 1
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
How many emplyees have a good job performance?
good job performance refers to performance = 'Good'
SELECT COUNT(*) FROM employee WHERE performance = 'Good'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Please list the social security numbers of the male employees with a salary of over $70,000 a year.
social security numbers refers to ssn; male employees refers to gender = 'M'; salary of over $70,000 a year refers to salary > '70000'
SELECT ssn FROM employee WHERE gender = 'M' AND CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) > 70000
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
What is the required education for the position of regional manager?
required education refers to educationrequired; position of regional manager refers to  positiontitle = 'Regional Manager'
SELECT educationrequired FROM position WHERE positiontitle = 'Regional Manager'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Which position has a lower minimum salary, Account Representative or Trainee?
position of Account Representative refers to positiontitle = 'Account Representative'; position of Trainee refers to positiontitle = 'Trainee'; lower minimum salary refers to MIN(minsalary)
SELECT positiontitle FROM position WHERE positiontitle = 'Account Representative' OR positiontitle = 'Trainee' ORDER BY minsalary ASC LIMIT 1
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
In which city's office does Sandy Adams work at?
Sandy Adams is the fullname of an employee; full name = firstname, lastname; city refers to locationcity
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Among the employees working at the office in New York, how many of them have a good job performance?
Sandy Adams is the fullname of an employee; full name = firstname, lastname; New York refers to state = 'NY'; good job performance refers to performance = 'Good';
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'NY' AND T1.performance = 'Good'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
What is the office phone number of the location at which Sandy Adams works?
Sandy Adams is the fullname of an employee; full name = firstname, lastname;
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
How many male employees work at the address 450 Peachtree Rd?
male employees refers to gender = 'M'
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
How many employees work as an Account Representative?
work as an Account Representative refers to positiontitle = 'Account Representative'
SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Account Representative'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
How much higher is James Johnson's salary from the minimum salary of his title?
James Johnson is the fullname of an employee; full name = firstname, lastname; minimum salary refers to minsalary; calculation = SUBTRACT(salary, minsalary)
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Among the employees who are Trainees, how many of them work in New York?
Trainees is a position title; California refers to state = 'NY'
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Please list the full names of the employees who are working as a Trainee.
full name = firstname, lastname; trainees is a position title
SELECT T1.firstname, T1.lastname FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Which employee's job position requires a higher education level, Jose Rodriguez or Sandy Adams?
Jose Rodriguez AND Sandy Adams are the fullname of employee; full name = firstname, lastname; higher education level refers to MAX(educationrequired)
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
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Please list the zip codes of the offices where all the male employees with a good job performance work at.
male employees refers to gender = 'M'; good job performance refers to performance = 'Good'
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Please list the social security numbers of all the employees who work in California.
social security numbers refers to ssn; California refers to state = 'CA'
SELECT T1.ssn FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'CA'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Among the employees who work as a Trainee, how many of them have a salary of over &20,000 a year?
Trainee is a position title; salary of over 20,000 refers to salary > '20000'
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
What is the average salary of the employees who work as a Trainee?
average = DIVIDE( SUM(salary), COUNT(positiontitle) where positiontitle = 'Trainee'; Trainee is a position title
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
By what percentage is the average salary of Trainees higher than the minimum salary of this postion?
AVG(salary); Trainee is a position title; minimum salary refers to minsalary; calculation = DIVIDE(SUBTRACT(AVG(salary), minsalary), minsalary) * 100
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Give the number of female employees.
number of female employees means COUNT(gender = 'F')
SELECT COUNT(*) FROM employee WHERE gender = 'F'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
State the name of the city where Jose Rodriguez works.
Jose Rodriguez is the fullname of an employee; full name = firstname, lastname; name of city refers to locationcity
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
In which state does Emily Wood work?
Emily Wood is the full name of an employee; full name = firstname, lastname;
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
What is the education required for David Whitehead to reach his current position?
David Whitehead is the full name of an employee; full name = firstname, lastname
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
How many employees are there in the "Miami" office?
Miami office refers to locationcity = 'Miami'
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.locationcity = 'Miami'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Who is the highest paid employee in "Boston"? Give the full name.
Boston refers to locationcity = 'Boston'; the highest paid employee refers to MAX(salary); full name = firstname, lastname
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
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Who is the employee in “New York City” with a good performance? Give the social security number of the employee.
New York City refers to locationcity = 'New York City'; good performance refers to performance = 'Good'; social security number refers to ssn
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
How many "account representatives" are there in Chicago with a good performance?
account representatives is a position title; Chicago refers to locationcity = 'Chicago'; good performance refers to performance = 'Good'
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
What is Kenneth Charles's position title?
Kenneth Charles is the full name of an employee; full name = firstname, lastname
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Give the full address of the office of the highest paid manager.
the highest paid refers to MAX(salary); manager is a position title
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
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
What is the max salary for 'Tracy Coulter' if he/she stays on his/her position?
Tracy Coulter is the full name of an employee; full name = firstname, lastname
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
If Jose Rodriguez tried his best, how many percentage can his salary raise without changing his position?
Jose Rodriguez is the full name of an employee; full name = firstname, lastname; calculation = DIVIDE(SUBTRACT(maxsalary, salary), salary) * 100
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
How many employees whose performance is poor have a salary of over $50,000 per year?
performance is poor refers to performance = 'Poor'; salary of over $50,000 refers to salary > '50000'
SELECT COUNT(*) FROM employee WHERE performance = 'Poor' AND CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) > 50000
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Who is the employee with the highest salary? Specify his/her full name.
the highest salary refers to MAX(salary); full name = firstname, lastname
SELECT firstname, lastname FROM employee WHERE CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) = ( SELECT MAX(CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL)) FROM employee )
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
How many positions have a maximum salary of no more than US$1000,000?
maximum salary of no more than US$1000,000 refers to maxsalary < '100000';
SELECT COUNT(*) FROM position WHERE CAST(REPLACE(SUBSTR(maxsalary, 4), ',', '') AS REAL) < 100000
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
How much is the salary of the first ever employee that was hired?
first-ever employee that was hired refers to MIN(hiredate)
SELECT salary FROM employee ORDER BY hiredate ASC LIMIT 1
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
How much is the minimum salary given to the position with the most complex work?
most complex work refers to MAX(educationrequired); minimum salary refers to minsalary
SELECT minsalary FROM position ORDER BY educationrequired DESC LIMIT 1
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
What is the full office location address where most of the employees work at?
full office location address = address, locationcity, state, zipcode; location where most employees work at refers to MAX(locationID)
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
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
What is the average salary of all employees with a 2 year degree position?
2 year degree refers to educationrequired = '2 year degree'; calculation = DIVIDE(SUM(salary), COUNT(positiontitle))
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
How many male Regional Managers are there?
male refers to gender = 'M'; Regional Managers is a position title
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Which position has the highest amount of poor performing employees?
poor performing employees refers to performance = 'Poor'; the highest amount of employees refers to MAX(positiontitle)
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
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Which position has the highest number of female employees with a 2 year degree?
2 year degree refers to educationrequired = '2 year degree'; female refers to gender = 'F'; the highest number of employees refers to MAX(positionID)
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
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
How many Account Representatives are there in Illinois with satisfying performance?
Account Representatives is a position title; satisfying performance mostly refers togood 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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
What is the average salary of the worst performing managers?
the worst performing refers to performance = 'Poor'; manager is a positiontitle; average salary refers to AVG(salary)
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
In which state can you find the highest amount of good performing Account Representatives?
good performing refers to performance = 'Good'; Account Representatives is a positiontitle; highest amount of employee refers to MAX(positionID);
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
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Mention the employee's full name and performance status who got the lowest in salary per year.
full name = firstname, lastname; the lowest salary refers to MIN(salary)
SELECT firstname, lastname, performance FROM employee ORDER BY salary ASC LIMIT 1
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
List the location cities in the Western states.
Western states refers to state = 'CO' OR state = 'UT' OR state = 'CA'; location cities refers to locationcity
SELECT locationcity FROM location WHERE state IN ('CO', 'UT', 'CA')
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Which city and address has zip code of above 90000?
zip code of above 90000 refers to zipcode > 90000; city refers to locationcity
SELECT locationcity, address FROM location WHERE zipcode > 90000
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Which positions are suitable with 4 years degree education?
4 years degree education refers to educationrequired = '4 year degree'; positions refers to positiontitle
SELECT positiontitle FROM position WHERE educationrequired = '4 year degree'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
What is the maximum salary of position "Trainer"?
maximum salary refers to maxsalary; Trainee is a positiontitle
SELECT maxsalary FROM position WHERE positiontitle = 'Trainee'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
List the full name and social security number of the account representative with average performance.
full name = firstname, lastname; social security number refers to ssn; account representative is a position title; average performance refers to performance = 'Average'
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
When was Emily Wood hired? Mention her position and salary.
Emily Wood is the full name of an employee; full name = firstname, lastname; when was she hired refers to hiredate
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
What are the maximum and minimum salary range and position title of Bill Marlin?
Bill Marlin is the full name of an employee; full name = firstname, lastname; maximum salary refers to maxsalary; minimum salary refers to minsalary
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
List the full names, gender and positions who's location is in New York city.
full name = firstname, lastname; New York city refers to locationcity = '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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Mention the full name, hired date and performance status of the employee whose location is in Utah state.
full name = firstname, lastname; Utah refers to state = 'UT'
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Among the employees with poor performance, provide the managers' full names, location city, address and its zip code.
poor performance refers to performance = 'Poor'; full name = firstname, lastname; managers is a position title
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
What is the education required to be account representative? Mention account representative full name and salary who got poor in performance status.
account representative is a position title; full name = firstname, lastname; poor performance refers to performance = 'Poor'
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Write down the full name, performance status and located city of the employee who's social security number is "767-74-7373".
full name = firstname, lastname; ssn = '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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Describe the employees' full name, positions, located city and office phone number within Colorado state.
full name = firstname, lastname; Colorado state refers to state = 'CO'; positions refers to positiontitle; located city refers to locationcity; office phone number refers to officephone;
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'
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
human_resources
Calculate the monthly average salary of the employee with highest salary. Mention his name, position title and location city.
highest salary refers to MAX(salary); name = firstname, lastname; calculation = DIVIDE(MAX(salary), 12)
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 )
database name:db_id human_resources location table location Cols: location id dtype integer, location city dtype text, address dtype text, state dtype text, zip code dtype integer, office phone dtype text, position table position Cols: position id dtype integer, position title dtype text, education required dtype text, minimum salary dtype text, maximum salary dtype text, employee table employee Cols: social security number dtype text, last name dtype text, first name dtype text, hire date dtype text, salary dtype text, gender dtype text, performance dtype text, position id dtype integer, location id dtype integer,
bike_share_1
Which trip had the longest duration? State the start and end station.
start station refers to start_station_name; end station refers to end_station_name;
SELECT start_station_name, end_station_name FROM trip WHERE duration = ( SELECT MAX(duration) FROM trip )
database name:db_id bike_share_1 station table station Cols: id dtype integer, name dtype text, latitude dtype real, longitude dtype real, dock count dtype integer, city dtype text, installation date dtype text, status table status Cols: station id dtype integer, bikes_available dtype integer, docks_available dtype integer, time dtype text, trip table trip Cols: id dtype integer, duration dtype integer, start date dtype text, start station name dtype text, start station id dtype integer, end date dtype text, end station name dtype text, end station id dtype integer, bike id dtype integer, subscription type dtype text, zip code dtype integer, weather table weather Cols: date dtype text, max temperature in Fahrenheit degree dtype integer, mean temperature in Fahrenheit degree dtype integer, min temperature in Fahrenheit degree dtype integer, max dew point in Fahrenheit degree dtype integer, mean dew point in Fahrenheit degree dtype integer, min dew point in Fahrenheit degree dtype integer, max humidity dtype integer, mean humidity dtype integer, min humidity dtype integer, max sea level pressure in inches dtype real, mean sea level pressure in inches dtype real, min sea level pressure in inches dtype real, max visibility in miles dtype integer, mean visibility in miles dtype integer, min visibility in miles dtype integer, max wind Speed in mph dtype integer, mean wind Speed in mph dtype integer, max gust Speed in mph dtype integer, precipitation in inches dtype text, cloud cover dtype integer, events dtype text, wind direction degrees dtype integer, zip code dtype text,
bike_share_1
What is the percentage of the trip were done by a subscriber?
subscription_type = 'Subscriber'; DIVIDE(COUNT(id where subscription_type = 'Subscriber'), COUNT(id)) as percentage;
SELECT CAST(COUNT(subscription_type) AS REAL) * 100 / ( SELECT COUNT(subscription_type) FROM trip ) FROM trip WHERE subscription_type = 'Subscriber'
database name:db_id bike_share_1 station table station Cols: id dtype integer, name dtype text, latitude dtype real, longitude dtype real, dock count dtype integer, city dtype text, installation date dtype text, status table status Cols: station id dtype integer, bikes_available dtype integer, docks_available dtype integer, time dtype text, trip table trip Cols: id dtype integer, duration dtype integer, start date dtype text, start station name dtype text, start station id dtype integer, end date dtype text, end station name dtype text, end station id dtype integer, bike id dtype integer, subscription type dtype text, zip code dtype integer, weather table weather Cols: date dtype text, max temperature in Fahrenheit degree dtype integer, mean temperature in Fahrenheit degree dtype integer, min temperature in Fahrenheit degree dtype integer, max dew point in Fahrenheit degree dtype integer, mean dew point in Fahrenheit degree dtype integer, min dew point in Fahrenheit degree dtype integer, max humidity dtype integer, mean humidity dtype integer, min humidity dtype integer, max sea level pressure in inches dtype real, mean sea level pressure in inches dtype real, min sea level pressure in inches dtype real, max visibility in miles dtype integer, mean visibility in miles dtype integer, min visibility in miles dtype integer, max wind Speed in mph dtype integer, mean wind Speed in mph dtype integer, max gust Speed in mph dtype integer, precipitation in inches dtype text, cloud cover dtype integer, events dtype text, wind direction degrees dtype integer, zip code dtype text,
bike_share_1
State the final station of bike id 13. Which city was it at?
final station refers to end_station_name where MAX(end_date);
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
database name:db_id bike_share_1 station table station Cols: id dtype integer, name dtype text, latitude dtype real, longitude dtype real, dock count dtype integer, city dtype text, installation date dtype text, status table status Cols: station id dtype integer, bikes_available dtype integer, docks_available dtype integer, time dtype text, trip table trip Cols: id dtype integer, duration dtype integer, start date dtype text, start station name dtype text, start station id dtype integer, end date dtype text, end station name dtype text, end station id dtype integer, bike id dtype integer, subscription type dtype text, zip code dtype integer, weather table weather Cols: date dtype text, max temperature in Fahrenheit degree dtype integer, mean temperature in Fahrenheit degree dtype integer, min temperature in Fahrenheit degree dtype integer, max dew point in Fahrenheit degree dtype integer, mean dew point in Fahrenheit degree dtype integer, min dew point in Fahrenheit degree dtype integer, max humidity dtype integer, mean humidity dtype integer, min humidity dtype integer, max sea level pressure in inches dtype real, mean sea level pressure in inches dtype real, min sea level pressure in inches dtype real, max visibility in miles dtype integer, mean visibility in miles dtype integer, min visibility in miles dtype integer, max wind Speed in mph dtype integer, mean wind Speed in mph dtype integer, max gust Speed in mph dtype integer, precipitation in inches dtype text, cloud cover dtype integer, events dtype text, wind direction degrees dtype integer, zip code dtype text,
bike_share_1
Name all the trips where the bike was borrowed and returned on a different day. State the city where the bike was returned.
the bike was borrowed and returned on a different day implies that start_date and end_date are not equal to each other; where the bike was returned refers to end_station_name;
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)
database name:db_id bike_share_1 station table station Cols: id dtype integer, name dtype text, latitude dtype real, longitude dtype real, dock count dtype integer, city dtype text, installation date dtype text, status table status Cols: station id dtype integer, bikes_available dtype integer, docks_available dtype integer, time dtype text, trip table trip Cols: id dtype integer, duration dtype integer, start date dtype text, start station name dtype text, start station id dtype integer, end date dtype text, end station name dtype text, end station id dtype integer, bike id dtype integer, subscription type dtype text, zip code dtype integer, weather table weather Cols: date dtype text, max temperature in Fahrenheit degree dtype integer, mean temperature in Fahrenheit degree dtype integer, min temperature in Fahrenheit degree dtype integer, max dew point in Fahrenheit degree dtype integer, mean dew point in Fahrenheit degree dtype integer, min dew point in Fahrenheit degree dtype integer, max humidity dtype integer, mean humidity dtype integer, min humidity dtype integer, max sea level pressure in inches dtype real, mean sea level pressure in inches dtype real, min sea level pressure in inches dtype real, max visibility in miles dtype integer, mean visibility in miles dtype integer, min visibility in miles dtype integer, max wind Speed in mph dtype integer, mean wind Speed in mph dtype integer, max gust Speed in mph dtype integer, precipitation in inches dtype text, cloud cover dtype integer, events dtype text, wind direction degrees dtype integer, zip code dtype text,
bike_share_1
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.
Latitude and longitude coordinates can be used to indicate a location, where latitude refers to lat longtitude refer to long; bikes_available = 0 means no bike can be borrowed; 3/11/2013 02:01:01 refers to time;
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
database name:db_id bike_share_1 station table station Cols: id dtype integer, name dtype text, latitude dtype real, longitude dtype real, dock count dtype integer, city dtype text, installation date dtype text, status table status Cols: station id dtype integer, bikes_available dtype integer, docks_available dtype integer, time dtype text, trip table trip Cols: id dtype integer, duration dtype integer, start date dtype text, start station name dtype text, start station id dtype integer, end date dtype text, end station name dtype text, end station id dtype integer, bike id dtype integer, subscription type dtype text, zip code dtype integer, weather table weather Cols: date dtype text, max temperature in Fahrenheit degree dtype integer, mean temperature in Fahrenheit degree dtype integer, min temperature in Fahrenheit degree dtype integer, max dew point in Fahrenheit degree dtype integer, mean dew point in Fahrenheit degree dtype integer, min dew point in Fahrenheit degree dtype integer, max humidity dtype integer, mean humidity dtype integer, min humidity dtype integer, max sea level pressure in inches dtype real, mean sea level pressure in inches dtype real, min sea level pressure in inches dtype real, max visibility in miles dtype integer, mean visibility in miles dtype integer, min visibility in miles dtype integer, max wind Speed in mph dtype integer, mean wind Speed in mph dtype integer, max gust Speed in mph dtype integer, precipitation in inches dtype text, cloud cover dtype integer, events dtype text, wind direction degrees dtype integer, zip code dtype text,
bike_share_1
Name the station and city with the most borrowed bike.
the station with the most borrowed bikes refers to MAX(start_station);
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
database name:db_id bike_share_1 station table station Cols: id dtype integer, name dtype text, latitude dtype real, longitude dtype real, dock count dtype integer, city dtype text, installation date dtype text, status table status Cols: station id dtype integer, bikes_available dtype integer, docks_available dtype integer, time dtype text, trip table trip Cols: id dtype integer, duration dtype integer, start date dtype text, start station name dtype text, start station id dtype integer, end date dtype text, end station name dtype text, end station id dtype integer, bike id dtype integer, subscription type dtype text, zip code dtype integer, weather table weather Cols: date dtype text, max temperature in Fahrenheit degree dtype integer, mean temperature in Fahrenheit degree dtype integer, min temperature in Fahrenheit degree dtype integer, max dew point in Fahrenheit degree dtype integer, mean dew point in Fahrenheit degree dtype integer, min dew point in Fahrenheit degree dtype integer, max humidity dtype integer, mean humidity dtype integer, min humidity dtype integer, max sea level pressure in inches dtype real, mean sea level pressure in inches dtype real, min sea level pressure in inches dtype real, max visibility in miles dtype integer, mean visibility in miles dtype integer, min visibility in miles dtype integer, max wind Speed in mph dtype integer, mean wind Speed in mph dtype integer, max gust Speed in mph dtype integer, precipitation in inches dtype text, cloud cover dtype integer, events dtype text, wind direction degrees dtype integer, zip code dtype text,
bike_share_1
What was the hottest temperature on the day of trip ID 4080?
the hottest temperature refers to max_temperature_f;
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
database name:db_id bike_share_1 station table station Cols: id dtype integer, name dtype text, latitude dtype real, longitude dtype real, dock count dtype integer, city dtype text, installation date dtype text, status table status Cols: station id dtype integer, bikes_available dtype integer, docks_available dtype integer, time dtype text, trip table trip Cols: id dtype integer, duration dtype integer, start date dtype text, start station name dtype text, start station id dtype integer, end date dtype text, end station name dtype text, end station id dtype integer, bike id dtype integer, subscription type dtype text, zip code dtype integer, weather table weather Cols: date dtype text, max temperature in Fahrenheit degree dtype integer, mean temperature in Fahrenheit degree dtype integer, min temperature in Fahrenheit degree dtype integer, max dew point in Fahrenheit degree dtype integer, mean dew point in Fahrenheit degree dtype integer, min dew point in Fahrenheit degree dtype integer, max humidity dtype integer, mean humidity dtype integer, min humidity dtype integer, max sea level pressure in inches dtype real, mean sea level pressure in inches dtype real, min sea level pressure in inches dtype real, max visibility in miles dtype integer, mean visibility in miles dtype integer, min visibility in miles dtype integer, max wind Speed in mph dtype integer, mean wind Speed in mph dtype integer, max gust Speed in mph dtype integer, precipitation in inches dtype text, cloud cover dtype integer, events dtype text, wind direction degrees dtype integer, zip code dtype text,
bike_share_1
At what date and time did San Jose Diridon Caltrain Station have most bikes available.
San Jose Diridon Caltrain Station is the name of the station; most bikes available refers to MAX(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' )
database name:db_id bike_share_1 station table station Cols: id dtype integer, name dtype text, latitude dtype real, longitude dtype real, dock count dtype integer, city dtype text, installation date dtype text, status table status Cols: station id dtype integer, bikes_available dtype integer, docks_available dtype integer, time dtype text, trip table trip Cols: id dtype integer, duration dtype integer, start date dtype text, start station name dtype text, start station id dtype integer, end date dtype text, end station name dtype text, end station id dtype integer, bike id dtype integer, subscription type dtype text, zip code dtype integer, weather table weather Cols: date dtype text, max temperature in Fahrenheit degree dtype integer, mean temperature in Fahrenheit degree dtype integer, min temperature in Fahrenheit degree dtype integer, max dew point in Fahrenheit degree dtype integer, mean dew point in Fahrenheit degree dtype integer, min dew point in Fahrenheit degree dtype integer, max humidity dtype integer, mean humidity dtype integer, min humidity dtype integer, max sea level pressure in inches dtype real, mean sea level pressure in inches dtype real, min sea level pressure in inches dtype real, max visibility in miles dtype integer, mean visibility in miles dtype integer, min visibility in miles dtype integer, max wind Speed in mph dtype integer, mean wind Speed in mph dtype integer, max gust Speed in mph dtype integer, precipitation in inches dtype text, cloud cover dtype integer, events dtype text, wind direction degrees dtype integer, zip code dtype text,
bike_share_1
Name all the trip on the days when it rained. State the duration of the trip
events = 'Rain';
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%'
database name:db_id bike_share_1 station table station Cols: id dtype integer, name dtype text, latitude dtype real, longitude dtype real, dock count dtype integer, city dtype text, installation date dtype text, status table status Cols: station id dtype integer, bikes_available dtype integer, docks_available dtype integer, time dtype text, trip table trip Cols: id dtype integer, duration dtype integer, start date dtype text, start station name dtype text, start station id dtype integer, end date dtype text, end station name dtype text, end station id dtype integer, bike id dtype integer, subscription type dtype text, zip code dtype integer, weather table weather Cols: date dtype text, max temperature in Fahrenheit degree dtype integer, mean temperature in Fahrenheit degree dtype integer, min temperature in Fahrenheit degree dtype integer, max dew point in Fahrenheit degree dtype integer, mean dew point in Fahrenheit degree dtype integer, min dew point in Fahrenheit degree dtype integer, max humidity dtype integer, mean humidity dtype integer, min humidity dtype integer, max sea level pressure in inches dtype real, mean sea level pressure in inches dtype real, min sea level pressure in inches dtype real, max visibility in miles dtype integer, mean visibility in miles dtype integer, min visibility in miles dtype integer, max wind Speed in mph dtype integer, mean wind Speed in mph dtype integer, max gust Speed in mph dtype integer, precipitation in inches dtype text, cloud cover dtype integer, events dtype text, wind direction degrees dtype integer, zip code dtype text,
bike_share_1
List all trips where bikes were returned at location 37.331415, -121.8932. State the date the bike was borrowed.
37.331415 and -121.8932 are latitude (lat) and longitude (long) coordinates indicating location; returned at refers to end_station_name; the date the bike was borrowed refers to start_date;
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
database name:db_id bike_share_1 station table station Cols: id dtype integer, name dtype text, latitude dtype real, longitude dtype real, dock count dtype integer, city dtype text, installation date dtype text, status table status Cols: station id dtype integer, bikes_available dtype integer, docks_available dtype integer, time dtype text, trip table trip Cols: id dtype integer, duration dtype integer, start date dtype text, start station name dtype text, start station id dtype integer, end date dtype text, end station name dtype text, end station id dtype integer, bike id dtype integer, subscription type dtype text, zip code dtype integer, weather table weather Cols: date dtype text, max temperature in Fahrenheit degree dtype integer, mean temperature in Fahrenheit degree dtype integer, min temperature in Fahrenheit degree dtype integer, max dew point in Fahrenheit degree dtype integer, mean dew point in Fahrenheit degree dtype integer, min dew point in Fahrenheit degree dtype integer, max humidity dtype integer, mean humidity dtype integer, min humidity dtype integer, max sea level pressure in inches dtype real, mean sea level pressure in inches dtype real, min sea level pressure in inches dtype real, max visibility in miles dtype integer, mean visibility in miles dtype integer, min visibility in miles dtype integer, max wind Speed in mph dtype integer, mean wind Speed in mph dtype integer, max gust Speed in mph dtype integer, precipitation in inches dtype text, cloud cover dtype integer, events dtype text, wind direction degrees dtype integer, zip code dtype text,