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