input
stringlengths
236
16.9k
output
stringlengths
19
805
-- Database schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- How many servings does the recipe with the highest unsaturated fat have?
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Among the recipes whose source is the National Potato Board, which recipe has the highest 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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Which recipe has the highest number of ingredients? Calculate the said recipe's total time of cooking.
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Which ingredient appeared the most in recipes? Calculate its amount of appearance in percentage.
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Provide the title and total time of the recipe which has the highest possibility of gaining weight.
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Which recipes contain almond extract?
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- List the ingredients in Tomato-Cucumber Relish.
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- How many ingredients are needed to prepare Idaho Potato Supreme?
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Provide the ingredients that are rationed in the recipe with the highest carbohydrate content.
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Name the recipes which can lead to constipation.
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.iron > 20;
-- Database schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Describe the ingredients in the recipe with the highest vitamin that helps vision in dim light.
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Provide the ingredients and maximum quantities of the recipe which can serve 7 people.
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Among the recipes from The California Tree Fruit Agreement, calculate the percentage of sodium-free recipes.
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- List the ingredients which measure in slices.
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- How many recipes can be made with canned dairy?
SELECT COUNT(*) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T1.category = 'canned dairy';
-- Database schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Provide the title and total time of the recipe which can be made with only lima beans.
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Among the recipes with sea bass, how many percent of recipes can serve 10 people and above?
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- How much fat does the Raspberry Chiffon Pie have?
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- What is the percentage calories protein of Raspberry Chiffon Pie?
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- How many ingredients are required to make the Raspberry Chiffon Pie?
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- List the names of alcohol free recipes.
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.alcohol = 0;
-- Database schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- What is the average vitamin C amount of all cakes?
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- How many dairy recipes can serve more than 10 people?
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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- List the names of recipes that can lead to constipation.
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.iron > 20;
-- Database schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Which recipe has the highest 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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- How many recipes are non-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 schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- List all the ingredients of Apricot Yogurt Parfaits.
SELECT T3.name, T3.category FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Apricot Yogurt Parfaits';
-- Database schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Identify recipes with different maximum and minimum quantities.
SELECT T1.title FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.max_qty <> T2.min_qty;
-- Database schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- What ingredients does the longest cooking time recipe have?
SELECT T3.name FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id ORDER BY T1.cook_min DESC LIMIT 1;
-- Database schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Calculate the percentage of recipes with no cholesterol included and have a cooking time less than 20 minutes among all recipes.
SELECT CAST(SUM(CASE WHEN T1.cook_min < 20 AND T2.cholestrl = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id;
-- Database schema | Ingredient : ingredient_id [ INTEGER ] primary_key , category [ TEXT ] , name [ TEXT ] , plural [ TEXT ] | Recipe : recipe_id [ INTEGER ] primary_key , title [ TEXT ] , subtitle [ TEXT ] , servings [ INTEGER ] , yield_unit [ TEXT ] , prep_min [ INTEGER ] , cook_min [ INTEGER ] , stnd_min [ INTEGER ] , source [ TEXT ] , intro [ TEXT ] , directions [ TEXT ] | Nutrition : recipe_id [ INTEGER ] primary_key Nutrition.recipe_id = Recipe.recipe_id , protein [ REAL ] , carbo [ REAL ] , alcohol [ REAL ] , total_fat [ REAL ] , sat_fat [ REAL ] , cholestrl [ REAL ] , sodium [ REAL ] , iron [ REAL ] , vitamin_c [ REAL ] , vitamin_a [ REAL ] , fiber [ REAL ] , pcnt_cal_carb [ REAL ] , pcnt_cal_fat [ REAL ] , pcnt_cal_prot [ REAL ] , calories [ REAL ] | Quantity : quantity_id [ INTEGER ] primary_key , recipe_id [ INTEGER ] Quantity.recipe_id = Recipe.recipe_id , ingredient_id [ INTEGER ] Quantity.ingredient_id = Ingredient.ingredient_id , max_qty [ REAL ] , min_qty [ REAL ] , unit [ TEXT ] , preparation [ TEXT ] , optional [ TEXT ] | -- -- Among all recipes containing cheese, what is the percentage of recipes with calories greater than 200?
SELECT CAST(SUM(CASE WHEN T4.calories > 200 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id INNER JOIN Nutrition AS T4 ON T4.recipe_id = T1.recipe_id WHERE T3.category = 'cheese';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Which employee has the highest salary? Please give his or her full name.
SELECT firstname, lastname FROM employee ORDER BY salary DESC LIMIT 1;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- How many emplyees have a good job performance?
SELECT COUNT(*) FROM employee WHERE performance = 'Good';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Please list the social security numbers of the male employees with a salary of over $70,000 a year.
SELECT ssn FROM employee WHERE gender = 'M' AND CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) > 70000;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- What is the required education for the position of regional manager?
SELECT educationrequired FROM position WHERE positiontitle = 'Regional Manager';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Which position has a lower minimum salary, Account Representative or Trainee?
SELECT positiontitle FROM position WHERE positiontitle = 'Account Representative' OR positiontitle = 'Trainee' ORDER BY minsalary ASC LIMIT 1;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- In which city's office does Sandy Adams work at?
SELECT T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.lastname = 'Adams' AND T1.firstname = 'Sandy';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Among the employees working at the office in New York, how many of them have a good job performance?
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'NY' AND T1.performance = 'Good';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- What is the office phone number of the location at which Sandy Adams works?
SELECT T2.officephone FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.lastname = 'Adams' AND T1.firstname = 'Sandy';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- How many male employees work at the address 450 Peachtree Rd?
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.address = '450 Peachtree Rd' AND T1.gender = 'M';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- How many employees work as an Account Representative?
SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Account Representative';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- How much higher is James Johnson's salary from the minimum salary of his title?
SELECT CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) - CAST(REPLACE(SUBSTR(T2.minsalary, 4), ',', '') AS REAL) AS diff FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.lastname = 'Johnson' AND T1.firstname = 'James';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Among the employees who are Trainees, how many of them work in New York?
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Trainee' AND T2.state = 'NY';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Please list the full names of the employees who are working as a Trainee.
SELECT T1.firstname, T1.lastname FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Which employee's job position requires a higher education level, Jose Rodriguez or Sandy Adams?
SELECT T1.firstname, T1.lastname FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE (T1.lastname = 'Adams' AND T1.firstname = 'Sandy') OR (T1.lastname = 'Rodriguez' AND T1.firstname = 'Jose') ORDER BY T2.educationrequired DESC LIMIT 1;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Please list the zip codes of the offices where all the male employees with a good job performance work at.
SELECT T2.zipcode FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.gender = 'M' AND T1.performance = 'Good';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Please list the social security numbers of all the employees who work in California.
SELECT T1.ssn FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'CA';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Among the employees who work as a Trainee, how many of them have a salary of over &20,000 a year?
SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) > 20000 AND T2.positiontitle = 'Trainee';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- What is the average salary of the employees who work as a Trainee?
SELECT AVG(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) AS avg FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- By what percentage is the average salary of Trainees higher than the minimum salary of this postion?
SELECT 100 * (AVG(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) - CAST(REPLACE(SUBSTR(T2.minsalary, 4), ',', '') AS REAL)) / CAST(REPLACE(SUBSTR(T2.minsalary, 4), ',', '') AS REAL) AS per FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Give the number of female employees.
SELECT COUNT(*) FROM employee WHERE gender = 'F';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- State the name of the city where Jose Rodriguez works.
SELECT T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.firstname = 'Jose' AND T1.lastname = 'Rodriguez';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- In which state does Emily Wood work?
SELECT T2.state FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.firstname = 'Emily' AND T1.lastname = 'Wood';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- What is the education required for David Whitehead to reach his current position?
SELECT T2.educationrequired FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'David' AND T1.lastname = 'Whitehead' AND T1.gender = 'M';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- How many employees are there in the "Miami" office?
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.locationcity = 'Miami';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Who is the highest paid employee in "Boston"? Give the full name.
SELECT T1.firstname, T1.lastname FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.locationcity = 'Boston' ORDER BY T1.salary DESC LIMIT 1;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Who is the employee in “New York City” with a good performance? Give the social security number of the employee.
SELECT T1.firstname, T1.lastname, T1.ssn FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.locationcity = 'New York City' AND T1.performance = 'Good';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- How many "account representatives" are there in Chicago with a good performance?
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Account Representative' AND T2.locationcity = 'Chicago' AND T1.performance = 'Good';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- What is Kenneth Charles's position title?
SELECT T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Kenneth' AND T1.lastname = 'Charles';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Give the full address of the office of the highest paid manager.
SELECT T2.address FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Manager' ORDER BY T1.salary DESC LIMIT 1;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- What is the max salary for 'Tracy Coulter' if he/she stays on his/her position?
SELECT T2.maxsalary FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Tracy' AND T1.lastname = 'Coulter';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- If Jose Rodriguez tried his best, how many percentage can his salary raise without changing his position?
SELECT 100 * (CAST(REPLACE(SUBSTR(T2.maxsalary, 4), ',', '') AS REAL) - CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) / CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) AS per FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Jose' AND T1.lastname = 'Rodriguez';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- How many employees whose performance is poor have a salary of over $50,000 per year?
SELECT COUNT(*) FROM employee WHERE performance = 'Poor' AND CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) > 50000;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Who is the employee with the highest salary? Specify his/her full name.
SELECT firstname, lastname FROM employee WHERE CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) = ( SELECT MAX(CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL)) FROM employee );
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- How many positions have a maximum salary of no more than US$1000,000?
SELECT COUNT(*) FROM position WHERE CAST(REPLACE(SUBSTR(maxsalary, 4), ',', '') AS REAL) < 100000;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- How much is the salary of the first ever employee that was hired?
SELECT salary FROM employee ORDER BY hiredate ASC LIMIT 1;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- How much is the minimum salary given to the position with the most complex work?
SELECT minsalary FROM position ORDER BY educationrequired DESC LIMIT 1;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- What is the full office location address where most of the employees work at?
SELECT T2.address, T2.locationcity, T2.state, T2.zipcode FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID GROUP BY T2.address, T2.locationcity, T2.state, T2.zipcode ORDER BY COUNT(*) DESC LIMIT 1;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- What is the average salary of all employees with a 2 year degree position?
SELECT AVG(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.educationrequired = '2 year degree';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- How many male Regional Managers are there?
SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Regional Manager' AND T1.gender = 'M';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Which position has the highest amount of poor performing employees?
SELECT T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Poor' GROUP BY T2.positiontitle ORDER BY COUNT(T2.positiontitle) DESC LIMIT 1;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Which position has the highest number of female employees with a 2 year degree?
SELECT T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.educationrequired = '2 year degree' AND T1.gender = 'F' GROUP BY T2.positiontitle ORDER BY COUNT(T2.positiontitle) DESC LIMIT 1;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- How many Account Representatives are there in Illinois with satisfying performance?
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Account Representative' AND T1.performance = 'Good' AND T2.state = 'IL';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- What is the average salary of the worst performing managers?
SELECT AVG(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Poor' AND T2.positiontitle = 'Manager';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- In which state can you find the highest amount of good performing Account Representatives?
SELECT T2.state FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Account Representative' AND T1.performance = 'Good' GROUP BY T2.state ORDER BY COUNT(T2.state) DESC LIMIT 1;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Mention the employee's full name and performance status who got the lowest in salary per year.
SELECT firstname, lastname, performance FROM employee ORDER BY salary ASC LIMIT 1;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- List the location cities in the Western states.
SELECT locationcity FROM location WHERE state IN ('CO', 'UT', 'CA');
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Which city and address has zip code of above 90000?
SELECT locationcity, address FROM location WHERE zipcode > 90000;
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Which positions are suitable with 4 years degree education?
SELECT positiontitle FROM position WHERE educationrequired = '4 year degree';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- What is the maximum salary of position "Trainer"?
SELECT maxsalary FROM position WHERE positiontitle = 'Trainee';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- List the full name and social security number of the account representative with average performance.
SELECT T1.firstname, T1.lastname, T1.ssn FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Average';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- When was Emily Wood hired? Mention her position and salary.
SELECT T1.hiredate, T2.positiontitle, T1.salary FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Emily' AND T1.lastname = 'Wood';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- What are the maximum and minimum salary range and position title of Bill Marlin?
SELECT T2.maxsalary, T2.minsalary, T2.positiontitle FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.firstname = 'Bill' AND T1.lastname = 'Marlin';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- List the full names, gender and positions who's location is in New York city.
SELECT T1.firstname, T1.lastname, T1.gender, T3.positiontitle FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T2.locationcity = 'New York City';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Mention the full name, hired date and performance status of the employee whose location is in Utah state.
SELECT T1.firstname, T1.lastname, T1.hiredate, T1.performance FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'UT';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Among the employees with poor performance, provide the managers' full names, location city, address and its zip code.
SELECT T1.firstname, T1.lastname, T2.locationcity, T2.address, T2.zipcode FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T3.positiontitle = 'Manager' AND T1.performance = 'Poor';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- What is the education required to be account representative? Mention account representative full name and salary who got poor in performance status.
SELECT T2.educationrequired, T1.firstname, T1.lastname, T1.salary FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T1.performance = 'Poor' AND T2.positiontitle = 'Account Representative';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Write down the full name, performance status and located city of the employee who's social security number is "767-74-7373".
SELECT T1.firstname, T1.lastname, T2.state, T2.locationcity FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T1.ssn = '767-74-7373';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Describe the employees' full name, positions, located city and office phone number within Colorado state.
SELECT T1.firstname, T1.lastname, T3.positiontitle, T2.locationcity, T2.officephone FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID INNER JOIN position AS T3 ON T3.positionID = T1.positionID WHERE T2.state = 'CO';
-- Database schema | location : locationID [ INTEGER ] primary_key , locationcity [ TEXT ] , address [ TEXT ] , state [ TEXT ] , zipcode [ INTEGER ] , officephone [ TEXT ] | position : positionID [ INTEGER ] primary_key , positiontitle [ TEXT ] , educationrequired [ TEXT ] , minsalary [ TEXT ] , maxsalary [ TEXT ] | employee : ssn [ TEXT ] primary_key , lastname [ TEXT ] , firstname [ TEXT ] , hiredate [ TEXT ] , salary [ TEXT ] , gender [ TEXT ] , performance [ TEXT ] , positionID [ INTEGER ] employee.positionID = position.positionID , locationID [ INTEGER ] employee.locationID = location.locationID | -- -- Calculate the monthly average salary of the employee with highest salary. Mention his name, position title and location city.
SELECT SUM(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) / 12 AS avg, T1.firstname, T1.lastname , T2.positiontitle, T3.locationcity FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID INNER JOIN location AS T3 ON T1.locationID = T3.locationID WHERE CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL) = ( SELECT MAX(CAST(REPLACE(SUBSTR(T1.salary, 4), ',', '') AS REAL)) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID INNER JOIN location AS T3 ON T1.locationID = T3.locationID );
-- Database schema | station : id [ INTEGER ] primary_key , name [ TEXT ] , lat [ REAL ] , long [ REAL ] , dock_count [ INTEGER ] , city [ TEXT ] , installation_date [ TEXT ] | status : station_id [ INTEGER ] , bikes_available [ INTEGER ] , docks_available [ INTEGER ] , time [ TEXT ] | trip : id [ INTEGER ] primary_key , duration [ INTEGER ] , start_date [ TEXT ] , start_station_name [ TEXT ] , start_station_id [ INTEGER ] , end_date [ TEXT ] , end_station_name [ TEXT ] , end_station_id [ INTEGER ] , bike_id [ INTEGER ] , subscription_type [ TEXT ] , zip_code [ INTEGER ] | weather : date [ TEXT ] , max_temperature_f [ INTEGER ] , mean_temperature_f [ INTEGER ] , min_temperature_f [ INTEGER ] , max_dew_point_f [ INTEGER ] , mean_dew_point_f [ INTEGER ] , min_dew_point_f [ INTEGER ] , max_humidity [ INTEGER ] , mean_humidity [ INTEGER ] , min_humidity [ INTEGER ] , max_sea_level_pressure_inches [ REAL ] , mean_sea_level_pressure_inches [ REAL ] , min_sea_level_pressure_inches [ REAL ] , max_visibility_miles [ INTEGER ] , mean_visibility_miles [ INTEGER ] , min_visibility_miles [ INTEGER ] , max_wind_Speed_mph [ INTEGER ] , mean_wind_speed_mph [ INTEGER ] , max_gust_speed_mph [ INTEGER ] , precipitation_inches [ TEXT ] , cloud_cover [ INTEGER ] , events [ TEXT ] , wind_dir_degrees [ INTEGER ] , zip_code [ TEXT ] | -- -- Which trip had the longest duration? State the start and end station.
SELECT start_station_name, end_station_name FROM trip WHERE duration = ( SELECT MAX(duration) FROM trip );
-- Database schema | station : id [ INTEGER ] primary_key , name [ TEXT ] , lat [ REAL ] , long [ REAL ] , dock_count [ INTEGER ] , city [ TEXT ] , installation_date [ TEXT ] | status : station_id [ INTEGER ] , bikes_available [ INTEGER ] , docks_available [ INTEGER ] , time [ TEXT ] | trip : id [ INTEGER ] primary_key , duration [ INTEGER ] , start_date [ TEXT ] , start_station_name [ TEXT ] , start_station_id [ INTEGER ] , end_date [ TEXT ] , end_station_name [ TEXT ] , end_station_id [ INTEGER ] , bike_id [ INTEGER ] , subscription_type [ TEXT ] , zip_code [ INTEGER ] | weather : date [ TEXT ] , max_temperature_f [ INTEGER ] , mean_temperature_f [ INTEGER ] , min_temperature_f [ INTEGER ] , max_dew_point_f [ INTEGER ] , mean_dew_point_f [ INTEGER ] , min_dew_point_f [ INTEGER ] , max_humidity [ INTEGER ] , mean_humidity [ INTEGER ] , min_humidity [ INTEGER ] , max_sea_level_pressure_inches [ REAL ] , mean_sea_level_pressure_inches [ REAL ] , min_sea_level_pressure_inches [ REAL ] , max_visibility_miles [ INTEGER ] , mean_visibility_miles [ INTEGER ] , min_visibility_miles [ INTEGER ] , max_wind_Speed_mph [ INTEGER ] , mean_wind_speed_mph [ INTEGER ] , max_gust_speed_mph [ INTEGER ] , precipitation_inches [ TEXT ] , cloud_cover [ INTEGER ] , events [ TEXT ] , wind_dir_degrees [ INTEGER ] , zip_code [ TEXT ] | -- -- What is the percentage of the trip were done by a subscriber?
SELECT CAST(COUNT(subscription_type) AS REAL) * 100 / ( SELECT COUNT(subscription_type) FROM trip ) FROM trip WHERE subscription_type = 'Subscriber';
-- Database schema | station : id [ INTEGER ] primary_key , name [ TEXT ] , lat [ REAL ] , long [ REAL ] , dock_count [ INTEGER ] , city [ TEXT ] , installation_date [ TEXT ] | status : station_id [ INTEGER ] , bikes_available [ INTEGER ] , docks_available [ INTEGER ] , time [ TEXT ] | trip : id [ INTEGER ] primary_key , duration [ INTEGER ] , start_date [ TEXT ] , start_station_name [ TEXT ] , start_station_id [ INTEGER ] , end_date [ TEXT ] , end_station_name [ TEXT ] , end_station_id [ INTEGER ] , bike_id [ INTEGER ] , subscription_type [ TEXT ] , zip_code [ INTEGER ] | weather : date [ TEXT ] , max_temperature_f [ INTEGER ] , mean_temperature_f [ INTEGER ] , min_temperature_f [ INTEGER ] , max_dew_point_f [ INTEGER ] , mean_dew_point_f [ INTEGER ] , min_dew_point_f [ INTEGER ] , max_humidity [ INTEGER ] , mean_humidity [ INTEGER ] , min_humidity [ INTEGER ] , max_sea_level_pressure_inches [ REAL ] , mean_sea_level_pressure_inches [ REAL ] , min_sea_level_pressure_inches [ REAL ] , max_visibility_miles [ INTEGER ] , mean_visibility_miles [ INTEGER ] , min_visibility_miles [ INTEGER ] , max_wind_Speed_mph [ INTEGER ] , mean_wind_speed_mph [ INTEGER ] , max_gust_speed_mph [ INTEGER ] , precipitation_inches [ TEXT ] , cloud_cover [ INTEGER ] , events [ TEXT ] , wind_dir_degrees [ INTEGER ] , zip_code [ TEXT ] | -- -- State the final station of bike id 13. Which city was it at?
SELECT T2.end_station_id, T1.city FROM station AS T1 INNER JOIN trip AS T2 ON T1.name = T2.end_station_name WHERE T2.bike_id = 13 ORDER BY T2.end_date DESC LIMIT 1;
-- Database schema | station : id [ INTEGER ] primary_key , name [ TEXT ] , lat [ REAL ] , long [ REAL ] , dock_count [ INTEGER ] , city [ TEXT ] , installation_date [ TEXT ] | status : station_id [ INTEGER ] , bikes_available [ INTEGER ] , docks_available [ INTEGER ] , time [ TEXT ] | trip : id [ INTEGER ] primary_key , duration [ INTEGER ] , start_date [ TEXT ] , start_station_name [ TEXT ] , start_station_id [ INTEGER ] , end_date [ TEXT ] , end_station_name [ TEXT ] , end_station_id [ INTEGER ] , bike_id [ INTEGER ] , subscription_type [ TEXT ] , zip_code [ INTEGER ] | weather : date [ TEXT ] , max_temperature_f [ INTEGER ] , mean_temperature_f [ INTEGER ] , min_temperature_f [ INTEGER ] , max_dew_point_f [ INTEGER ] , mean_dew_point_f [ INTEGER ] , min_dew_point_f [ INTEGER ] , max_humidity [ INTEGER ] , mean_humidity [ INTEGER ] , min_humidity [ INTEGER ] , max_sea_level_pressure_inches [ REAL ] , mean_sea_level_pressure_inches [ REAL ] , min_sea_level_pressure_inches [ REAL ] , max_visibility_miles [ INTEGER ] , mean_visibility_miles [ INTEGER ] , min_visibility_miles [ INTEGER ] , max_wind_Speed_mph [ INTEGER ] , mean_wind_speed_mph [ INTEGER ] , max_gust_speed_mph [ INTEGER ] , precipitation_inches [ TEXT ] , cloud_cover [ INTEGER ] , events [ TEXT ] , wind_dir_degrees [ INTEGER ] , zip_code [ TEXT ] | -- -- Name all the trips where the bike was borrowed and returned on a different day. State the city where the bike was returned.
SELECT DISTINCT T1.city FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE SUBSTR(CAST(T2.start_date AS TEXT), INSTR(T2.start_date, '/') + 1) - SUBSTR(CAST(T2.start_date AS TEXT), INSTR(T2.start_date, ' ') - 5) <> SUBSTR(CAST(T2.end_date AS TEXT), INSTR(T2.end_date, '/') + 1) - SUBSTR(CAST(T2.end_date AS TEXT), INSTR(T2.end_date, ' ') - 5);
-- Database schema | station : id [ INTEGER ] primary_key , name [ TEXT ] , lat [ REAL ] , long [ REAL ] , dock_count [ INTEGER ] , city [ TEXT ] , installation_date [ TEXT ] | status : station_id [ INTEGER ] , bikes_available [ INTEGER ] , docks_available [ INTEGER ] , time [ TEXT ] | trip : id [ INTEGER ] primary_key , duration [ INTEGER ] , start_date [ TEXT ] , start_station_name [ TEXT ] , start_station_id [ INTEGER ] , end_date [ TEXT ] , end_station_name [ TEXT ] , end_station_id [ INTEGER ] , bike_id [ INTEGER ] , subscription_type [ TEXT ] , zip_code [ INTEGER ] | weather : date [ TEXT ] , max_temperature_f [ INTEGER ] , mean_temperature_f [ INTEGER ] , min_temperature_f [ INTEGER ] , max_dew_point_f [ INTEGER ] , mean_dew_point_f [ INTEGER ] , min_dew_point_f [ INTEGER ] , max_humidity [ INTEGER ] , mean_humidity [ INTEGER ] , min_humidity [ INTEGER ] , max_sea_level_pressure_inches [ REAL ] , mean_sea_level_pressure_inches [ REAL ] , min_sea_level_pressure_inches [ REAL ] , max_visibility_miles [ INTEGER ] , mean_visibility_miles [ INTEGER ] , min_visibility_miles [ INTEGER ] , max_wind_Speed_mph [ INTEGER ] , mean_wind_speed_mph [ INTEGER ] , max_gust_speed_mph [ INTEGER ] , precipitation_inches [ TEXT ] , cloud_cover [ INTEGER ] , events [ TEXT ] , wind_dir_degrees [ INTEGER ] , zip_code [ TEXT ] | -- -- Which is the station where no bike could not be borrowed form on the 2013/11/03 02:01:01? State the location of the station.
SELECT T1.name, T1.long FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T2.time = '2013/11/03 02:01:01' AND T2.bikes_available = 0;
-- Database schema | station : id [ INTEGER ] primary_key , name [ TEXT ] , lat [ REAL ] , long [ REAL ] , dock_count [ INTEGER ] , city [ TEXT ] , installation_date [ TEXT ] | status : station_id [ INTEGER ] , bikes_available [ INTEGER ] , docks_available [ INTEGER ] , time [ TEXT ] | trip : id [ INTEGER ] primary_key , duration [ INTEGER ] , start_date [ TEXT ] , start_station_name [ TEXT ] , start_station_id [ INTEGER ] , end_date [ TEXT ] , end_station_name [ TEXT ] , end_station_id [ INTEGER ] , bike_id [ INTEGER ] , subscription_type [ TEXT ] , zip_code [ INTEGER ] | weather : date [ TEXT ] , max_temperature_f [ INTEGER ] , mean_temperature_f [ INTEGER ] , min_temperature_f [ INTEGER ] , max_dew_point_f [ INTEGER ] , mean_dew_point_f [ INTEGER ] , min_dew_point_f [ INTEGER ] , max_humidity [ INTEGER ] , mean_humidity [ INTEGER ] , min_humidity [ INTEGER ] , max_sea_level_pressure_inches [ REAL ] , mean_sea_level_pressure_inches [ REAL ] , min_sea_level_pressure_inches [ REAL ] , max_visibility_miles [ INTEGER ] , mean_visibility_miles [ INTEGER ] , min_visibility_miles [ INTEGER ] , max_wind_Speed_mph [ INTEGER ] , mean_wind_speed_mph [ INTEGER ] , max_gust_speed_mph [ INTEGER ] , precipitation_inches [ TEXT ] , cloud_cover [ INTEGER ] , events [ TEXT ] , wind_dir_degrees [ INTEGER ] , zip_code [ TEXT ] | -- -- Name the station and city with the most borrowed bike.
SELECT T2.start_station_name, T1.city FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name GROUP BY T2.start_station_name ORDER BY COUNT(T2.start_station_name) DESC LIMIT 1;
-- Database schema | station : id [ INTEGER ] primary_key , name [ TEXT ] , lat [ REAL ] , long [ REAL ] , dock_count [ INTEGER ] , city [ TEXT ] , installation_date [ TEXT ] | status : station_id [ INTEGER ] , bikes_available [ INTEGER ] , docks_available [ INTEGER ] , time [ TEXT ] | trip : id [ INTEGER ] primary_key , duration [ INTEGER ] , start_date [ TEXT ] , start_station_name [ TEXT ] , start_station_id [ INTEGER ] , end_date [ TEXT ] , end_station_name [ TEXT ] , end_station_id [ INTEGER ] , bike_id [ INTEGER ] , subscription_type [ TEXT ] , zip_code [ INTEGER ] | weather : date [ TEXT ] , max_temperature_f [ INTEGER ] , mean_temperature_f [ INTEGER ] , min_temperature_f [ INTEGER ] , max_dew_point_f [ INTEGER ] , mean_dew_point_f [ INTEGER ] , min_dew_point_f [ INTEGER ] , max_humidity [ INTEGER ] , mean_humidity [ INTEGER ] , min_humidity [ INTEGER ] , max_sea_level_pressure_inches [ REAL ] , mean_sea_level_pressure_inches [ REAL ] , min_sea_level_pressure_inches [ REAL ] , max_visibility_miles [ INTEGER ] , mean_visibility_miles [ INTEGER ] , min_visibility_miles [ INTEGER ] , max_wind_Speed_mph [ INTEGER ] , mean_wind_speed_mph [ INTEGER ] , max_gust_speed_mph [ INTEGER ] , precipitation_inches [ TEXT ] , cloud_cover [ INTEGER ] , events [ TEXT ] , wind_dir_degrees [ INTEGER ] , zip_code [ TEXT ] | -- -- What was the hottest temperature on the day of trip ID 4080?
SELECT MAX(T2.max_temperature_f) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code AND T2.date = SUBSTR(CAST(T1.start_date AS TEXT), 1, INSTR(T1.start_date, ' ') - 1) WHERE T1.id = 4080;
-- Database schema | station : id [ INTEGER ] primary_key , name [ TEXT ] , lat [ REAL ] , long [ REAL ] , dock_count [ INTEGER ] , city [ TEXT ] , installation_date [ TEXT ] | status : station_id [ INTEGER ] , bikes_available [ INTEGER ] , docks_available [ INTEGER ] , time [ TEXT ] | trip : id [ INTEGER ] primary_key , duration [ INTEGER ] , start_date [ TEXT ] , start_station_name [ TEXT ] , start_station_id [ INTEGER ] , end_date [ TEXT ] , end_station_name [ TEXT ] , end_station_id [ INTEGER ] , bike_id [ INTEGER ] , subscription_type [ TEXT ] , zip_code [ INTEGER ] | weather : date [ TEXT ] , max_temperature_f [ INTEGER ] , mean_temperature_f [ INTEGER ] , min_temperature_f [ INTEGER ] , max_dew_point_f [ INTEGER ] , mean_dew_point_f [ INTEGER ] , min_dew_point_f [ INTEGER ] , max_humidity [ INTEGER ] , mean_humidity [ INTEGER ] , min_humidity [ INTEGER ] , max_sea_level_pressure_inches [ REAL ] , mean_sea_level_pressure_inches [ REAL ] , min_sea_level_pressure_inches [ REAL ] , max_visibility_miles [ INTEGER ] , mean_visibility_miles [ INTEGER ] , min_visibility_miles [ INTEGER ] , max_wind_Speed_mph [ INTEGER ] , mean_wind_speed_mph [ INTEGER ] , max_gust_speed_mph [ INTEGER ] , precipitation_inches [ TEXT ] , cloud_cover [ INTEGER ] , events [ TEXT ] , wind_dir_degrees [ INTEGER ] , zip_code [ TEXT ] | -- -- At what date and time did San Jose Diridon Caltrain Station have most bikes available.
SELECT T2.time FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T1.name = 'San Jose Diridon Caltrain Station' AND T2.bikes_available = ( SELECT MAX(T2.bikes_available) FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T1.name = 'San Jose Diridon Caltrain Station' );
-- Database schema | station : id [ INTEGER ] primary_key , name [ TEXT ] , lat [ REAL ] , long [ REAL ] , dock_count [ INTEGER ] , city [ TEXT ] , installation_date [ TEXT ] | status : station_id [ INTEGER ] , bikes_available [ INTEGER ] , docks_available [ INTEGER ] , time [ TEXT ] | trip : id [ INTEGER ] primary_key , duration [ INTEGER ] , start_date [ TEXT ] , start_station_name [ TEXT ] , start_station_id [ INTEGER ] , end_date [ TEXT ] , end_station_name [ TEXT ] , end_station_id [ INTEGER ] , bike_id [ INTEGER ] , subscription_type [ TEXT ] , zip_code [ INTEGER ] | weather : date [ TEXT ] , max_temperature_f [ INTEGER ] , mean_temperature_f [ INTEGER ] , min_temperature_f [ INTEGER ] , max_dew_point_f [ INTEGER ] , mean_dew_point_f [ INTEGER ] , min_dew_point_f [ INTEGER ] , max_humidity [ INTEGER ] , mean_humidity [ INTEGER ] , min_humidity [ INTEGER ] , max_sea_level_pressure_inches [ REAL ] , mean_sea_level_pressure_inches [ REAL ] , min_sea_level_pressure_inches [ REAL ] , max_visibility_miles [ INTEGER ] , mean_visibility_miles [ INTEGER ] , min_visibility_miles [ INTEGER ] , max_wind_Speed_mph [ INTEGER ] , mean_wind_speed_mph [ INTEGER ] , max_gust_speed_mph [ INTEGER ] , precipitation_inches [ TEXT ] , cloud_cover [ INTEGER ] , events [ TEXT ] , wind_dir_degrees [ INTEGER ] , zip_code [ TEXT ] | -- -- Name all the trip on the days when it rained. State the duration of the trip
SELECT T1.id, T1.duration FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code AND T2.date = SUBSTR(CAST(T1.start_date AS TEXT), 1, INSTR(T1.start_date, ' ') - 1) WHERE T2.events LIKE '%Rain%' OR T2.events LIKE '%rain%';
-- Database schema | station : id [ INTEGER ] primary_key , name [ TEXT ] , lat [ REAL ] , long [ REAL ] , dock_count [ INTEGER ] , city [ TEXT ] , installation_date [ TEXT ] | status : station_id [ INTEGER ] , bikes_available [ INTEGER ] , docks_available [ INTEGER ] , time [ TEXT ] | trip : id [ INTEGER ] primary_key , duration [ INTEGER ] , start_date [ TEXT ] , start_station_name [ TEXT ] , start_station_id [ INTEGER ] , end_date [ TEXT ] , end_station_name [ TEXT ] , end_station_id [ INTEGER ] , bike_id [ INTEGER ] , subscription_type [ TEXT ] , zip_code [ INTEGER ] | weather : date [ TEXT ] , max_temperature_f [ INTEGER ] , mean_temperature_f [ INTEGER ] , min_temperature_f [ INTEGER ] , max_dew_point_f [ INTEGER ] , mean_dew_point_f [ INTEGER ] , min_dew_point_f [ INTEGER ] , max_humidity [ INTEGER ] , mean_humidity [ INTEGER ] , min_humidity [ INTEGER ] , max_sea_level_pressure_inches [ REAL ] , mean_sea_level_pressure_inches [ REAL ] , min_sea_level_pressure_inches [ REAL ] , max_visibility_miles [ INTEGER ] , mean_visibility_miles [ INTEGER ] , min_visibility_miles [ INTEGER ] , max_wind_Speed_mph [ INTEGER ] , mean_wind_speed_mph [ INTEGER ] , max_gust_speed_mph [ INTEGER ] , precipitation_inches [ TEXT ] , cloud_cover [ INTEGER ] , events [ TEXT ] , wind_dir_degrees [ INTEGER ] , zip_code [ TEXT ] | -- -- List all trips where bikes were returned at location 37.331415, -121.8932. State the date the bike was borrowed.
SELECT T2.end_station_name, T2.start_date FROM station AS T1 INNER JOIN trip AS T2 ON T2.end_station_name = T1.name WHERE T1.lat = 37.331415 AND T1.long = -121.8932;