db_id
stringlengths 4
31
| query
stringlengths 18
577
| question
stringlengths 16
224
| query_toks
listlengths 4
90
| query_toks_no_value
listlengths 4
125
| question_toks
listlengths 4
44
|
---|---|---|---|---|---|
college_3
|
SELECT avg(T2.gradepoint) FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T3.LName = "Smith"
|
What is the average gradepoint for students with the last name Smith?
|
[
"SELECT",
"avg",
"(",
"T2.gradepoint",
")",
"FROM",
"ENROLLED_IN",
"AS",
"T1",
"JOIN",
"GRADECONVERSION",
"AS",
"T2",
"JOIN",
"STUDENT",
"AS",
"T3",
"ON",
"T1.Grade",
"=",
"T2.lettergrade",
"AND",
"T1.StuID",
"=",
"T3.StuID",
"WHERE",
"T3.LName",
"=",
"``",
"Smith",
"''"
] |
[
"select",
"avg",
"(",
"t2",
".",
"gradepoint",
")",
"from",
"enrolled_in",
"as",
"t1",
"join",
"gradeconversion",
"as",
"t2",
"join",
"student",
"as",
"t3",
"on",
"t1",
".",
"grade",
"=",
"t2",
".",
"lettergrade",
"and",
"t1",
".",
"stuid",
"=",
"t3",
".",
"stuid",
"where",
"t3",
".",
"lname",
"=",
"value"
] |
[
"What",
"is",
"the",
"average",
"gradepoint",
"for",
"students",
"with",
"the",
"last",
"name",
"Smith",
"?"
] |
college_3
|
SELECT max(T2.gradepoint) , min(T2.gradepoint) FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T3.city_code = "NYC"
|
What is the maximum and minimum grade point of students who live in NYC?
|
[
"SELECT",
"max",
"(",
"T2.gradepoint",
")",
",",
"min",
"(",
"T2.gradepoint",
")",
"FROM",
"ENROLLED_IN",
"AS",
"T1",
"JOIN",
"GRADECONVERSION",
"AS",
"T2",
"JOIN",
"STUDENT",
"AS",
"T3",
"ON",
"T1.Grade",
"=",
"T2.lettergrade",
"AND",
"T1.StuID",
"=",
"T3.StuID",
"WHERE",
"T3.city_code",
"=",
"``",
"NYC",
"''"
] |
[
"select",
"max",
"(",
"t2",
".",
"gradepoint",
")",
",",
"min",
"(",
"t2",
".",
"gradepoint",
")",
"from",
"enrolled_in",
"as",
"t1",
"join",
"gradeconversion",
"as",
"t2",
"join",
"student",
"as",
"t3",
"on",
"t1",
".",
"grade",
"=",
"t2",
".",
"lettergrade",
"and",
"t1",
".",
"stuid",
"=",
"t3",
".",
"stuid",
"where",
"t3",
".",
"city_code",
"=",
"value"
] |
[
"What",
"is",
"the",
"maximum",
"and",
"minimum",
"grade",
"point",
"of",
"students",
"who",
"live",
"in",
"NYC",
"?"
] |
college_3
|
SELECT max(T2.gradepoint) , min(T2.gradepoint) FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T3.city_code = "NYC"
|
Give the maximum and minimum gradepoints for students living in NYC?
|
[
"SELECT",
"max",
"(",
"T2.gradepoint",
")",
",",
"min",
"(",
"T2.gradepoint",
")",
"FROM",
"ENROLLED_IN",
"AS",
"T1",
"JOIN",
"GRADECONVERSION",
"AS",
"T2",
"JOIN",
"STUDENT",
"AS",
"T3",
"ON",
"T1.Grade",
"=",
"T2.lettergrade",
"AND",
"T1.StuID",
"=",
"T3.StuID",
"WHERE",
"T3.city_code",
"=",
"``",
"NYC",
"''"
] |
[
"select",
"max",
"(",
"t2",
".",
"gradepoint",
")",
",",
"min",
"(",
"t2",
".",
"gradepoint",
")",
"from",
"enrolled_in",
"as",
"t1",
"join",
"gradeconversion",
"as",
"t2",
"join",
"student",
"as",
"t3",
"on",
"t1",
".",
"grade",
"=",
"t2",
".",
"lettergrade",
"and",
"t1",
".",
"stuid",
"=",
"t3",
".",
"stuid",
"where",
"t3",
".",
"city_code",
"=",
"value"
] |
[
"Give",
"the",
"maximum",
"and",
"minimum",
"gradepoints",
"for",
"students",
"living",
"in",
"NYC",
"?"
] |
college_3
|
SELECT CName FROM COURSE WHERE Credits = 3 UNION SELECT CName FROM COURSE WHERE Credits = 1 AND Hours = 4
|
Find the names of courses that have either 3 credits or 1 credit but 4 hours.
|
[
"SELECT",
"CName",
"FROM",
"COURSE",
"WHERE",
"Credits",
"=",
"3",
"UNION",
"SELECT",
"CName",
"FROM",
"COURSE",
"WHERE",
"Credits",
"=",
"1",
"AND",
"Hours",
"=",
"4"
] |
[
"select",
"cname",
"from",
"course",
"where",
"credits",
"=",
"value",
"union",
"select",
"cname",
"from",
"course",
"where",
"credits",
"=",
"value",
"and",
"hours",
"=",
"value"
] |
[
"Find",
"the",
"names",
"of",
"courses",
"that",
"have",
"either",
"3",
"credits",
"or",
"1",
"credit",
"but",
"4",
"hours",
"."
] |
college_3
|
SELECT CName FROM COURSE WHERE Credits = 3 UNION SELECT CName FROM COURSE WHERE Credits = 1 AND Hours = 4
|
What are the names of courses that give either 3 credits, or 1 credit and 4 hours?
|
[
"SELECT",
"CName",
"FROM",
"COURSE",
"WHERE",
"Credits",
"=",
"3",
"UNION",
"SELECT",
"CName",
"FROM",
"COURSE",
"WHERE",
"Credits",
"=",
"1",
"AND",
"Hours",
"=",
"4"
] |
[
"select",
"cname",
"from",
"course",
"where",
"credits",
"=",
"value",
"union",
"select",
"cname",
"from",
"course",
"where",
"credits",
"=",
"value",
"and",
"hours",
"=",
"value"
] |
[
"What",
"are",
"the",
"names",
"of",
"courses",
"that",
"give",
"either",
"3",
"credits",
",",
"or",
"1",
"credit",
"and",
"4",
"hours",
"?"
] |
college_3
|
SELECT DName FROM DEPARTMENT WHERE Division = "AS" UNION SELECT DName FROM DEPARTMENT WHERE Division = "EN" AND Building = "NEB"
|
Find the names of departments that are either in division AS or in division EN and in Building NEB.
|
[
"SELECT",
"DName",
"FROM",
"DEPARTMENT",
"WHERE",
"Division",
"=",
"``",
"AS",
"''",
"UNION",
"SELECT",
"DName",
"FROM",
"DEPARTMENT",
"WHERE",
"Division",
"=",
"``",
"EN",
"''",
"AND",
"Building",
"=",
"``",
"NEB",
"''"
] |
[
"select",
"dname",
"from",
"department",
"where",
"division",
"=",
"value",
"union",
"select",
"dname",
"from",
"department",
"where",
"division",
"=",
"value",
"and",
"building",
"=",
"value"
] |
[
"Find",
"the",
"names",
"of",
"departments",
"that",
"are",
"either",
"in",
"division",
"AS",
"or",
"in",
"division",
"EN",
"and",
"in",
"Building",
"NEB",
"."
] |
college_3
|
SELECT DName FROM DEPARTMENT WHERE Division = "AS" UNION SELECT DName FROM DEPARTMENT WHERE Division = "EN" AND Building = "NEB"
|
What are the names of departments either in division AS, or in division EN and in building NEB?
|
[
"SELECT",
"DName",
"FROM",
"DEPARTMENT",
"WHERE",
"Division",
"=",
"``",
"AS",
"''",
"UNION",
"SELECT",
"DName",
"FROM",
"DEPARTMENT",
"WHERE",
"Division",
"=",
"``",
"EN",
"''",
"AND",
"Building",
"=",
"``",
"NEB",
"''"
] |
[
"select",
"dname",
"from",
"department",
"where",
"division",
"=",
"value",
"union",
"select",
"dname",
"from",
"department",
"where",
"division",
"=",
"value",
"and",
"building",
"=",
"value"
] |
[
"What",
"are",
"the",
"names",
"of",
"departments",
"either",
"in",
"division",
"AS",
",",
"or",
"in",
"division",
"EN",
"and",
"in",
"building",
"NEB",
"?"
] |
college_3
|
SELECT Fname FROM STUDENT WHERE StuID NOT IN (SELECT StuID FROM ENROLLED_IN)
|
Find the first name of students not enrolled in any course.
|
[
"SELECT",
"Fname",
"FROM",
"STUDENT",
"WHERE",
"StuID",
"NOT",
"IN",
"(",
"SELECT",
"StuID",
"FROM",
"ENROLLED_IN",
")"
] |
[
"select",
"fname",
"from",
"student",
"where",
"stuid",
"not",
"in",
"(",
"select",
"stuid",
"from",
"enrolled_in",
")"
] |
[
"Find",
"the",
"first",
"name",
"of",
"students",
"not",
"enrolled",
"in",
"any",
"course",
"."
] |
college_3
|
SELECT Fname FROM STUDENT WHERE StuID NOT IN (SELECT StuID FROM ENROLLED_IN)
|
What are the first names of all students that are not enrolled in courses?
|
[
"SELECT",
"Fname",
"FROM",
"STUDENT",
"WHERE",
"StuID",
"NOT",
"IN",
"(",
"SELECT",
"StuID",
"FROM",
"ENROLLED_IN",
")"
] |
[
"select",
"fname",
"from",
"student",
"where",
"stuid",
"not",
"in",
"(",
"select",
"stuid",
"from",
"enrolled_in",
")"
] |
[
"What",
"are",
"the",
"first",
"names",
"of",
"all",
"students",
"that",
"are",
"not",
"enrolled",
"in",
"courses",
"?"
] |
department_store
|
SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3
|
What are the ids of the top three products that were purchased in the largest amount?
|
[
"SELECT",
"product_id",
"FROM",
"product_suppliers",
"ORDER",
"BY",
"total_amount_purchased",
"DESC",
"LIMIT",
"3"
] |
[
"select",
"product_id",
"from",
"product_suppliers",
"order",
"by",
"total_amount_purchased",
"desc",
"limit",
"value"
] |
[
"What",
"are",
"the",
"ids",
"of",
"the",
"top",
"three",
"products",
"that",
"were",
"purchased",
"in",
"the",
"largest",
"amount",
"?"
] |
department_store
|
SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3
|
Give the ids of the three products purchased in the largest amounts.
|
[
"SELECT",
"product_id",
"FROM",
"product_suppliers",
"ORDER",
"BY",
"total_amount_purchased",
"DESC",
"LIMIT",
"3"
] |
[
"select",
"product_id",
"from",
"product_suppliers",
"order",
"by",
"total_amount_purchased",
"desc",
"limit",
"value"
] |
[
"Give",
"the",
"ids",
"of",
"the",
"three",
"products",
"purchased",
"in",
"the",
"largest",
"amounts",
"."
] |
department_store
|
SELECT product_id , product_type_code FROM products ORDER BY product_price LIMIT 1
|
What are the product id and product type of the cheapest product?
|
[
"SELECT",
"product_id",
",",
"product_type_code",
"FROM",
"products",
"ORDER",
"BY",
"product_price",
"LIMIT",
"1"
] |
[
"select",
"product_id",
",",
"product_type_code",
"from",
"products",
"order",
"by",
"product_price",
"limit",
"value"
] |
[
"What",
"are",
"the",
"product",
"id",
"and",
"product",
"type",
"of",
"the",
"cheapest",
"product",
"?"
] |
department_store
|
SELECT product_id , product_type_code FROM products ORDER BY product_price LIMIT 1
|
Give the id and product type of the product with the lowest price.
|
[
"SELECT",
"product_id",
",",
"product_type_code",
"FROM",
"products",
"ORDER",
"BY",
"product_price",
"LIMIT",
"1"
] |
[
"select",
"product_id",
",",
"product_type_code",
"from",
"products",
"order",
"by",
"product_price",
"limit",
"value"
] |
[
"Give",
"the",
"id",
"and",
"product",
"type",
"of",
"the",
"product",
"with",
"the",
"lowest",
"price",
"."
] |
department_store
|
SELECT count(DISTINCT product_type_code) FROM products
|
Find the number of different product types.
|
[
"SELECT",
"count",
"(",
"DISTINCT",
"product_type_code",
")",
"FROM",
"products"
] |
[
"select",
"count",
"(",
"distinct",
"product_type_code",
")",
"from",
"products"
] |
[
"Find",
"the",
"number",
"of",
"different",
"product",
"types",
"."
] |
department_store
|
SELECT count(DISTINCT product_type_code) FROM products
|
Count the number of distinct product types.
|
[
"SELECT",
"count",
"(",
"DISTINCT",
"product_type_code",
")",
"FROM",
"products"
] |
[
"select",
"count",
"(",
"distinct",
"product_type_code",
")",
"from",
"products"
] |
[
"Count",
"the",
"number",
"of",
"distinct",
"product",
"types",
"."
] |
department_store
|
SELECT T1.address_details FROM addresses AS T1 JOIN customer_addresses AS T2 ON T1.address_id = T2.address_id WHERE T2.customer_id = 10
|
Return the address of customer 10.
|
[
"SELECT",
"T1.address_details",
"FROM",
"addresses",
"AS",
"T1",
"JOIN",
"customer_addresses",
"AS",
"T2",
"ON",
"T1.address_id",
"=",
"T2.address_id",
"WHERE",
"T2.customer_id",
"=",
"10"
] |
[
"select",
"t1",
".",
"address_details",
"from",
"addresses",
"as",
"t1",
"join",
"customer_addresses",
"as",
"t2",
"on",
"t1",
".",
"address_id",
"=",
"t2",
".",
"address_id",
"where",
"t2",
".",
"customer_id",
"=",
"value"
] |
[
"Return",
"the",
"address",
"of",
"customer",
"10",
"."
] |
department_store
|
SELECT T1.address_details FROM addresses AS T1 JOIN customer_addresses AS T2 ON T1.address_id = T2.address_id WHERE T2.customer_id = 10
|
What is the address for the customer with id 10?
|
[
"SELECT",
"T1.address_details",
"FROM",
"addresses",
"AS",
"T1",
"JOIN",
"customer_addresses",
"AS",
"T2",
"ON",
"T1.address_id",
"=",
"T2.address_id",
"WHERE",
"T2.customer_id",
"=",
"10"
] |
[
"select",
"t1",
".",
"address_details",
"from",
"addresses",
"as",
"t1",
"join",
"customer_addresses",
"as",
"t2",
"on",
"t1",
".",
"address_id",
"=",
"t2",
".",
"address_id",
"where",
"t2",
".",
"customer_id",
"=",
"value"
] |
[
"What",
"is",
"the",
"address",
"for",
"the",
"customer",
"with",
"id",
"10",
"?"
] |
department_store
|
SELECT T1.staff_id , T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Department Manager"
|
What are the staff ids and genders of all staffs whose job title is Department Manager?
|
[
"SELECT",
"T1.staff_id",
",",
"T1.staff_gender",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"staff_department_assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"WHERE",
"T2.job_title_code",
"=",
"``",
"Department",
"Manager",
"''"
] |
[
"select",
"t1",
".",
"staff_id",
",",
"t1",
".",
"staff_gender",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"where",
"t2",
".",
"job_title_code",
"=",
"value"
] |
[
"What",
"are",
"the",
"staff",
"ids",
"and",
"genders",
"of",
"all",
"staffs",
"whose",
"job",
"title",
"is",
"Department",
"Manager",
"?"
] |
department_store
|
SELECT T1.staff_id , T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Department Manager"
|
Return the staff ids and genders for any staff with the title Department Manager.
|
[
"SELECT",
"T1.staff_id",
",",
"T1.staff_gender",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"staff_department_assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"WHERE",
"T2.job_title_code",
"=",
"``",
"Department",
"Manager",
"''"
] |
[
"select",
"t1",
".",
"staff_id",
",",
"t1",
".",
"staff_gender",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"where",
"t2",
".",
"job_title_code",
"=",
"value"
] |
[
"Return",
"the",
"staff",
"ids",
"and",
"genders",
"for",
"any",
"staff",
"with",
"the",
"title",
"Department",
"Manager",
"."
] |
department_store
|
SELECT payment_method_code , count(*) FROM customers GROUP BY payment_method_code
|
For each payment method, return how many customers use it.
|
[
"SELECT",
"payment_method_code",
",",
"count",
"(",
"*",
")",
"FROM",
"customers",
"GROUP",
"BY",
"payment_method_code"
] |
[
"select",
"payment_method_code",
",",
"count",
"(",
"*",
")",
"from",
"customers",
"group",
"by",
"payment_method_code"
] |
[
"For",
"each",
"payment",
"method",
",",
"return",
"how",
"many",
"customers",
"use",
"it",
"."
] |
department_store
|
SELECT payment_method_code , count(*) FROM customers GROUP BY payment_method_code
|
How many customers use each payment method?
|
[
"SELECT",
"payment_method_code",
",",
"count",
"(",
"*",
")",
"FROM",
"customers",
"GROUP",
"BY",
"payment_method_code"
] |
[
"select",
"payment_method_code",
",",
"count",
"(",
"*",
")",
"from",
"customers",
"group",
"by",
"payment_method_code"
] |
[
"How",
"many",
"customers",
"use",
"each",
"payment",
"method",
"?"
] |
department_store
|
SELECT product_id FROM order_items GROUP BY product_id ORDER BY count(*) DESC LIMIT 1
|
What is the id of the product that was ordered the most often?
|
[
"SELECT",
"product_id",
"FROM",
"order_items",
"GROUP",
"BY",
"product_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"product_id",
"from",
"order_items",
"group",
"by",
"product_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"What",
"is",
"the",
"id",
"of",
"the",
"product",
"that",
"was",
"ordered",
"the",
"most",
"often",
"?"
] |
department_store
|
SELECT product_id FROM order_items GROUP BY product_id ORDER BY count(*) DESC LIMIT 1
|
Give the product id for the product that was ordered most frequently.
|
[
"SELECT",
"product_id",
"FROM",
"order_items",
"GROUP",
"BY",
"product_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"product_id",
"from",
"order_items",
"group",
"by",
"product_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"Give",
"the",
"product",
"id",
"for",
"the",
"product",
"that",
"was",
"ordered",
"most",
"frequently",
"."
] |
department_store
|
SELECT T1.customer_name , T1.customer_phone , T1.customer_email FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id ORDER BY count(*) DESC LIMIT 1
|
What are the name, phone number and email address of the customer who made the largest number of orders?
|
[
"SELECT",
"T1.customer_name",
",",
"T1.customer_phone",
",",
"T1.customer_email",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"GROUP",
"BY",
"T2.customer_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"t1",
".",
"customer_name",
",",
"t1",
".",
"customer_phone",
",",
"t1",
".",
"customer_email",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"group",
"by",
"t2",
".",
"customer_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"What",
"are",
"the",
"name",
",",
"phone",
"number",
"and",
"email",
"address",
"of",
"the",
"customer",
"who",
"made",
"the",
"largest",
"number",
"of",
"orders",
"?"
] |
department_store
|
SELECT T1.customer_name , T1.customer_phone , T1.customer_email FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id ORDER BY count(*) DESC LIMIT 1
|
Return the name, phone number and email address for the customer with the most orders.
|
[
"SELECT",
"T1.customer_name",
",",
"T1.customer_phone",
",",
"T1.customer_email",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"GROUP",
"BY",
"T2.customer_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"t1",
".",
"customer_name",
",",
"t1",
".",
"customer_phone",
",",
"t1",
".",
"customer_email",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"group",
"by",
"t2",
".",
"customer_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"Return",
"the",
"name",
",",
"phone",
"number",
"and",
"email",
"address",
"for",
"the",
"customer",
"with",
"the",
"most",
"orders",
"."
] |
department_store
|
SELECT product_type_code , avg(product_price) FROM products GROUP BY product_type_code
|
What is the average price for each type of product?
|
[
"SELECT",
"product_type_code",
",",
"avg",
"(",
"product_price",
")",
"FROM",
"products",
"GROUP",
"BY",
"product_type_code"
] |
[
"select",
"product_type_code",
",",
"avg",
"(",
"product_price",
")",
"from",
"products",
"group",
"by",
"product_type_code"
] |
[
"What",
"is",
"the",
"average",
"price",
"for",
"each",
"type",
"of",
"product",
"?"
] |
department_store
|
SELECT product_type_code , avg(product_price) FROM products GROUP BY product_type_code
|
Return the average price for each product type.
|
[
"SELECT",
"product_type_code",
",",
"avg",
"(",
"product_price",
")",
"FROM",
"products",
"GROUP",
"BY",
"product_type_code"
] |
[
"select",
"product_type_code",
",",
"avg",
"(",
"product_price",
")",
"from",
"products",
"group",
"by",
"product_type_code"
] |
[
"Return",
"the",
"average",
"price",
"for",
"each",
"product",
"type",
"."
] |
department_store
|
SELECT count(*) FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id WHERE T2.dept_store_chain_name = "South"
|
How many department stores does the store chain South have?
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"department_stores",
"AS",
"T1",
"JOIN",
"department_store_chain",
"AS",
"T2",
"ON",
"T1.dept_store_chain_id",
"=",
"T2.dept_store_chain_id",
"WHERE",
"T2.dept_store_chain_name",
"=",
"``",
"South",
"''"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"department_stores",
"as",
"t1",
"join",
"department_store_chain",
"as",
"t2",
"on",
"t1",
".",
"dept_store_chain_id",
"=",
"t2",
".",
"dept_store_chain_id",
"where",
"t2",
".",
"dept_store_chain_name",
"=",
"value"
] |
[
"How",
"many",
"department",
"stores",
"does",
"the",
"store",
"chain",
"South",
"have",
"?"
] |
department_store
|
SELECT count(*) FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id WHERE T2.dept_store_chain_name = "South"
|
Count the number of stores the chain South has.
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"department_stores",
"AS",
"T1",
"JOIN",
"department_store_chain",
"AS",
"T2",
"ON",
"T1.dept_store_chain_id",
"=",
"T2.dept_store_chain_id",
"WHERE",
"T2.dept_store_chain_name",
"=",
"``",
"South",
"''"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"department_stores",
"as",
"t1",
"join",
"department_store_chain",
"as",
"t2",
"on",
"t1",
".",
"dept_store_chain_id",
"=",
"t2",
".",
"dept_store_chain_id",
"where",
"t2",
".",
"dept_store_chain_name",
"=",
"value"
] |
[
"Count",
"the",
"number",
"of",
"stores",
"the",
"chain",
"South",
"has",
"."
] |
department_store
|
SELECT T1.staff_name , T2.job_title_code FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1
|
What is the name and job title of the staff who was assigned the latest?
|
[
"SELECT",
"T1.staff_name",
",",
"T2.job_title_code",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"staff_department_assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"ORDER",
"BY",
"T2.date_assigned_to",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"t1",
".",
"staff_name",
",",
"t2",
".",
"job_title_code",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"order",
"by",
"t2",
".",
"date_assigned_to",
"desc",
"limit",
"value"
] |
[
"What",
"is",
"the",
"name",
"and",
"job",
"title",
"of",
"the",
"staff",
"who",
"was",
"assigned",
"the",
"latest",
"?"
] |
department_store
|
SELECT T1.staff_name , T2.job_title_code FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1
|
Return the name and job title of the staff with the latest date assigned.
|
[
"SELECT",
"T1.staff_name",
",",
"T2.job_title_code",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"staff_department_assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"ORDER",
"BY",
"T2.date_assigned_to",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"t1",
".",
"staff_name",
",",
"t2",
".",
"job_title_code",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"order",
"by",
"t2",
".",
"date_assigned_to",
"desc",
"limit",
"value"
] |
[
"Return",
"the",
"name",
"and",
"job",
"title",
"of",
"the",
"staff",
"with",
"the",
"latest",
"date",
"assigned",
"."
] |
department_store
|
SELECT T2.product_type_code , T2.product_name , T2.product_price FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 3
|
Give me the product type, name and price for all the products supplied by supplier id 3.
|
[
"SELECT",
"T2.product_type_code",
",",
"T2.product_name",
",",
"T2.product_price",
"FROM",
"product_suppliers",
"AS",
"T1",
"JOIN",
"products",
"AS",
"T2",
"ON",
"T1.product_id",
"=",
"T2.product_id",
"WHERE",
"T1.supplier_id",
"=",
"3"
] |
[
"select",
"t2",
".",
"product_type_code",
",",
"t2",
".",
"product_name",
",",
"t2",
".",
"product_price",
"from",
"product_suppliers",
"as",
"t1",
"join",
"products",
"as",
"t2",
"on",
"t1",
".",
"product_id",
"=",
"t2",
".",
"product_id",
"where",
"t1",
".",
"supplier_id",
"=",
"value"
] |
[
"Give",
"me",
"the",
"product",
"type",
",",
"name",
"and",
"price",
"for",
"all",
"the",
"products",
"supplied",
"by",
"supplier",
"id",
"3",
"."
] |
department_store
|
SELECT T2.product_type_code , T2.product_name , T2.product_price FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 3
|
Return the product type, name, and price for products supplied by supplier 3.
|
[
"SELECT",
"T2.product_type_code",
",",
"T2.product_name",
",",
"T2.product_price",
"FROM",
"product_suppliers",
"AS",
"T1",
"JOIN",
"products",
"AS",
"T2",
"ON",
"T1.product_id",
"=",
"T2.product_id",
"WHERE",
"T1.supplier_id",
"=",
"3"
] |
[
"select",
"t2",
".",
"product_type_code",
",",
"t2",
".",
"product_name",
",",
"t2",
".",
"product_price",
"from",
"product_suppliers",
"as",
"t1",
"join",
"products",
"as",
"t2",
"on",
"t1",
".",
"product_id",
"=",
"t2",
".",
"product_id",
"where",
"t1",
".",
"supplier_id",
"=",
"value"
] |
[
"Return",
"the",
"product",
"type",
",",
"name",
",",
"and",
"price",
"for",
"products",
"supplied",
"by",
"supplier",
"3",
"."
] |
department_store
|
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Pending" ORDER BY T2.customer_id
|
Return the distinct name of customers whose order status is Pending, in the order of customer id.
|
[
"SELECT",
"DISTINCT",
"T1.customer_name",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"WHERE",
"T2.order_status_code",
"=",
"``",
"Pending",
"''",
"ORDER",
"BY",
"T2.customer_id"
] |
[
"select",
"distinct",
"t1",
".",
"customer_name",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"where",
"t2",
".",
"order_status_code",
"=",
"value",
"order",
"by",
"t2",
".",
"customer_id"
] |
[
"Return",
"the",
"distinct",
"name",
"of",
"customers",
"whose",
"order",
"status",
"is",
"Pending",
",",
"in",
"the",
"order",
"of",
"customer",
"id",
"."
] |
department_store
|
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Pending" ORDER BY T2.customer_id
|
What are the distinct names of customers with an order status of Pending, sorted by customer id?
|
[
"SELECT",
"DISTINCT",
"T1.customer_name",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"WHERE",
"T2.order_status_code",
"=",
"``",
"Pending",
"''",
"ORDER",
"BY",
"T2.customer_id"
] |
[
"select",
"distinct",
"t1",
".",
"customer_name",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"where",
"t2",
".",
"order_status_code",
"=",
"value",
"order",
"by",
"t2",
".",
"customer_id"
] |
[
"What",
"are",
"the",
"distinct",
"names",
"of",
"customers",
"with",
"an",
"order",
"status",
"of",
"Pending",
",",
"sorted",
"by",
"customer",
"id",
"?"
] |
department_store
|
SELECT T1.customer_name , T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "New" INTERSECT SELECT T1.customer_name , T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Pending"
|
Find the name and address of the customers who have both New and Pending orders.
|
[
"SELECT",
"T1.customer_name",
",",
"T1.customer_address",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"WHERE",
"T2.order_status_code",
"=",
"``",
"New",
"''",
"INTERSECT",
"SELECT",
"T1.customer_name",
",",
"T1.customer_address",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"WHERE",
"T2.order_status_code",
"=",
"``",
"Pending",
"''"
] |
[
"select",
"t1",
".",
"customer_name",
",",
"t1",
".",
"customer_address",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"where",
"t2",
".",
"order_status_code",
"=",
"value",
"intersect",
"select",
"t1",
".",
"customer_name",
",",
"t1",
".",
"customer_address",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"where",
"t2",
".",
"order_status_code",
"=",
"value"
] |
[
"Find",
"the",
"name",
"and",
"address",
"of",
"the",
"customers",
"who",
"have",
"both",
"New",
"and",
"Pending",
"orders",
"."
] |
department_store
|
SELECT T1.customer_name , T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "New" INTERSECT SELECT T1.customer_name , T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Pending"
|
What are the names and addressed of customers who have both New and Pending orders?
|
[
"SELECT",
"T1.customer_name",
",",
"T1.customer_address",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"WHERE",
"T2.order_status_code",
"=",
"``",
"New",
"''",
"INTERSECT",
"SELECT",
"T1.customer_name",
",",
"T1.customer_address",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"WHERE",
"T2.order_status_code",
"=",
"``",
"Pending",
"''"
] |
[
"select",
"t1",
".",
"customer_name",
",",
"t1",
".",
"customer_address",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"where",
"t2",
".",
"order_status_code",
"=",
"value",
"intersect",
"select",
"t1",
".",
"customer_name",
",",
"t1",
".",
"customer_address",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"where",
"t2",
".",
"order_status_code",
"=",
"value"
] |
[
"What",
"are",
"the",
"names",
"and",
"addressed",
"of",
"customers",
"who",
"have",
"both",
"New",
"and",
"Pending",
"orders",
"?"
] |
department_store
|
SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 2 AND T2.product_price > (SELECT avg(product_price) FROM products)
|
Return ids of all the products that are supplied by supplier id 2 and are more expensive than the average price of all products.
|
[
"SELECT",
"T1.product_id",
"FROM",
"product_suppliers",
"AS",
"T1",
"JOIN",
"products",
"AS",
"T2",
"ON",
"T1.product_id",
"=",
"T2.product_id",
"WHERE",
"T1.supplier_id",
"=",
"2",
"AND",
"T2.product_price",
">",
"(",
"SELECT",
"avg",
"(",
"product_price",
")",
"FROM",
"products",
")"
] |
[
"select",
"t1",
".",
"product_id",
"from",
"product_suppliers",
"as",
"t1",
"join",
"products",
"as",
"t2",
"on",
"t1",
".",
"product_id",
"=",
"t2",
".",
"product_id",
"where",
"t1",
".",
"supplier_id",
"=",
"value",
"and",
"t2",
".",
"product_price",
">",
"(",
"select",
"avg",
"(",
"product_price",
")",
"from",
"products",
")"
] |
[
"Return",
"ids",
"of",
"all",
"the",
"products",
"that",
"are",
"supplied",
"by",
"supplier",
"id",
"2",
"and",
"are",
"more",
"expensive",
"than",
"the",
"average",
"price",
"of",
"all",
"products",
"."
] |
department_store
|
SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 2 AND T2.product_price > (SELECT avg(product_price) FROM products)
|
What are the ids of products from the supplier with id 2, which are more expensive than the average price across all products?
|
[
"SELECT",
"T1.product_id",
"FROM",
"product_suppliers",
"AS",
"T1",
"JOIN",
"products",
"AS",
"T2",
"ON",
"T1.product_id",
"=",
"T2.product_id",
"WHERE",
"T1.supplier_id",
"=",
"2",
"AND",
"T2.product_price",
">",
"(",
"SELECT",
"avg",
"(",
"product_price",
")",
"FROM",
"products",
")"
] |
[
"select",
"t1",
".",
"product_id",
"from",
"product_suppliers",
"as",
"t1",
"join",
"products",
"as",
"t2",
"on",
"t1",
".",
"product_id",
"=",
"t2",
".",
"product_id",
"where",
"t1",
".",
"supplier_id",
"=",
"value",
"and",
"t2",
".",
"product_price",
">",
"(",
"select",
"avg",
"(",
"product_price",
")",
"from",
"products",
")"
] |
[
"What",
"are",
"the",
"ids",
"of",
"products",
"from",
"the",
"supplier",
"with",
"id",
"2",
",",
"which",
"are",
"more",
"expensive",
"than",
"the",
"average",
"price",
"across",
"all",
"products",
"?"
] |
department_store
|
SELECT T2.dept_store_id , T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = "marketing" INTERSECT SELECT T2.dept_store_id , T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = "managing"
|
What is the id and name of the department store that has both marketing and managing department?
|
[
"SELECT",
"T2.dept_store_id",
",",
"T2.store_name",
"FROM",
"departments",
"AS",
"T1",
"JOIN",
"department_stores",
"AS",
"T2",
"ON",
"T1.dept_store_id",
"=",
"T2.dept_store_id",
"WHERE",
"T1.department_name",
"=",
"``",
"marketing",
"''",
"INTERSECT",
"SELECT",
"T2.dept_store_id",
",",
"T2.store_name",
"FROM",
"departments",
"AS",
"T1",
"JOIN",
"department_stores",
"AS",
"T2",
"ON",
"T1.dept_store_id",
"=",
"T2.dept_store_id",
"WHERE",
"T1.department_name",
"=",
"``",
"managing",
"''"
] |
[
"select",
"t2",
".",
"dept_store_id",
",",
"t2",
".",
"store_name",
"from",
"departments",
"as",
"t1",
"join",
"department_stores",
"as",
"t2",
"on",
"t1",
".",
"dept_store_id",
"=",
"t2",
".",
"dept_store_id",
"where",
"t1",
".",
"department_name",
"=",
"value",
"intersect",
"select",
"t2",
".",
"dept_store_id",
",",
"t2",
".",
"store_name",
"from",
"departments",
"as",
"t1",
"join",
"department_stores",
"as",
"t2",
"on",
"t1",
".",
"dept_store_id",
"=",
"t2",
".",
"dept_store_id",
"where",
"t1",
".",
"department_name",
"=",
"value"
] |
[
"What",
"is",
"the",
"id",
"and",
"name",
"of",
"the",
"department",
"store",
"that",
"has",
"both",
"marketing",
"and",
"managing",
"department",
"?"
] |
department_store
|
SELECT T2.dept_store_id , T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = "marketing" INTERSECT SELECT T2.dept_store_id , T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id = T2.dept_store_id WHERE T1.department_name = "managing"
|
What are the ids and names of department stores with both marketing and managing departments?
|
[
"SELECT",
"T2.dept_store_id",
",",
"T2.store_name",
"FROM",
"departments",
"AS",
"T1",
"JOIN",
"department_stores",
"AS",
"T2",
"ON",
"T1.dept_store_id",
"=",
"T2.dept_store_id",
"WHERE",
"T1.department_name",
"=",
"``",
"marketing",
"''",
"INTERSECT",
"SELECT",
"T2.dept_store_id",
",",
"T2.store_name",
"FROM",
"departments",
"AS",
"T1",
"JOIN",
"department_stores",
"AS",
"T2",
"ON",
"T1.dept_store_id",
"=",
"T2.dept_store_id",
"WHERE",
"T1.department_name",
"=",
"``",
"managing",
"''"
] |
[
"select",
"t2",
".",
"dept_store_id",
",",
"t2",
".",
"store_name",
"from",
"departments",
"as",
"t1",
"join",
"department_stores",
"as",
"t2",
"on",
"t1",
".",
"dept_store_id",
"=",
"t2",
".",
"dept_store_id",
"where",
"t1",
".",
"department_name",
"=",
"value",
"intersect",
"select",
"t2",
".",
"dept_store_id",
",",
"t2",
".",
"store_name",
"from",
"departments",
"as",
"t1",
"join",
"department_stores",
"as",
"t2",
"on",
"t1",
".",
"dept_store_id",
"=",
"t2",
".",
"dept_store_id",
"where",
"t1",
".",
"department_name",
"=",
"value"
] |
[
"What",
"are",
"the",
"ids",
"and",
"names",
"of",
"department",
"stores",
"with",
"both",
"marketing",
"and",
"managing",
"departments",
"?"
] |
department_store
|
SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY count(*) DESC LIMIT 2
|
What are the ids of the two department store chains with the largest number of department stores?
|
[
"SELECT",
"dept_store_chain_id",
"FROM",
"department_stores",
"GROUP",
"BY",
"dept_store_chain_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"2"
] |
[
"select",
"dept_store_chain_id",
"from",
"department_stores",
"group",
"by",
"dept_store_chain_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"What",
"are",
"the",
"ids",
"of",
"the",
"two",
"department",
"store",
"chains",
"with",
"the",
"largest",
"number",
"of",
"department",
"stores",
"?"
] |
department_store
|
SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY count(*) DESC LIMIT 2
|
Return the ids of the two department store chains with the most department stores.
|
[
"SELECT",
"dept_store_chain_id",
"FROM",
"department_stores",
"GROUP",
"BY",
"dept_store_chain_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"2"
] |
[
"select",
"dept_store_chain_id",
"from",
"department_stores",
"group",
"by",
"dept_store_chain_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] |
[
"Return",
"the",
"ids",
"of",
"the",
"two",
"department",
"store",
"chains",
"with",
"the",
"most",
"department",
"stores",
"."
] |
department_store
|
SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY count(*) LIMIT 1
|
What is the id of the department with the least number of staff?
|
[
"SELECT",
"department_id",
"FROM",
"staff_department_assignments",
"GROUP",
"BY",
"department_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"LIMIT",
"1"
] |
[
"select",
"department_id",
"from",
"staff_department_assignments",
"group",
"by",
"department_id",
"order",
"by",
"count",
"(",
"*",
")",
"limit",
"value"
] |
[
"What",
"is",
"the",
"id",
"of",
"the",
"department",
"with",
"the",
"least",
"number",
"of",
"staff",
"?"
] |
department_store
|
SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY count(*) LIMIT 1
|
Return the id of the department with the fewest staff assignments.
|
[
"SELECT",
"department_id",
"FROM",
"staff_department_assignments",
"GROUP",
"BY",
"department_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"LIMIT",
"1"
] |
[
"select",
"department_id",
"from",
"staff_department_assignments",
"group",
"by",
"department_id",
"order",
"by",
"count",
"(",
"*",
")",
"limit",
"value"
] |
[
"Return",
"the",
"id",
"of",
"the",
"department",
"with",
"the",
"fewest",
"staff",
"assignments",
"."
] |
department_store
|
SELECT product_type_code , max(product_price) , min(product_price) FROM products GROUP BY product_type_code
|
For each product type, return the maximum and minimum price.
|
[
"SELECT",
"product_type_code",
",",
"max",
"(",
"product_price",
")",
",",
"min",
"(",
"product_price",
")",
"FROM",
"products",
"GROUP",
"BY",
"product_type_code"
] |
[
"select",
"product_type_code",
",",
"max",
"(",
"product_price",
")",
",",
"min",
"(",
"product_price",
")",
"from",
"products",
"group",
"by",
"product_type_code"
] |
[
"For",
"each",
"product",
"type",
",",
"return",
"the",
"maximum",
"and",
"minimum",
"price",
"."
] |
department_store
|
SELECT product_type_code , max(product_price) , min(product_price) FROM products GROUP BY product_type_code
|
What are the maximum and minimum product prices for each product type?
|
[
"SELECT",
"product_type_code",
",",
"max",
"(",
"product_price",
")",
",",
"min",
"(",
"product_price",
")",
"FROM",
"products",
"GROUP",
"BY",
"product_type_code"
] |
[
"select",
"product_type_code",
",",
"max",
"(",
"product_price",
")",
",",
"min",
"(",
"product_price",
")",
"from",
"products",
"group",
"by",
"product_type_code"
] |
[
"What",
"are",
"the",
"maximum",
"and",
"minimum",
"product",
"prices",
"for",
"each",
"product",
"type",
"?"
] |
department_store
|
SELECT product_type_code FROM products GROUP BY product_type_code HAVING avg(product_price) > (SELECT avg(product_price) FROM products)
|
Find the product type whose average price is higher than the average price of all products.
|
[
"SELECT",
"product_type_code",
"FROM",
"products",
"GROUP",
"BY",
"product_type_code",
"HAVING",
"avg",
"(",
"product_price",
")",
">",
"(",
"SELECT",
"avg",
"(",
"product_price",
")",
"FROM",
"products",
")"
] |
[
"select",
"product_type_code",
"from",
"products",
"group",
"by",
"product_type_code",
"having",
"avg",
"(",
"product_price",
")",
">",
"(",
"select",
"avg",
"(",
"product_price",
")",
"from",
"products",
")"
] |
[
"Find",
"the",
"product",
"type",
"whose",
"average",
"price",
"is",
"higher",
"than",
"the",
"average",
"price",
"of",
"all",
"products",
"."
] |
department_store
|
SELECT product_type_code FROM products GROUP BY product_type_code HAVING avg(product_price) > (SELECT avg(product_price) FROM products)
|
What is the code of the product type with an average price higher than the average price of all products?
|
[
"SELECT",
"product_type_code",
"FROM",
"products",
"GROUP",
"BY",
"product_type_code",
"HAVING",
"avg",
"(",
"product_price",
")",
">",
"(",
"SELECT",
"avg",
"(",
"product_price",
")",
"FROM",
"products",
")"
] |
[
"select",
"product_type_code",
"from",
"products",
"group",
"by",
"product_type_code",
"having",
"avg",
"(",
"product_price",
")",
">",
"(",
"select",
"avg",
"(",
"product_price",
")",
"from",
"products",
")"
] |
[
"What",
"is",
"the",
"code",
"of",
"the",
"product",
"type",
"with",
"an",
"average",
"price",
"higher",
"than",
"the",
"average",
"price",
"of",
"all",
"products",
"?"
] |
department_store
|
SELECT T1.staff_id , T1.staff_name FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY date_assigned_to - date_assigned_from LIMIT 1
|
Find the id and name of the staff who has been assigned for the shortest period.
|
[
"SELECT",
"T1.staff_id",
",",
"T1.staff_name",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"Staff_Department_Assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"ORDER",
"BY",
"date_assigned_to",
"-",
"date_assigned_from",
"LIMIT",
"1"
] |
[
"select",
"t1",
".",
"staff_id",
",",
"t1",
".",
"staff_name",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"order",
"by",
"date_assigned_to",
"-",
"date_assigned_from",
"limit",
"value"
] |
[
"Find",
"the",
"id",
"and",
"name",
"of",
"the",
"staff",
"who",
"has",
"been",
"assigned",
"for",
"the",
"shortest",
"period",
"."
] |
department_store
|
SELECT T1.staff_id , T1.staff_name FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY date_assigned_to - date_assigned_from LIMIT 1
|
What is the id and name of the staff who has been assigned for the least amount of time?
|
[
"SELECT",
"T1.staff_id",
",",
"T1.staff_name",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"Staff_Department_Assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"ORDER",
"BY",
"date_assigned_to",
"-",
"date_assigned_from",
"LIMIT",
"1"
] |
[
"select",
"t1",
".",
"staff_id",
",",
"t1",
".",
"staff_name",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"order",
"by",
"date_assigned_to",
"-",
"date_assigned_from",
"limit",
"value"
] |
[
"What",
"is",
"the",
"id",
"and",
"name",
"of",
"the",
"staff",
"who",
"has",
"been",
"assigned",
"for",
"the",
"least",
"amount",
"of",
"time",
"?"
] |
department_store
|
SELECT product_name , product_id FROM products WHERE product_price BETWEEN 600 AND 700
|
Return the names and ids of all products whose price is between 600 and 700.
|
[
"SELECT",
"product_name",
",",
"product_id",
"FROM",
"products",
"WHERE",
"product_price",
"BETWEEN",
"600",
"AND",
"700"
] |
[
"select",
"product_name",
",",
"product_id",
"from",
"products",
"where",
"product_price",
"between",
"value",
"and",
"value"
] |
[
"Return",
"the",
"names",
"and",
"ids",
"of",
"all",
"products",
"whose",
"price",
"is",
"between",
"600",
"and",
"700",
"."
] |
department_store
|
SELECT product_name , product_id FROM products WHERE product_price BETWEEN 600 AND 700
|
What are the names and ids of products costing between 600 and 700?
|
[
"SELECT",
"product_name",
",",
"product_id",
"FROM",
"products",
"WHERE",
"product_price",
"BETWEEN",
"600",
"AND",
"700"
] |
[
"select",
"product_name",
",",
"product_id",
"from",
"products",
"where",
"product_price",
"between",
"value",
"and",
"value"
] |
[
"What",
"are",
"the",
"names",
"and",
"ids",
"of",
"products",
"costing",
"between",
"600",
"and",
"700",
"?"
] |
department_store
|
SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date > (SELECT min(order_date) FROM Customer_Orders WHERE order_status_code = "Cancelled")
|
Find the ids of all distinct customers who made order after some orders that were Cancelled.
|
[
"SELECT",
"DISTINCT",
"customer_id",
"FROM",
"Customer_Orders",
"WHERE",
"order_date",
">",
"(",
"SELECT",
"min",
"(",
"order_date",
")",
"FROM",
"Customer_Orders",
"WHERE",
"order_status_code",
"=",
"``",
"Cancelled",
"''",
")"
] |
[
"select",
"distinct",
"customer_id",
"from",
"customer_orders",
"where",
"order_date",
">",
"(",
"select",
"min",
"(",
"order_date",
")",
"from",
"customer_orders",
"where",
"order_status_code",
"=",
"value",
")"
] |
[
"Find",
"the",
"ids",
"of",
"all",
"distinct",
"customers",
"who",
"made",
"order",
"after",
"some",
"orders",
"that",
"were",
"Cancelled",
"."
] |
department_store
|
SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date > (SELECT min(order_date) FROM Customer_Orders WHERE order_status_code = "Cancelled")
|
What are the distinct ids of customers who made an order after any order that was Cancelled?
|
[
"SELECT",
"DISTINCT",
"customer_id",
"FROM",
"Customer_Orders",
"WHERE",
"order_date",
">",
"(",
"SELECT",
"min",
"(",
"order_date",
")",
"FROM",
"Customer_Orders",
"WHERE",
"order_status_code",
"=",
"``",
"Cancelled",
"''",
")"
] |
[
"select",
"distinct",
"customer_id",
"from",
"customer_orders",
"where",
"order_date",
">",
"(",
"select",
"min",
"(",
"order_date",
")",
"from",
"customer_orders",
"where",
"order_status_code",
"=",
"value",
")"
] |
[
"What",
"are",
"the",
"distinct",
"ids",
"of",
"customers",
"who",
"made",
"an",
"order",
"after",
"any",
"order",
"that",
"was",
"Cancelled",
"?"
] |
department_store
|
SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to < (SELECT max(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code = 'Clerical Staff')
|
What is id of the staff who had a Staff Department Assignment earlier than any Clerical Staff?
|
[
"SELECT",
"staff_id",
"FROM",
"Staff_Department_Assignments",
"WHERE",
"date_assigned_to",
"<",
"(",
"SELECT",
"max",
"(",
"date_assigned_to",
")",
"FROM",
"Staff_Department_Assignments",
"WHERE",
"job_title_code",
"=",
"'Clerical",
"Staff",
"'",
")"
] |
[
"select",
"staff_id",
"from",
"staff_department_assignments",
"where",
"date_assigned_to",
"<",
"(",
"select",
"max",
"(",
"date_assigned_to",
")",
"from",
"staff_department_assignments",
"where",
"job_title_code",
"=",
"value",
")"
] |
[
"What",
"is",
"id",
"of",
"the",
"staff",
"who",
"had",
"a",
"Staff",
"Department",
"Assignment",
"earlier",
"than",
"any",
"Clerical",
"Staff",
"?"
] |
department_store
|
SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to < (SELECT max(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code = 'Clerical Staff')
|
Return the id of the staff whose Staff Department Assignment was earlier than that of any Clerical Staff.
|
[
"SELECT",
"staff_id",
"FROM",
"Staff_Department_Assignments",
"WHERE",
"date_assigned_to",
"<",
"(",
"SELECT",
"max",
"(",
"date_assigned_to",
")",
"FROM",
"Staff_Department_Assignments",
"WHERE",
"job_title_code",
"=",
"'Clerical",
"Staff",
"'",
")"
] |
[
"select",
"staff_id",
"from",
"staff_department_assignments",
"where",
"date_assigned_to",
"<",
"(",
"select",
"max",
"(",
"date_assigned_to",
")",
"from",
"staff_department_assignments",
"where",
"job_title_code",
"=",
"value",
")"
] |
[
"Return",
"the",
"id",
"of",
"the",
"staff",
"whose",
"Staff",
"Department",
"Assignment",
"was",
"earlier",
"than",
"that",
"of",
"any",
"Clerical",
"Staff",
"."
] |
department_store
|
SELECT customer_name , customer_id FROM customers WHERE customer_address LIKE "%TN%"
|
What are the names and ids of customers whose address contains TN?
|
[
"SELECT",
"customer_name",
",",
"customer_id",
"FROM",
"customers",
"WHERE",
"customer_address",
"LIKE",
"``",
"%",
"TN",
"%",
"''"
] |
[
"select",
"customer_name",
",",
"customer_id",
"from",
"customers",
"where",
"customer_address",
"like",
"value"
] |
[
"What",
"are",
"the",
"names",
"and",
"ids",
"of",
"customers",
"whose",
"address",
"contains",
"TN",
"?"
] |
department_store
|
SELECT customer_name , customer_id FROM customers WHERE customer_address LIKE "%TN%"
|
Return the names and ids of customers who have TN in their address.
|
[
"SELECT",
"customer_name",
",",
"customer_id",
"FROM",
"customers",
"WHERE",
"customer_address",
"LIKE",
"``",
"%",
"TN",
"%",
"''"
] |
[
"select",
"customer_name",
",",
"customer_id",
"from",
"customers",
"where",
"customer_address",
"like",
"value"
] |
[
"Return",
"the",
"names",
"and",
"ids",
"of",
"customers",
"who",
"have",
"TN",
"in",
"their",
"address",
"."
] |
department_store
|
SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.date_assigned_from LIKE "2016%"
|
Return the name and gender of the staff who was assigned in 2016.
|
[
"SELECT",
"T1.staff_name",
",",
"T1.staff_gender",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"staff_department_assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"WHERE",
"T2.date_assigned_from",
"LIKE",
"``",
"2016",
"%",
"''"
] |
[
"select",
"t1",
".",
"staff_name",
",",
"t1",
".",
"staff_gender",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"where",
"t2",
".",
"date_assigned_from",
"like",
"value"
] |
[
"Return",
"the",
"name",
"and",
"gender",
"of",
"the",
"staff",
"who",
"was",
"assigned",
"in",
"2016",
"."
] |
department_store
|
SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.date_assigned_from LIKE "2016%"
|
What are the names and genders of staff who were assigned in 2016?
|
[
"SELECT",
"T1.staff_name",
",",
"T1.staff_gender",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"staff_department_assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"WHERE",
"T2.date_assigned_from",
"LIKE",
"``",
"2016",
"%",
"''"
] |
[
"select",
"t1",
".",
"staff_name",
",",
"t1",
".",
"staff_gender",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"where",
"t2",
".",
"date_assigned_from",
"like",
"value"
] |
[
"What",
"are",
"the",
"names",
"and",
"genders",
"of",
"staff",
"who",
"were",
"assigned",
"in",
"2016",
"?"
] |
department_store
|
SELECT T1.staff_name FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id GROUP BY T2.staff_id HAVING COUNT (*) > 1
|
List the name of staff who has been assigned multiple jobs.
|
[
"SELECT",
"T1.staff_name",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"staff_department_assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"GROUP",
"BY",
"T2.staff_id",
"HAVING",
"COUNT",
"(",
"*",
")",
">",
"1"
] |
[
"select",
"t1",
".",
"staff_name",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"group",
"by",
"t2",
".",
"staff_id",
"having",
"count",
"(",
"*",
")",
">",
"value"
] |
[
"List",
"the",
"name",
"of",
"staff",
"who",
"has",
"been",
"assigned",
"multiple",
"jobs",
"."
] |
department_store
|
SELECT T1.staff_name FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id GROUP BY T2.staff_id HAVING COUNT (*) > 1
|
What are the names of staff who have been assigned multiple jobs?
|
[
"SELECT",
"T1.staff_name",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"staff_department_assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"GROUP",
"BY",
"T2.staff_id",
"HAVING",
"COUNT",
"(",
"*",
")",
">",
"1"
] |
[
"select",
"t1",
".",
"staff_name",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"group",
"by",
"t2",
".",
"staff_id",
"having",
"count",
"(",
"*",
")",
">",
"value"
] |
[
"What",
"are",
"the",
"names",
"of",
"staff",
"who",
"have",
"been",
"assigned",
"multiple",
"jobs",
"?"
] |
department_store
|
SELECT T1.supplier_name , T1.supplier_phone FROM Suppliers AS T1 JOIN supplier_addresses AS T2 ON T1.supplier_id = T2.supplier_id JOIN addresses AS T3 ON T2.address_id = T3.address_id ORDER BY T3.address_details
|
List the name and phone number of all suppliers in the alphabetical order of their addresses.
|
[
"SELECT",
"T1.supplier_name",
",",
"T1.supplier_phone",
"FROM",
"Suppliers",
"AS",
"T1",
"JOIN",
"supplier_addresses",
"AS",
"T2",
"ON",
"T1.supplier_id",
"=",
"T2.supplier_id",
"JOIN",
"addresses",
"AS",
"T3",
"ON",
"T2.address_id",
"=",
"T3.address_id",
"ORDER",
"BY",
"T3.address_details"
] |
[
"select",
"t1",
".",
"supplier_name",
",",
"t1",
".",
"supplier_phone",
"from",
"suppliers",
"as",
"t1",
"join",
"supplier_addresses",
"as",
"t2",
"on",
"t1",
".",
"supplier_id",
"=",
"t2",
".",
"supplier_id",
"join",
"addresses",
"as",
"t3",
"on",
"t2",
".",
"address_id",
"=",
"t3",
".",
"address_id",
"order",
"by",
"t3",
".",
"address_details"
] |
[
"List",
"the",
"name",
"and",
"phone",
"number",
"of",
"all",
"suppliers",
"in",
"the",
"alphabetical",
"order",
"of",
"their",
"addresses",
"."
] |
department_store
|
SELECT T1.supplier_name , T1.supplier_phone FROM Suppliers AS T1 JOIN supplier_addresses AS T2 ON T1.supplier_id = T2.supplier_id JOIN addresses AS T3 ON T2.address_id = T3.address_id ORDER BY T3.address_details
|
What are the names and phone numbers for all suppliers, sorted in alphabetical order of their addressed?
|
[
"SELECT",
"T1.supplier_name",
",",
"T1.supplier_phone",
"FROM",
"Suppliers",
"AS",
"T1",
"JOIN",
"supplier_addresses",
"AS",
"T2",
"ON",
"T1.supplier_id",
"=",
"T2.supplier_id",
"JOIN",
"addresses",
"AS",
"T3",
"ON",
"T2.address_id",
"=",
"T3.address_id",
"ORDER",
"BY",
"T3.address_details"
] |
[
"select",
"t1",
".",
"supplier_name",
",",
"t1",
".",
"supplier_phone",
"from",
"suppliers",
"as",
"t1",
"join",
"supplier_addresses",
"as",
"t2",
"on",
"t1",
".",
"supplier_id",
"=",
"t2",
".",
"supplier_id",
"join",
"addresses",
"as",
"t3",
"on",
"t2",
".",
"address_id",
"=",
"t3",
".",
"address_id",
"order",
"by",
"t3",
".",
"address_details"
] |
[
"What",
"are",
"the",
"names",
"and",
"phone",
"numbers",
"for",
"all",
"suppliers",
",",
"sorted",
"in",
"alphabetical",
"order",
"of",
"their",
"addressed",
"?"
] |
department_store
|
SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers
|
What are the phone numbers of all customers and suppliers.
|
[
"SELECT",
"customer_phone",
"FROM",
"customers",
"UNION",
"SELECT",
"supplier_phone",
"FROM",
"suppliers"
] |
[
"select",
"customer_phone",
"from",
"customers",
"union",
"select",
"supplier_phone",
"from",
"suppliers"
] |
[
"What",
"are",
"the",
"phone",
"numbers",
"of",
"all",
"customers",
"and",
"suppliers",
"."
] |
department_store
|
SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers
|
Return the phone numbers for all customers and suppliers.
|
[
"SELECT",
"customer_phone",
"FROM",
"customers",
"UNION",
"SELECT",
"supplier_phone",
"FROM",
"suppliers"
] |
[
"select",
"customer_phone",
"from",
"customers",
"union",
"select",
"supplier_phone",
"from",
"suppliers"
] |
[
"Return",
"the",
"phone",
"numbers",
"for",
"all",
"customers",
"and",
"suppliers",
"."
] |
department_store
|
SELECT product_id FROM Order_Items GROUP BY product_id HAVING count(*) > 3 UNION SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING sum(total_amount_purchased) > 80000
|
Return the ids of all products that were ordered more than three times or supplied more than 80000.
|
[
"SELECT",
"product_id",
"FROM",
"Order_Items",
"GROUP",
"BY",
"product_id",
"HAVING",
"count",
"(",
"*",
")",
">",
"3",
"UNION",
"SELECT",
"product_id",
"FROM",
"Product_Suppliers",
"GROUP",
"BY",
"product_id",
"HAVING",
"sum",
"(",
"total_amount_purchased",
")",
">",
"80000"
] |
[
"select",
"product_id",
"from",
"order_items",
"group",
"by",
"product_id",
"having",
"count",
"(",
"*",
")",
">",
"value",
"union",
"select",
"product_id",
"from",
"product_suppliers",
"group",
"by",
"product_id",
"having",
"sum",
"(",
"total_amount_purchased",
")",
">",
"value"
] |
[
"Return",
"the",
"ids",
"of",
"all",
"products",
"that",
"were",
"ordered",
"more",
"than",
"three",
"times",
"or",
"supplied",
"more",
"than",
"80000",
"."
] |
department_store
|
SELECT product_id FROM Order_Items GROUP BY product_id HAVING count(*) > 3 UNION SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING sum(total_amount_purchased) > 80000
|
What are the ids of all products that were either ordered more than 3 times or have a cumulative amount purchased of above 80000?
|
[
"SELECT",
"product_id",
"FROM",
"Order_Items",
"GROUP",
"BY",
"product_id",
"HAVING",
"count",
"(",
"*",
")",
">",
"3",
"UNION",
"SELECT",
"product_id",
"FROM",
"Product_Suppliers",
"GROUP",
"BY",
"product_id",
"HAVING",
"sum",
"(",
"total_amount_purchased",
")",
">",
"80000"
] |
[
"select",
"product_id",
"from",
"order_items",
"group",
"by",
"product_id",
"having",
"count",
"(",
"*",
")",
">",
"value",
"union",
"select",
"product_id",
"from",
"product_suppliers",
"group",
"by",
"product_id",
"having",
"sum",
"(",
"total_amount_purchased",
")",
">",
"value"
] |
[
"What",
"are",
"the",
"ids",
"of",
"all",
"products",
"that",
"were",
"either",
"ordered",
"more",
"than",
"3",
"times",
"or",
"have",
"a",
"cumulative",
"amount",
"purchased",
"of",
"above",
"80000",
"?"
] |
department_store
|
SELECT product_id , product_name FROM products WHERE product_price < 600 OR product_price > 900
|
What are id and name of the products whose price is lower than 600 or higher than 900?
|
[
"SELECT",
"product_id",
",",
"product_name",
"FROM",
"products",
"WHERE",
"product_price",
"<",
"600",
"OR",
"product_price",
">",
"900"
] |
[
"select",
"product_id",
",",
"product_name",
"from",
"products",
"where",
"product_price",
"<",
"value",
"or",
"product_price",
">",
"value"
] |
[
"What",
"are",
"id",
"and",
"name",
"of",
"the",
"products",
"whose",
"price",
"is",
"lower",
"than",
"600",
"or",
"higher",
"than",
"900",
"?"
] |
department_store
|
SELECT product_id , product_name FROM products WHERE product_price < 600 OR product_price > 900
|
Give the ids and names of products with price lower than 600 or higher than 900.
|
[
"SELECT",
"product_id",
",",
"product_name",
"FROM",
"products",
"WHERE",
"product_price",
"<",
"600",
"OR",
"product_price",
">",
"900"
] |
[
"select",
"product_id",
",",
"product_name",
"from",
"products",
"where",
"product_price",
"<",
"value",
"or",
"product_price",
">",
"value"
] |
[
"Give",
"the",
"ids",
"and",
"names",
"of",
"products",
"with",
"price",
"lower",
"than",
"600",
"or",
"higher",
"than",
"900",
"."
] |
department_store
|
SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING avg(total_amount_purchased) > 50000 OR avg(total_amount_purchased) < 30000
|
Find the id of suppliers whose average amount purchased for each product is above 50000 or below 30000.
|
[
"SELECT",
"supplier_id",
"FROM",
"Product_Suppliers",
"GROUP",
"BY",
"supplier_id",
"HAVING",
"avg",
"(",
"total_amount_purchased",
")",
">",
"50000",
"OR",
"avg",
"(",
"total_amount_purchased",
")",
"<",
"30000"
] |
[
"select",
"supplier_id",
"from",
"product_suppliers",
"group",
"by",
"supplier_id",
"having",
"avg",
"(",
"total_amount_purchased",
")",
">",
"value",
"or",
"avg",
"(",
"total_amount_purchased",
")",
"<",
"value"
] |
[
"Find",
"the",
"id",
"of",
"suppliers",
"whose",
"average",
"amount",
"purchased",
"for",
"each",
"product",
"is",
"above",
"50000",
"or",
"below",
"30000",
"."
] |
department_store
|
SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING avg(total_amount_purchased) > 50000 OR avg(total_amount_purchased) < 30000
|
What are the ids of suppliers which have an average amount purchased of above 50000 or below 30000?
|
[
"SELECT",
"supplier_id",
"FROM",
"Product_Suppliers",
"GROUP",
"BY",
"supplier_id",
"HAVING",
"avg",
"(",
"total_amount_purchased",
")",
">",
"50000",
"OR",
"avg",
"(",
"total_amount_purchased",
")",
"<",
"30000"
] |
[
"select",
"supplier_id",
"from",
"product_suppliers",
"group",
"by",
"supplier_id",
"having",
"avg",
"(",
"total_amount_purchased",
")",
">",
"value",
"or",
"avg",
"(",
"total_amount_purchased",
")",
"<",
"value"
] |
[
"What",
"are",
"the",
"ids",
"of",
"suppliers",
"which",
"have",
"an",
"average",
"amount",
"purchased",
"of",
"above",
"50000",
"or",
"below",
"30000",
"?"
] |
department_store
|
SELECT avg(total_amount_purchased) , avg(total_value_purchased) FROM Product_Suppliers WHERE supplier_id = (SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY count(*) DESC LIMIT 1)
|
What are the average amount purchased and value purchased for the supplier who supplies the most products.
|
[
"SELECT",
"avg",
"(",
"total_amount_purchased",
")",
",",
"avg",
"(",
"total_value_purchased",
")",
"FROM",
"Product_Suppliers",
"WHERE",
"supplier_id",
"=",
"(",
"SELECT",
"supplier_id",
"FROM",
"Product_Suppliers",
"GROUP",
"BY",
"supplier_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1",
")"
] |
[
"select",
"avg",
"(",
"total_amount_purchased",
")",
",",
"avg",
"(",
"total_value_purchased",
")",
"from",
"product_suppliers",
"where",
"supplier_id",
"=",
"(",
"select",
"supplier_id",
"from",
"product_suppliers",
"group",
"by",
"supplier_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value",
")"
] |
[
"What",
"are",
"the",
"average",
"amount",
"purchased",
"and",
"value",
"purchased",
"for",
"the",
"supplier",
"who",
"supplies",
"the",
"most",
"products",
"."
] |
department_store
|
SELECT avg(total_amount_purchased) , avg(total_value_purchased) FROM Product_Suppliers WHERE supplier_id = (SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY count(*) DESC LIMIT 1)
|
Return the average total amount purchased and total value purchased for the supplier who supplies the greatest number of products.
|
[
"SELECT",
"avg",
"(",
"total_amount_purchased",
")",
",",
"avg",
"(",
"total_value_purchased",
")",
"FROM",
"Product_Suppliers",
"WHERE",
"supplier_id",
"=",
"(",
"SELECT",
"supplier_id",
"FROM",
"Product_Suppliers",
"GROUP",
"BY",
"supplier_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1",
")"
] |
[
"select",
"avg",
"(",
"total_amount_purchased",
")",
",",
"avg",
"(",
"total_value_purchased",
")",
"from",
"product_suppliers",
"where",
"supplier_id",
"=",
"(",
"select",
"supplier_id",
"from",
"product_suppliers",
"group",
"by",
"supplier_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value",
")"
] |
[
"Return",
"the",
"average",
"total",
"amount",
"purchased",
"and",
"total",
"value",
"purchased",
"for",
"the",
"supplier",
"who",
"supplies",
"the",
"greatest",
"number",
"of",
"products",
"."
] |
department_store
|
SELECT max(customer_code) , min(customer_code) FROM Customers
|
What is the largest and smallest customer codes?
|
[
"SELECT",
"max",
"(",
"customer_code",
")",
",",
"min",
"(",
"customer_code",
")",
"FROM",
"Customers"
] |
[
"select",
"max",
"(",
"customer_code",
")",
",",
"min",
"(",
"customer_code",
")",
"from",
"customers"
] |
[
"What",
"is",
"the",
"largest",
"and",
"smallest",
"customer",
"codes",
"?"
] |
department_store
|
SELECT max(customer_code) , min(customer_code) FROM Customers
|
Return the maximum and minimum customer codes.
|
[
"SELECT",
"max",
"(",
"customer_code",
")",
",",
"min",
"(",
"customer_code",
")",
"FROM",
"Customers"
] |
[
"select",
"max",
"(",
"customer_code",
")",
",",
"min",
"(",
"customer_code",
")",
"from",
"customers"
] |
[
"Return",
"the",
"maximum",
"and",
"minimum",
"customer",
"codes",
"."
] |
department_store
|
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id JOIN products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_name = "keyboard"
|
List the names of all the distinct customers who bought a keyboard.
|
[
"SELECT",
"DISTINCT",
"T1.customer_name",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"JOIN",
"order_items",
"AS",
"T3",
"ON",
"T2.order_id",
"=",
"T3.order_id",
"JOIN",
"products",
"AS",
"T4",
"ON",
"T3.product_id",
"=",
"T4.product_id",
"WHERE",
"T4.product_name",
"=",
"``",
"keyboard",
"''"
] |
[
"select",
"distinct",
"t1",
".",
"customer_name",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"join",
"order_items",
"as",
"t3",
"on",
"t2",
".",
"order_id",
"=",
"t3",
".",
"order_id",
"join",
"products",
"as",
"t4",
"on",
"t3",
".",
"product_id",
"=",
"t4",
".",
"product_id",
"where",
"t4",
".",
"product_name",
"=",
"value"
] |
[
"List",
"the",
"names",
"of",
"all",
"the",
"distinct",
"customers",
"who",
"bought",
"a",
"keyboard",
"."
] |
department_store
|
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id JOIN products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_name = "keyboard"
|
What are the distinct names of customers who have purchased a keyboard?
|
[
"SELECT",
"DISTINCT",
"T1.customer_name",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"JOIN",
"order_items",
"AS",
"T3",
"ON",
"T2.order_id",
"=",
"T3.order_id",
"JOIN",
"products",
"AS",
"T4",
"ON",
"T3.product_id",
"=",
"T4.product_id",
"WHERE",
"T4.product_name",
"=",
"``",
"keyboard",
"''"
] |
[
"select",
"distinct",
"t1",
".",
"customer_name",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"join",
"order_items",
"as",
"t3",
"on",
"t2",
".",
"order_id",
"=",
"t3",
".",
"order_id",
"join",
"products",
"as",
"t4",
"on",
"t3",
".",
"product_id",
"=",
"t4",
".",
"product_id",
"where",
"t4",
".",
"product_name",
"=",
"value"
] |
[
"What",
"are",
"the",
"distinct",
"names",
"of",
"customers",
"who",
"have",
"purchased",
"a",
"keyboard",
"?"
] |
department_store
|
SELECT DISTINCT T1.supplier_name , T1.supplier_phone FROM suppliers AS T1 JOIN product_suppliers AS T2 ON T1.supplier_id = T2.supplier_id JOIN products AS T3 ON T2.product_id = T3.product_id WHERE T3.product_name = "red jeans"
|
List the names and phone numbers of all the distinct suppliers who supply red jeans.
|
[
"SELECT",
"DISTINCT",
"T1.supplier_name",
",",
"T1.supplier_phone",
"FROM",
"suppliers",
"AS",
"T1",
"JOIN",
"product_suppliers",
"AS",
"T2",
"ON",
"T1.supplier_id",
"=",
"T2.supplier_id",
"JOIN",
"products",
"AS",
"T3",
"ON",
"T2.product_id",
"=",
"T3.product_id",
"WHERE",
"T3.product_name",
"=",
"``",
"red",
"jeans",
"''"
] |
[
"select",
"distinct",
"t1",
".",
"supplier_name",
",",
"t1",
".",
"supplier_phone",
"from",
"suppliers",
"as",
"t1",
"join",
"product_suppliers",
"as",
"t2",
"on",
"t1",
".",
"supplier_id",
"=",
"t2",
".",
"supplier_id",
"join",
"products",
"as",
"t3",
"on",
"t2",
".",
"product_id",
"=",
"t3",
".",
"product_id",
"where",
"t3",
".",
"product_name",
"=",
"value"
] |
[
"List",
"the",
"names",
"and",
"phone",
"numbers",
"of",
"all",
"the",
"distinct",
"suppliers",
"who",
"supply",
"red",
"jeans",
"."
] |
department_store
|
SELECT DISTINCT T1.supplier_name , T1.supplier_phone FROM suppliers AS T1 JOIN product_suppliers AS T2 ON T1.supplier_id = T2.supplier_id JOIN products AS T3 ON T2.product_id = T3.product_id WHERE T3.product_name = "red jeans"
|
What are the distinct names and phone numbers for suppliers who have red jeans?
|
[
"SELECT",
"DISTINCT",
"T1.supplier_name",
",",
"T1.supplier_phone",
"FROM",
"suppliers",
"AS",
"T1",
"JOIN",
"product_suppliers",
"AS",
"T2",
"ON",
"T1.supplier_id",
"=",
"T2.supplier_id",
"JOIN",
"products",
"AS",
"T3",
"ON",
"T2.product_id",
"=",
"T3.product_id",
"WHERE",
"T3.product_name",
"=",
"``",
"red",
"jeans",
"''"
] |
[
"select",
"distinct",
"t1",
".",
"supplier_name",
",",
"t1",
".",
"supplier_phone",
"from",
"suppliers",
"as",
"t1",
"join",
"product_suppliers",
"as",
"t2",
"on",
"t1",
".",
"supplier_id",
"=",
"t2",
".",
"supplier_id",
"join",
"products",
"as",
"t3",
"on",
"t2",
".",
"product_id",
"=",
"t3",
".",
"product_id",
"where",
"t3",
".",
"product_name",
"=",
"value"
] |
[
"What",
"are",
"the",
"distinct",
"names",
"and",
"phone",
"numbers",
"for",
"suppliers",
"who",
"have",
"red",
"jeans",
"?"
] |
department_store
|
SELECT max(product_price) , min(product_price) , product_type_code FROM products GROUP BY product_type_code ORDER BY product_type_code
|
What are the highest and lowest prices of products, grouped by and alphabetically ordered by product type?
|
[
"SELECT",
"max",
"(",
"product_price",
")",
",",
"min",
"(",
"product_price",
")",
",",
"product_type_code",
"FROM",
"products",
"GROUP",
"BY",
"product_type_code",
"ORDER",
"BY",
"product_type_code"
] |
[
"select",
"max",
"(",
"product_price",
")",
",",
"min",
"(",
"product_price",
")",
",",
"product_type_code",
"from",
"products",
"group",
"by",
"product_type_code",
"order",
"by",
"product_type_code"
] |
[
"What",
"are",
"the",
"highest",
"and",
"lowest",
"prices",
"of",
"products",
",",
"grouped",
"by",
"and",
"alphabetically",
"ordered",
"by",
"product",
"type",
"?"
] |
department_store
|
SELECT max(product_price) , min(product_price) , product_type_code FROM products GROUP BY product_type_code ORDER BY product_type_code
|
Give the maximum and minimum product prices for each product type, grouped and ordered by product type.
|
[
"SELECT",
"max",
"(",
"product_price",
")",
",",
"min",
"(",
"product_price",
")",
",",
"product_type_code",
"FROM",
"products",
"GROUP",
"BY",
"product_type_code",
"ORDER",
"BY",
"product_type_code"
] |
[
"select",
"max",
"(",
"product_price",
")",
",",
"min",
"(",
"product_price",
")",
",",
"product_type_code",
"from",
"products",
"group",
"by",
"product_type_code",
"order",
"by",
"product_type_code"
] |
[
"Give",
"the",
"maximum",
"and",
"minimum",
"product",
"prices",
"for",
"each",
"product",
"type",
",",
"grouped",
"and",
"ordered",
"by",
"product",
"type",
"."
] |
department_store
|
SELECT order_id , customer_id FROM customer_orders WHERE order_status_code = "Cancelled" ORDER BY order_date
|
List the order id, customer id for orders in Cancelled status, ordered by their order dates.
|
[
"SELECT",
"order_id",
",",
"customer_id",
"FROM",
"customer_orders",
"WHERE",
"order_status_code",
"=",
"``",
"Cancelled",
"''",
"ORDER",
"BY",
"order_date"
] |
[
"select",
"order_id",
",",
"customer_id",
"from",
"customer_orders",
"where",
"order_status_code",
"=",
"value",
"order",
"by",
"order_date"
] |
[
"List",
"the",
"order",
"id",
",",
"customer",
"id",
"for",
"orders",
"in",
"Cancelled",
"status",
",",
"ordered",
"by",
"their",
"order",
"dates",
"."
] |
department_store
|
SELECT order_id , customer_id FROM customer_orders WHERE order_status_code = "Cancelled" ORDER BY order_date
|
What are the order ids and customer ids for orders that have been Cancelled, sorted by their order dates?
|
[
"SELECT",
"order_id",
",",
"customer_id",
"FROM",
"customer_orders",
"WHERE",
"order_status_code",
"=",
"``",
"Cancelled",
"''",
"ORDER",
"BY",
"order_date"
] |
[
"select",
"order_id",
",",
"customer_id",
"from",
"customer_orders",
"where",
"order_status_code",
"=",
"value",
"order",
"by",
"order_date"
] |
[
"What",
"are",
"the",
"order",
"ids",
"and",
"customer",
"ids",
"for",
"orders",
"that",
"have",
"been",
"Cancelled",
",",
"sorted",
"by",
"their",
"order",
"dates",
"?"
] |
department_store
|
SELECT DISTINCT T3.product_name FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id JOIN products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id HAVING COUNT (DISTINCT T1.customer_id) >= 2
|
Find the names of products that were bought by at least two distinct customers.
|
[
"SELECT",
"DISTINCT",
"T3.product_name",
"FROM",
"customer_orders",
"AS",
"T1",
"JOIN",
"order_items",
"AS",
"T2",
"ON",
"T1.order_id",
"=",
"T2.order_id",
"JOIN",
"products",
"AS",
"T3",
"ON",
"T2.product_id",
"=",
"T3.product_id",
"GROUP",
"BY",
"T3.product_id",
"HAVING",
"COUNT",
"(",
"DISTINCT",
"T1.customer_id",
")",
">",
"=",
"2"
] |
[
"select",
"distinct",
"t3",
".",
"product_name",
"from",
"customer_orders",
"as",
"t1",
"join",
"order_items",
"as",
"t2",
"on",
"t1",
".",
"order_id",
"=",
"t2",
".",
"order_id",
"join",
"products",
"as",
"t3",
"on",
"t2",
".",
"product_id",
"=",
"t3",
".",
"product_id",
"group",
"by",
"t3",
".",
"product_id",
"having",
"count",
"(",
"distinct",
"t1",
".",
"customer_id",
")",
">",
"=",
"value"
] |
[
"Find",
"the",
"names",
"of",
"products",
"that",
"were",
"bought",
"by",
"at",
"least",
"two",
"distinct",
"customers",
"."
] |
department_store
|
SELECT DISTINCT T3.product_name FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id JOIN products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id HAVING COUNT (DISTINCT T1.customer_id) >= 2
|
What are the distinct names of products purchased by at least two different customers?
|
[
"SELECT",
"DISTINCT",
"T3.product_name",
"FROM",
"customer_orders",
"AS",
"T1",
"JOIN",
"order_items",
"AS",
"T2",
"ON",
"T1.order_id",
"=",
"T2.order_id",
"JOIN",
"products",
"AS",
"T3",
"ON",
"T2.product_id",
"=",
"T3.product_id",
"GROUP",
"BY",
"T3.product_id",
"HAVING",
"COUNT",
"(",
"DISTINCT",
"T1.customer_id",
")",
">",
"=",
"2"
] |
[
"select",
"distinct",
"t3",
".",
"product_name",
"from",
"customer_orders",
"as",
"t1",
"join",
"order_items",
"as",
"t2",
"on",
"t1",
".",
"order_id",
"=",
"t2",
".",
"order_id",
"join",
"products",
"as",
"t3",
"on",
"t2",
".",
"product_id",
"=",
"t3",
".",
"product_id",
"group",
"by",
"t3",
".",
"product_id",
"having",
"count",
"(",
"distinct",
"t1",
".",
"customer_id",
")",
">",
"=",
"value"
] |
[
"What",
"are",
"the",
"distinct",
"names",
"of",
"products",
"purchased",
"by",
"at",
"least",
"two",
"different",
"customers",
"?"
] |
department_store
|
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_id HAVING COUNT (DISTINCT T3.product_id) >= 3
|
Find the names of customers who have bought by at least three distinct products.
|
[
"SELECT",
"DISTINCT",
"T1.customer_name",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"JOIN",
"order_items",
"AS",
"T3",
"ON",
"T2.order_id",
"=",
"T3.order_id",
"GROUP",
"BY",
"T1.customer_id",
"HAVING",
"COUNT",
"(",
"DISTINCT",
"T3.product_id",
")",
">",
"=",
"3"
] |
[
"select",
"distinct",
"t1",
".",
"customer_name",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"join",
"order_items",
"as",
"t3",
"on",
"t2",
".",
"order_id",
"=",
"t3",
".",
"order_id",
"group",
"by",
"t1",
".",
"customer_id",
"having",
"count",
"(",
"distinct",
"t3",
".",
"product_id",
")",
">",
"=",
"value"
] |
[
"Find",
"the",
"names",
"of",
"customers",
"who",
"have",
"bought",
"by",
"at",
"least",
"three",
"distinct",
"products",
"."
] |
department_store
|
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_id HAVING COUNT (DISTINCT T3.product_id) >= 3
|
What are the distinct names of customers who have purchased at least three different products?
|
[
"SELECT",
"DISTINCT",
"T1.customer_name",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"JOIN",
"order_items",
"AS",
"T3",
"ON",
"T2.order_id",
"=",
"T3.order_id",
"GROUP",
"BY",
"T1.customer_id",
"HAVING",
"COUNT",
"(",
"DISTINCT",
"T3.product_id",
")",
">",
"=",
"3"
] |
[
"select",
"distinct",
"t1",
".",
"customer_name",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"join",
"order_items",
"as",
"t3",
"on",
"t2",
".",
"order_id",
"=",
"t3",
".",
"order_id",
"group",
"by",
"t1",
".",
"customer_id",
"having",
"count",
"(",
"distinct",
"t3",
".",
"product_id",
")",
">",
"=",
"value"
] |
[
"What",
"are",
"the",
"distinct",
"names",
"of",
"customers",
"who",
"have",
"purchased",
"at",
"least",
"three",
"different",
"products",
"?"
] |
department_store
|
SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Sales Person" EXCEPT SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Clerical Staff"
|
Find the name and gender of the staff who has been assigned the job of Sales Person but never Clerical Staff.
|
[
"SELECT",
"T1.staff_name",
",",
"T1.staff_gender",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"Staff_Department_Assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"WHERE",
"T2.job_title_code",
"=",
"``",
"Sales",
"Person",
"''",
"EXCEPT",
"SELECT",
"T1.staff_name",
",",
"T1.staff_gender",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"Staff_Department_Assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"WHERE",
"T2.job_title_code",
"=",
"``",
"Clerical",
"Staff",
"''"
] |
[
"select",
"t1",
".",
"staff_name",
",",
"t1",
".",
"staff_gender",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"where",
"t2",
".",
"job_title_code",
"=",
"value",
"except",
"select",
"t1",
".",
"staff_name",
",",
"t1",
".",
"staff_gender",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"where",
"t2",
".",
"job_title_code",
"=",
"value"
] |
[
"Find",
"the",
"name",
"and",
"gender",
"of",
"the",
"staff",
"who",
"has",
"been",
"assigned",
"the",
"job",
"of",
"Sales",
"Person",
"but",
"never",
"Clerical",
"Staff",
"."
] |
department_store
|
SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Sales Person" EXCEPT SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Clerical Staff"
|
What are the names and genders of staff who have held the title Sales Person, but never Clerical Staff?
|
[
"SELECT",
"T1.staff_name",
",",
"T1.staff_gender",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"Staff_Department_Assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"WHERE",
"T2.job_title_code",
"=",
"``",
"Sales",
"Person",
"''",
"EXCEPT",
"SELECT",
"T1.staff_name",
",",
"T1.staff_gender",
"FROM",
"staff",
"AS",
"T1",
"JOIN",
"Staff_Department_Assignments",
"AS",
"T2",
"ON",
"T1.staff_id",
"=",
"T2.staff_id",
"WHERE",
"T2.job_title_code",
"=",
"``",
"Clerical",
"Staff",
"''"
] |
[
"select",
"t1",
".",
"staff_name",
",",
"t1",
".",
"staff_gender",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"where",
"t2",
".",
"job_title_code",
"=",
"value",
"except",
"select",
"t1",
".",
"staff_name",
",",
"t1",
".",
"staff_gender",
"from",
"staff",
"as",
"t1",
"join",
"staff_department_assignments",
"as",
"t2",
"on",
"t1",
".",
"staff_id",
"=",
"t2",
".",
"staff_id",
"where",
"t2",
".",
"job_title_code",
"=",
"value"
] |
[
"What",
"are",
"the",
"names",
"and",
"genders",
"of",
"staff",
"who",
"have",
"held",
"the",
"title",
"Sales",
"Person",
",",
"but",
"never",
"Clerical",
"Staff",
"?"
] |
department_store
|
SELECT customer_id , customer_name FROM customers WHERE customer_address LIKE "%WY%" AND payment_method_code != "Credit Card"
|
Find the id and name of customers whose address contains WY state and do not use credit card for payment.
|
[
"SELECT",
"customer_id",
",",
"customer_name",
"FROM",
"customers",
"WHERE",
"customer_address",
"LIKE",
"``",
"%",
"WY",
"%",
"''",
"AND",
"payment_method_code",
"!",
"=",
"``",
"Credit",
"Card",
"''"
] |
[
"select",
"customer_id",
",",
"customer_name",
"from",
"customers",
"where",
"customer_address",
"like",
"value",
"and",
"payment_method_code",
"!",
"=",
"value"
] |
[
"Find",
"the",
"id",
"and",
"name",
"of",
"customers",
"whose",
"address",
"contains",
"WY",
"state",
"and",
"do",
"not",
"use",
"credit",
"card",
"for",
"payment",
"."
] |
department_store
|
SELECT customer_id , customer_name FROM customers WHERE customer_address LIKE "%WY%" AND payment_method_code != "Credit Card"
|
What are the ids and names of customers with addressed that contain WY and who do not use a credit card for payment?
|
[
"SELECT",
"customer_id",
",",
"customer_name",
"FROM",
"customers",
"WHERE",
"customer_address",
"LIKE",
"``",
"%",
"WY",
"%",
"''",
"AND",
"payment_method_code",
"!",
"=",
"``",
"Credit",
"Card",
"''"
] |
[
"select",
"customer_id",
",",
"customer_name",
"from",
"customers",
"where",
"customer_address",
"like",
"value",
"and",
"payment_method_code",
"!",
"=",
"value"
] |
[
"What",
"are",
"the",
"ids",
"and",
"names",
"of",
"customers",
"with",
"addressed",
"that",
"contain",
"WY",
"and",
"who",
"do",
"not",
"use",
"a",
"credit",
"card",
"for",
"payment",
"?"
] |
department_store
|
SELECT avg(product_price) FROM products WHERE product_type_code = 'Clothes'
|
Find the average price of all product clothes.
|
[
"SELECT",
"avg",
"(",
"product_price",
")",
"FROM",
"products",
"WHERE",
"product_type_code",
"=",
"'Clothes",
"'"
] |
[
"select",
"avg",
"(",
"product_price",
")",
"from",
"products",
"where",
"product_type_code",
"=",
"value"
] |
[
"Find",
"the",
"average",
"price",
"of",
"all",
"product",
"clothes",
"."
] |
department_store
|
SELECT avg(product_price) FROM products WHERE product_type_code = 'Clothes'
|
What is the average price of clothes?
|
[
"SELECT",
"avg",
"(",
"product_price",
")",
"FROM",
"products",
"WHERE",
"product_type_code",
"=",
"'Clothes",
"'"
] |
[
"select",
"avg",
"(",
"product_price",
")",
"from",
"products",
"where",
"product_type_code",
"=",
"value"
] |
[
"What",
"is",
"the",
"average",
"price",
"of",
"clothes",
"?"
] |
department_store
|
SELECT product_name FROM products WHERE product_type_code = 'Hardware' ORDER BY product_price DESC LIMIT 1
|
Find the name of the most expensive hardware product.
|
[
"SELECT",
"product_name",
"FROM",
"products",
"WHERE",
"product_type_code",
"=",
"'Hardware",
"'",
"ORDER",
"BY",
"product_price",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"product_name",
"from",
"products",
"where",
"product_type_code",
"=",
"value",
"order",
"by",
"product_price",
"desc",
"limit",
"value"
] |
[
"Find",
"the",
"name",
"of",
"the",
"most",
"expensive",
"hardware",
"product",
"."
] |
department_store
|
SELECT product_name FROM products WHERE product_type_code = 'Hardware' ORDER BY product_price DESC LIMIT 1
|
What is the name of the hardware product with the greatest price?
|
[
"SELECT",
"product_name",
"FROM",
"products",
"WHERE",
"product_type_code",
"=",
"'Hardware",
"'",
"ORDER",
"BY",
"product_price",
"DESC",
"LIMIT",
"1"
] |
[
"select",
"product_name",
"from",
"products",
"where",
"product_type_code",
"=",
"value",
"order",
"by",
"product_price",
"desc",
"limit",
"value"
] |
[
"What",
"is",
"the",
"name",
"of",
"the",
"hardware",
"product",
"with",
"the",
"greatest",
"price",
"?"
] |
aircraft
|
SELECT count(*) FROM aircraft
|
How many aircrafts are there?
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"aircraft"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"aircraft"
] |
[
"How",
"many",
"aircrafts",
"are",
"there",
"?"
] |
aircraft
|
SELECT count(*) FROM aircraft
|
What is the number of aircraft?
|
[
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"aircraft"
] |
[
"select",
"count",
"(",
"*",
")",
"from",
"aircraft"
] |
[
"What",
"is",
"the",
"number",
"of",
"aircraft",
"?"
] |
aircraft
|
SELECT Description FROM aircraft
|
List the description of all aircrafts.
|
[
"SELECT",
"Description",
"FROM",
"aircraft"
] |
[
"select",
"description",
"from",
"aircraft"
] |
[
"List",
"the",
"description",
"of",
"all",
"aircrafts",
"."
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.