input
stringlengths
358
16.1k
output
stringlengths
24
805
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: How many servings does the recipe with the highest unsaturated fat have? [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Among the recipes whose source is the National Potato Board, which recipe has the highest calories? [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Which recipe has the highest number of ingredients? Calculate the said recipe's total time of cooking. [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Which ingredient appeared the most in recipes? Calculate its amount of appearance in percentage. [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Provide the title and total time of the recipe which has the highest possibility of gaining weight. [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Which recipes contain almond extract? [/INST]
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';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: List the ingredients in Tomato-Cucumber Relish. [/INST]
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';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: How many ingredients are needed to prepare Idaho Potato Supreme? [/INST]
SELECT COUNT(*) FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Idaho Potato Supreme';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Provide the ingredients that are rationed in the recipe with the highest carbohydrate content. [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Name the recipes which can lead to constipation. [/INST]
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.iron > 20;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Describe the ingredients in the recipe with the highest vitamin that helps vision in dim light. [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Provide the ingredients and maximum quantities of the recipe which can serve 7 people. [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Among the recipes from The California Tree Fruit Agreement, calculate the percentage of sodium-free recipes. [/INST]
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';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: List the ingredients which measure in slices. [/INST]
SELECT T1.name FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T2.unit = 'slice(s)';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: How many recipes can be made with canned dairy? [/INST]
SELECT COUNT(*) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T1.category = 'canned dairy';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Provide the title and total time of the recipe which can be made with only lima beans. [/INST]
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';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Among the recipes with sea bass, how many percent of recipes can serve 10 people and above? [/INST]
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';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: How much fat does the Raspberry Chiffon Pie have? [/INST]
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';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: What is the percentage calories protein of Raspberry Chiffon Pie? [/INST]
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';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: How many ingredients are required to make the Raspberry Chiffon Pie? [/INST]
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';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: List the names of alcohol free recipes. [/INST]
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.alcohol = 0;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: What is the average vitamin C amount of all cakes? [/INST]
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%';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: How many dairy recipes can serve more than 10 people? [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: List the names of recipes that can lead to constipation. [/INST]
SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T2.iron > 20;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Which recipe has the highest calories? [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: How many recipes are non-dairy? [/INST]
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%';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: List all the ingredients of Apricot Yogurt Parfaits. [/INST]
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';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Identify recipes with different maximum and minimum quantities. [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: What ingredients does the longest cooking time recipe have? [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Calculate the percentage of recipes with no cholesterol included and have a cooking time less than 20 minutes among all recipes. [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Among all recipes containing cheese, what is the percentage of recipes with calories greater than 200? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Which employee has the highest salary? Please give his or her full name. [/INST]
SELECT firstname, lastname FROM employee ORDER BY salary DESC LIMIT 1;
[INST] Here is a 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 write me a SQL statement that answers the following question: How many emplyees have a good job performance? [/INST]
SELECT COUNT(*) FROM employee WHERE performance = 'Good';
[INST] Here is a 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 write me a SQL statement that answers the following question: Please list the social security numbers of the male employees with a salary of over $70,000 a year. [/INST]
SELECT ssn FROM employee WHERE gender = 'M' AND CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) > 70000;
[INST] Here is a 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 write me a SQL statement that answers the following question: What is the required education for the position of regional manager? [/INST]
SELECT educationrequired FROM position WHERE positiontitle = 'Regional Manager';
[INST] Here is a 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 write me a SQL statement that answers the following question: Which position has a lower minimum salary, Account Representative or Trainee? [/INST]
SELECT positiontitle FROM position WHERE positiontitle = 'Account Representative' OR positiontitle = 'Trainee' ORDER BY minsalary ASC LIMIT 1;
[INST] Here is a 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 write me a SQL statement that answers the following question: In which city's office does Sandy Adams work at? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Among the employees working at the office in New York, how many of them have a good job performance? [/INST]
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'NY' AND T1.performance = 'Good';
[INST] Here is a 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 write me a SQL statement that answers the following question: What is the office phone number of the location at which Sandy Adams works? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: How many male employees work at the address 450 Peachtree Rd? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: How many employees work as an Account Representative? [/INST]
SELECT COUNT(*) FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Account Representative';
[INST] Here is a 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 write me a SQL statement that answers the following question: How much higher is James Johnson's salary from the minimum salary of his title? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Among the employees who are Trainees, how many of them work in New York? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Please list the full names of the employees who are working as a Trainee. [/INST]
SELECT T1.firstname, T1.lastname FROM employee AS T1 INNER JOIN position AS T2 ON T1.positionID = T2.positionID WHERE T2.positiontitle = 'Trainee';
[INST] Here is a 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 write me a SQL statement that answers the following question: Which employee's job position requires a higher education level, Jose Rodriguez or Sandy Adams? [/INST]
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;
[INST] Here is a 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 write me a SQL statement that answers the following question: Please list the zip codes of the offices where all the male employees with a good job performance work at. [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Please list the social security numbers of all the employees who work in California. [/INST]
SELECT T1.ssn FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.state = 'CA';
[INST] Here is a 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 write me a SQL statement that answers the following question: Among the employees who work as a Trainee, how many of them have a salary of over &20,000 a year? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: What is the average salary of the employees who work as a Trainee? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: By what percentage is the average salary of Trainees higher than the minimum salary of this postion? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Give the number of female employees. [/INST]
SELECT COUNT(*) FROM employee WHERE gender = 'F';
[INST] Here is a 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 write me a SQL statement that answers the following question: State the name of the city where Jose Rodriguez works. [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: In which state does Emily Wood work? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: What is the education required for David Whitehead to reach his current position? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: How many employees are there in the "Miami" office? [/INST]
SELECT COUNT(*) FROM employee AS T1 INNER JOIN location AS T2 ON T1.locationID = T2.locationID WHERE T2.locationcity = 'Miami';
[INST] Here is a 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 write me a SQL statement that answers the following question: Who is the highest paid employee in "Boston"? Give the full name. [/INST]
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;
[INST] Here is a 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 write me a SQL statement that answers the following question: Who is the employee in “New York City” with a good performance? Give the social security number of the employee. [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: How many "account representatives" are there in Chicago with a good performance? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: What is Kenneth Charles's position title? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Give the full address of the office of the highest paid manager. [/INST]
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;
[INST] Here is a 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 write me a SQL statement that answers the following question: What is the max salary for 'Tracy Coulter' if he/she stays on his/her position? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: If Jose Rodriguez tried his best, how many percentage can his salary raise without changing his position? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: How many employees whose performance is poor have a salary of over $50,000 per year? [/INST]
SELECT COUNT(*) FROM employee WHERE performance = 'Poor' AND CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) > 50000;
[INST] Here is a 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 write me a SQL statement that answers the following question: Who is the employee with the highest salary? Specify his/her full name. [/INST]
SELECT firstname, lastname FROM employee WHERE CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL) = ( SELECT MAX(CAST(REPLACE(SUBSTR(salary, 4), ',', '') AS REAL)) FROM employee );
[INST] Here is a 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 write me a SQL statement that answers the following question: How many positions have a maximum salary of no more than US$1000,000? [/INST]
SELECT COUNT(*) FROM position WHERE CAST(REPLACE(SUBSTR(maxsalary, 4), ',', '') AS REAL) < 100000;
[INST] Here is a 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 write me a SQL statement that answers the following question: How much is the salary of the first ever employee that was hired? [/INST]
SELECT salary FROM employee ORDER BY hiredate ASC LIMIT 1;
[INST] Here is a 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 write me a SQL statement that answers the following question: How much is the minimum salary given to the position with the most complex work? [/INST]
SELECT minsalary FROM position ORDER BY educationrequired DESC LIMIT 1;
[INST] Here is a 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 write me a SQL statement that answers the following question: What is the full office location address where most of the employees work at? [/INST]
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;
[INST] Here is a 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 write me a SQL statement that answers the following question: What is the average salary of all employees with a 2 year degree position? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: How many male Regional Managers are there? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Which position has the highest amount of poor performing employees? [/INST]
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;
[INST] Here is a 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 write me a SQL statement that answers the following question: Which position has the highest number of female employees with a 2 year degree? [/INST]
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;
[INST] Here is a 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 write me a SQL statement that answers the following question: How many Account Representatives are there in Illinois with satisfying performance? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: What is the average salary of the worst performing managers? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: In which state can you find the highest amount of good performing Account Representatives? [/INST]
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;
[INST] Here is a 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 write me a SQL statement that answers the following question: Mention the employee's full name and performance status who got the lowest in salary per year. [/INST]
SELECT firstname, lastname, performance FROM employee ORDER BY salary ASC LIMIT 1;
[INST] Here is a 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 write me a SQL statement that answers the following question: List the location cities in the Western states. [/INST]
SELECT locationcity FROM location WHERE state IN ('CO', 'UT', 'CA');
[INST] Here is a 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 write me a SQL statement that answers the following question: Which city and address has zip code of above 90000? [/INST]
SELECT locationcity, address FROM location WHERE zipcode > 90000;
[INST] Here is a 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 write me a SQL statement that answers the following question: Which positions are suitable with 4 years degree education? [/INST]
SELECT positiontitle FROM position WHERE educationrequired = '4 year degree';
[INST] Here is a 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 write me a SQL statement that answers the following question: What is the maximum salary of position "Trainer"? [/INST]
SELECT maxsalary FROM position WHERE positiontitle = 'Trainee';
[INST] Here is a 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 write me a SQL statement that answers the following question: List the full name and social security number of the account representative with average performance. [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: When was Emily Wood hired? Mention her position and salary. [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: What are the maximum and minimum salary range and position title of Bill Marlin? [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: List the full names, gender and positions who's location is in New York city. [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Mention the full name, hired date and performance status of the employee whose location is in Utah state. [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Among the employees with poor performance, provide the managers' full names, location city, address and its zip code. [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: What is the education required to be account representative? Mention account representative full name and salary who got poor in performance status. [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Write down the full name, performance status and located city of the employee who's social security number is "767-74-7373". [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Describe the employees' full name, positions, located city and office phone number within Colorado state. [/INST]
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';
[INST] Here is a 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 write me a SQL statement that answers the following question: Calculate the monthly average salary of the employee with highest salary. Mention his name, position title and location city. [/INST]
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 );
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Which trip had the longest duration? State the start and end station. [/INST]
SELECT start_station_name, end_station_name FROM trip WHERE duration = ( SELECT MAX(duration) FROM trip );
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: What is the percentage of the trip were done by a subscriber? [/INST]
SELECT CAST(COUNT(subscription_type) AS REAL) * 100 / ( SELECT COUNT(subscription_type) FROM trip ) FROM trip WHERE subscription_type = 'Subscriber';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: State the final station of bike id 13. Which city was it at? [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Name all the trips where the bike was borrowed and returned on a different day. State the city where the bike was returned. [/INST]
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);
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: 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. [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Name the station and city with the most borrowed bike. [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: What was the hottest temperature on the day of trip ID 4080? [/INST]
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;
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: At what date and time did San Jose Diridon Caltrain Station have most bikes available. [/INST]
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' );
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: Name all the trip on the days when it rained. State the duration of the trip [/INST]
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%';
[INST] Here is a 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 ] Please write me a SQL statement that answers the following question: List all trips where bikes were returned at location 37.331415, -121.8932. State the date the bike was borrowed. [/INST]
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;