brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
For each advisor, report the total number of students advised by him or her.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `For each advisor, report the total number of students advised by him or her.` to a syntactically-correct PostgreSQL query.
SELECT Advisor , count(*) FROM STUDENT GROUP BY Advisor
How many students does each advisor have?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many students does each advisor have?` to a syntactically-correct PostgreSQL query.
SELECT Advisor , count(*) FROM STUDENT GROUP BY Advisor
Report all advisors that advise more than 2 students.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Report all advisors that advise more than 2 students.` to a syntactically-correct PostgreSQL query.
SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) > 2
Which advisors have more than two students?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which advisors have more than two students?` to a syntactically-correct PostgreSQL query.
SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) > 2
Report all majors that have less than 3 students.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Report all majors that have less than 3 students.` to a syntactically-correct PostgreSQL query.
SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*) < 3
What are the majors only less than three students are studying?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the majors only less than three students are studying?` to a syntactically-correct PostgreSQL query.
SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*) < 3
For each election cycle, report the number of voting records.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `For each election cycle, report the number of voting records.` to a syntactically-correct PostgreSQL query.
SELECT Election_Cycle , count(*) FROM VOTING_RECORD GROUP BY Election_Cycle
Count the number of voting records for each election cycle.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of voting records for each election cycle.` to a syntactically-correct PostgreSQL query.
SELECT Election_Cycle , count(*) FROM VOTING_RECORD GROUP BY Election_Cycle
Which major has the most students?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which major has the most students?` to a syntactically-correct PostgreSQL query.
SELECT Major FROM STUDENT GROUP BY major ORDER BY count(*) DESC LIMIT 1
Find the major that is studied by the largest number of students.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the major that is studied by the largest number of students.` to a syntactically-correct PostgreSQL query.
SELECT Major FROM STUDENT GROUP BY major ORDER BY count(*) DESC LIMIT 1
What is the most common major among female (sex is F) students?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the most common major among female (sex is F) students?` to a syntactically-correct PostgreSQL query.
SELECT Major FROM STUDENT WHERE Sex = "F" GROUP BY major ORDER BY count(*) DESC LIMIT 1
Find the major that is studied by the most female students.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the major that is studied by the most female students.` to a syntactically-correct PostgreSQL query.
SELECT Major FROM STUDENT WHERE Sex = "F" GROUP BY major ORDER BY count(*) DESC LIMIT 1
What is the city_code of the city that the most students live in?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the city_code of the city that the most students live in?` to a syntactically-correct PostgreSQL query.
SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY count(*) DESC LIMIT 1
Return the code of the city that has the most students.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the code of the city that has the most students.` to a syntactically-correct PostgreSQL query.
SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY count(*) DESC LIMIT 1
Report the distinct advisors who have more than 2 students.
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Report the distinct advisors who have more than 2 students.` to a syntactically-correct PostgreSQL query.
SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING count(*) > 2
Which advisors are advising more than 2 students?
-- Language PostgreSQL -- Tables: -- Table: student columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']] -- Table: voting record columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which advisors are advising more than 2 students?` to a syntactically-correct PostgreSQL query.
SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING count(*) > 2
How many products are there?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many products are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products
Count the number of products.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of products.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products
How many colors are there?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many colors are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM ref_colors
Count the number of colors.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of colors.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM ref_colors
How many characteristics are there?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many characteristics are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM CHARACTERISTICS
Count the number of characteristics.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of characteristics.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM CHARACTERISTICS
What are the names and buying prices of all the products?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names and buying prices of all the products?` to a syntactically-correct PostgreSQL query.
SELECT product_name , typical_buying_price FROM products
Return the names and typical buying prices for all products.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the names and typical buying prices for all products.` to a syntactically-correct PostgreSQL query.
SELECT product_name , typical_buying_price FROM products
List the description of all the colors.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the description of all the colors.` to a syntactically-correct PostgreSQL query.
SELECT color_description FROM ref_colors
What are the descriptions for each color?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the descriptions for each color?` to a syntactically-correct PostgreSQL query.
SELECT color_description FROM ref_colors
Find the names of all the product characteristics.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the names of all the product characteristics.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT characteristic_name FROM CHARACTERISTICS
What are the different names of the product characteristics?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different names of the product characteristics?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT characteristic_name FROM CHARACTERISTICS
What are the names of products with category "Spices"?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of products with category "Spices"?` to a syntactically-correct PostgreSQL query.
SELECT product_name FROM products WHERE product_category_code = "Spices"
Return the names of products in the category 'Spices'.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the names of products in the category 'Spices'.` to a syntactically-correct PostgreSQL query.
SELECT product_name FROM products WHERE product_category_code = "Spices"
List the names, color descriptions and product descriptions of products with category "Herbs".
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the names, color descriptions and product descriptions of products with category "Herbs".` to a syntactically-correct PostgreSQL query.
SELECT T1.product_name , T2.color_description , T1.product_description FROM products AS T1 JOIN Ref_colors AS T2 ON T1.color_code = T2.color_code WHERE product_category_code = "Herbs"
What are the names, color descriptions, and product descriptions for products in the 'Herbs' category?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names, color descriptions, and product descriptions for products in the 'Herbs' category?` to a syntactically-correct PostgreSQL query.
SELECT T1.product_name , T2.color_description , T1.product_description FROM products AS T1 JOIN Ref_colors AS T2 ON T1.color_code = T2.color_code WHERE product_category_code = "Herbs"
How many products are there under the category "Seeds"?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many products are there under the category "Seeds"?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products WHERE product_category_code = "Seeds"
Count the number of products in the category 'Seeds'.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of products in the category 'Seeds'.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products WHERE product_category_code = "Seeds"
Find the number of products with category "Spices" and typically sold above 1000.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of products with category "Spices" and typically sold above 1000.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products WHERE product_category_code = "Spices" AND typical_buying_price > 1000
How many products are in the 'Spices' category and have a typical price of over 1000?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many products are in the 'Spices' category and have a typical price of over 1000?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products WHERE product_category_code = "Spices" AND typical_buying_price > 1000
What is the category and typical buying price of the product with name "cumin"?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the category and typical buying price of the product with name "cumin"?` to a syntactically-correct PostgreSQL query.
SELECT product_category_code , typical_buying_price FROM products WHERE product_name = "cumin"
Return the category code and typical price of 'cumin'.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the category code and typical price of 'cumin'.` to a syntactically-correct PostgreSQL query.
SELECT product_category_code , typical_buying_price FROM products WHERE product_name = "cumin"
Which category does the product named "flax" belong to?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which category does the product named "flax" belong to?` to a syntactically-correct PostgreSQL query.
SELECT product_category_code FROM products WHERE product_name = "flax"
What is the code of the category that the product with the name 'flax' belongs to?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the code of the category that the product with the name 'flax' belongs to?` to a syntactically-correct PostgreSQL query.
SELECT product_category_code FROM products WHERE product_name = "flax"
What is the name of the product with the color description 'yellow'?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the name of the product with the color description 'yellow'?` to a syntactically-correct PostgreSQL query.
SELECT T1.product_name FROM products AS T1 JOIN ref_colors AS T2 ON T1.color_code = T2.color_code WHERE T2.color_description = 'yellow'
Give the name of the products that have a color description 'yellow'.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the name of the products that have a color description 'yellow'.` to a syntactically-correct PostgreSQL query.
SELECT T1.product_name FROM products AS T1 JOIN ref_colors AS T2 ON T1.color_code = T2.color_code WHERE T2.color_description = 'yellow'
Find the category descriptions of the products whose descriptions include letter 't'.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the category descriptions of the products whose descriptions include letter 't'.` to a syntactically-correct PostgreSQL query.
SELECT T1.product_category_description FROM ref_product_categories AS T1 JOIN products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%'
What are the descriptions of the categories that products with product descriptions that contain the letter t are in?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the descriptions of the categories that products with product descriptions that contain the letter t are in?` to a syntactically-correct PostgreSQL query.
SELECT T1.product_category_description FROM ref_product_categories AS T1 JOIN products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%'
What is the color description of the product with name "catnip"?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the color description of the product with name "catnip"?` to a syntactically-correct PostgreSQL query.
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = "catnip"
Give the color description for the product 'catnip'.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the color description for the product 'catnip'.` to a syntactically-correct PostgreSQL query.
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = "catnip"
What is the color code and description of the product named "chervil"?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the color code and description of the product named "chervil"?` to a syntactically-correct PostgreSQL query.
SELECT t1.color_code , t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = "chervil"
Return the color code and description for the product with the name 'chervil'.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the color code and description for the product with the name 'chervil'.` to a syntactically-correct PostgreSQL query.
SELECT t1.color_code , t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = "chervil"
Find the id and color description of the products with at least 2 characteristics.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the id and color description of the products with at least 2 characteristics.` to a syntactically-correct PostgreSQL query.
SELECT t1.product_id , t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code JOIN product_characteristics AS t3 ON t1.product_id = t3.product_id GROUP BY t1.product_id HAVING count(*) >= 2
What are the product ids and color descriptions for products with two or more characteristics?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the product ids and color descriptions for products with two or more characteristics?` to a syntactically-correct PostgreSQL query.
SELECT t1.product_id , t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code JOIN product_characteristics AS t3 ON t1.product_id = t3.product_id GROUP BY t1.product_id HAVING count(*) >= 2
List all the product names with the color description "white".
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all the product names with the color description "white".` to a syntactically-correct PostgreSQL query.
SELECT t1.product_name FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_description = "white"
What are the names of products with 'white' as their color description?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of products with 'white' as their color description?` to a syntactically-correct PostgreSQL query.
SELECT t1.product_name FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_description = "white"
What are the name and typical buying and selling prices of the products that have color described as "yellow"?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the name and typical buying and selling prices of the products that have color described as "yellow"?` to a syntactically-correct PostgreSQL query.
SELECT t1.product_name , t1.typical_buying_price , t1.typical_selling_price FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_description = "yellow"
Return the names and typical buying and selling prices for products that have 'yellow' as their color description.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the names and typical buying and selling prices for products that have 'yellow' as their color description.` to a syntactically-correct PostgreSQL query.
SELECT t1.product_name , t1.typical_buying_price , t1.typical_selling_price FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_description = "yellow"
How many characteristics does the product named "sesame" have?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many characteristics does the product named "sesame" have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id WHERE t1.product_name = "sesame"
Count the number of characteristics the product 'sesame' has.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of characteristics the product 'sesame' has.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id WHERE t1.product_name = "sesame"
How many distinct characteristic names does the product "cumin" have?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many distinct characteristic names does the product "cumin" have?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT t3.characteristic_name) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
Count the number of different characteristic names the product 'cumin' has.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of different characteristic names the product 'cumin' has.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT t3.characteristic_name) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
What are all the characteristic names of product "sesame"?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are all the characteristic names of product "sesame"?` to a syntactically-correct PostgreSQL query.
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
Return the characteristic names of the 'sesame' product.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the characteristic names of the 'sesame' product.` to a syntactically-correct PostgreSQL query.
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
List all the characteristic names and data types of product "cumin".
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all the characteristic names and data types of product "cumin".` to a syntactically-correct PostgreSQL query.
SELECT t3.characteristic_name , t3.characteristic_data_type FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "cumin"
What are the names and data types of the characteristics of the 'cumin' product?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names and data types of the characteristics of the 'cumin' product?` to a syntactically-correct PostgreSQL query.
SELECT t3.characteristic_name , t3.characteristic_data_type FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "cumin"
List all characteristics of product named "sesame" with type code "Grade".
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all characteristics of product named "sesame" with type code "Grade".` to a syntactically-correct PostgreSQL query.
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame" AND t3.characteristic_type_code = "Grade"
What are the names of the characteristics of the product 'sesame' that have the characteristic type code 'Grade'?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of the characteristics of the product 'sesame' that have the characteristic type code 'Grade'?` to a syntactically-correct PostgreSQL query.
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame" AND t3.characteristic_type_code = "Grade"
How many characteristics does the product named "laurel" have?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many characteristics does the product named "laurel" have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "laurel"
Count the number of characteristics of the product named 'laurel'.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of characteristics of the product named 'laurel'.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "laurel"
Find the number of characteristics that the product "flax" has.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of characteristics that the product "flax" has.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "flax"
Count the number of characteristics of the 'flax' product.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of characteristics of the 'flax' product.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "flax"
Find the name of the products that have the color description "red" and have the characteristic name "fast".
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the name of the products that have the color description "red" and have the characteristic name "fast".` to a syntactically-correct PostgreSQL query.
SELECT product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "red" AND t3.characteristic_name = "fast"
What are the names of the products that have a color description of 'red' and the 'fast' characteristic?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of the products that have a color description of 'red' and the 'fast' characteristic?` to a syntactically-correct PostgreSQL query.
SELECT product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "red" AND t3.characteristic_name = "fast"
How many products have the characteristic named "hot"?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many products have the characteristic named "hot"?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = "hot"
Count the number of products with the 'hot' charactersitic.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the number of products with the 'hot' charactersitic.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = "hot"
List the all the distinct names of the products with the characteristic name 'warm'.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the all the distinct names of the products with the characteristic name 'warm'.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT t1.product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = "warm"
What are the different product names for products that have the 'warm' characteristic:?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the different product names for products that have the 'warm' characteristic:?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT t1.product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = "warm"
Find the number of the products that have their color described as "red" and have a characteristic named "slow".
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of the products that have their color described as "red" and have a characteristic named "slow".` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "red" AND t3.characteristic_name = "slow"
How many products have the color description 'red' and the characteristic name 'slow'?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many products have the color description 'red' and the characteristic name 'slow'?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "red" AND t3.characteristic_name = "slow"
Count the products that have the color description "white" or have the characteristic name "hot".
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Count the products that have the color description "white" or have the characteristic name "hot".` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "white" OR t3.characteristic_name = "hot"
How many products have their color described as 'white' or have a characteristic with the name 'hot'?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many products have their color described as 'white' or have a characteristic with the name 'hot'?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "white" OR t3.characteristic_name = "hot"
What is the unit of measuerment of the product category code "Herbs"?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the unit of measuerment of the product category code "Herbs"?` to a syntactically-correct PostgreSQL query.
SELECT unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs"
Return the unit of measure for 'Herb' products.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the unit of measure for 'Herb' products.` to a syntactically-correct PostgreSQL query.
SELECT unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs"
Find the product category description of the product category with code "Spices".
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the product category description of the product category with code "Spices".` to a syntactically-correct PostgreSQL query.
SELECT product_category_description FROM ref_product_categories WHERE product_category_code = "Spices"
What is the description of the product category with the code 'Spices'?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the description of the product category with the code 'Spices'?` to a syntactically-correct PostgreSQL query.
SELECT product_category_description FROM ref_product_categories WHERE product_category_code = "Spices"
What is the product category description and unit of measurement of category "Herbs"?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the product category description and unit of measurement of category "Herbs"?` to a syntactically-correct PostgreSQL query.
SELECT product_category_description , unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs"
Return the description and unit of measurement for products in the 'Herbs' category.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the description and unit of measurement for products in the 'Herbs' category.` to a syntactically-correct PostgreSQL query.
SELECT product_category_description , unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs"
What is the unit of measurement of product named "cumin"?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the unit of measurement of product named "cumin"?` to a syntactically-correct PostgreSQL query.
SELECT t2.unit_of_measure FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "cumin"
Give the unit of measure for the product with the name 'cumin'.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the unit of measure for the product with the name 'cumin'.` to a syntactically-correct PostgreSQL query.
SELECT t2.unit_of_measure FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "cumin"
Find the unit of measurement and product category code of product named "chervil".
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the unit of measurement and product category code of product named "chervil".` to a syntactically-correct PostgreSQL query.
SELECT t2.unit_of_measure , t2.product_category_code FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "chervil"
What are the unit of measure and category code for the 'chervil' product?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the unit of measure and category code for the 'chervil' product?` to a syntactically-correct PostgreSQL query.
SELECT t2.unit_of_measure , t2.product_category_code FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "chervil"
Find the product names that are colored 'white' but do not have unit of measurement "Handful".
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the product names that are colored 'white' but do not have unit of measurement "Handful".` to a syntactically-correct PostgreSQL query.
SELECT t1.product_name FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code JOIN ref_colors AS t3 ON t1.color_code = t3.color_code WHERE t3.color_description = "white" AND t2.unit_of_measure != "Handful"
What are the names of products that are not 'white' in color and are not measured by the unit 'Handful'?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of products that are not 'white' in color and are not measured by the unit 'Handful'?` to a syntactically-correct PostgreSQL query.
SELECT t1.product_name FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code JOIN ref_colors AS t3 ON t1.color_code = t3.color_code WHERE t3.color_description = "white" AND t2.unit_of_measure != "Handful"
What is the description of the color for most products?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the description of the color for most products?` to a syntactically-correct PostgreSQL query.
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code GROUP BY t2.color_description ORDER BY count(*) DESC LIMIT 1
Return the color description that is most common across all products.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the color description that is most common across all products.` to a syntactically-correct PostgreSQL query.
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code GROUP BY t2.color_description ORDER BY count(*) DESC LIMIT 1
What is the description of the color used by least products?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the description of the color used by least products?` to a syntactically-correct PostgreSQL query.
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code GROUP BY t2.color_description ORDER BY count(*) ASC LIMIT 1
Give the color description that is least common across products.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the color description that is least common across products.` to a syntactically-correct PostgreSQL query.
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code GROUP BY t2.color_description ORDER BY count(*) ASC LIMIT 1
What is the characteristic name used by most number of the products?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the characteristic name used by most number of the products?` to a syntactically-correct PostgreSQL query.
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id GROUP BY t3.characteristic_name ORDER BY count(*) DESC LIMIT 1
Return the name of the characteristic that is most common across all products.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the name of the characteristic that is most common across all products.` to a syntactically-correct PostgreSQL query.
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id GROUP BY t3.characteristic_name ORDER BY count(*) DESC LIMIT 1
What are the names, details and data types of the characteristics which are never used by any product?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names, details and data types of the characteristics which are never used by any product?` to a syntactically-correct PostgreSQL query.
SELECT characteristic_name , other_characteristic_details , characteristic_data_type FROM CHARACTERISTICS EXCEPT SELECT t1.characteristic_name , t1.other_characteristic_details , t1.characteristic_data_type FROM CHARACTERISTICS AS t1 JOIN product_characteristics AS t2 ON t1.characteristic_id = t2.characteristic_id
Give the names, details, and data types of characteristics that are not found in any product.
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the names, details, and data types of characteristics that are not found in any product.` to a syntactically-correct PostgreSQL query.
SELECT characteristic_name , other_characteristic_details , characteristic_data_type FROM CHARACTERISTICS EXCEPT SELECT t1.characteristic_name , t1.other_characteristic_details , t1.characteristic_data_type FROM CHARACTERISTICS AS t1 JOIN product_characteristics AS t2 ON t1.characteristic_id = t2.characteristic_id
What are characteristic names used at least twice across all products?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are characteristic names used at least twice across all products?` to a syntactically-correct PostgreSQL query.
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id GROUP BY t3.characteristic_name HAVING count(*) >= 2
Give the names of characteristics that are in two or more products?
-- Language PostgreSQL -- Tables: -- Table: reference characteristic types columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']] -- Table: reference colors columns : [['color code', 'text'], ['color description', 'text']] -- Table: reference product categories columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']] -- Table: characteristics columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']] -- Table: products columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']] -- Table: product characteristics columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give the names of characteristics that are in two or more products?` to a syntactically-correct PostgreSQL query.
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id GROUP BY t3.characteristic_name HAVING count(*) >= 2