brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
Return the the "active to date" of the latest contact channel used by the customer named "Tillman Ernser".
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 the "active to date" of the latest contact channel used by the customer named "Tillman Ernser".` to a syntactically-correct PostgreSQL query.
SELECT max(t2.active_to_date) FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser"
What is the average time span of contact channels in the database?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 average time span of contact channels in the database?` to a syntactically-correct PostgreSQL query.
SELECT avg(active_to_date - active_from_date) FROM customer_contact_channels
Compute the average active time span of contact channels.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 `Compute the average active time span of contact channels.` to a syntactically-correct PostgreSQL query.
SELECT avg(active_to_date - active_from_date) FROM customer_contact_channels
What is the channel code and contact number of the customer contact channel that was active for the longest time?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 channel code and contact number of the customer contact channel that was active for the longest time?` to a syntactically-correct PostgreSQL query.
SELECT channel_code , contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date = (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1)
Return the channel code and contact number of the customer contact channel whose active duration was the longest.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 channel code and contact number of the customer contact channel whose active duration was the longest.` to a syntactically-correct PostgreSQL query.
SELECT channel_code , contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date = (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1)
Find the name and active date of the customer that use email as the contact channel.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 and active date of the customer that use email as the contact channel.` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name , t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email'
What are the name and active date of the customers whose contact channel code is email?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 active date of the customers whose contact channel code is email?` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name , t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email'
What is the name of the customer that made the order with the largest quantity?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customer that made the order with the largest quantity?` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t3.order_quantity = ( SELECT max(order_quantity) FROM order_items)
Find the name of the customer who made the order of the largest amount of goods.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customer who made the order of the largest amount of goods.` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t3.order_quantity = ( SELECT max(order_quantity) FROM order_items)
What is the name of the customer that has purchased the most items?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customer that has purchased the most items?` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY sum(t3.order_quantity) DESC LIMIT 1
Give me the name of the customer who ordered the most items in total.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 me the name of the customer who ordered the most items in total.` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY sum(t3.order_quantity) DESC LIMIT 1
What is the payment method of the customer that has purchased the least quantity of items?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 payment method of the customer that has purchased the least quantity of items?` to a syntactically-correct PostgreSQL query.
SELECT t1.payment_method FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY sum(t3.order_quantity) LIMIT 1
Tell me the payment method used by the customer who ordered the least amount of goods in total.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 `Tell me the payment method used by the customer who ordered the least amount of goods in total.` to a syntactically-correct PostgreSQL query.
SELECT t1.payment_method FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY sum(t3.order_quantity) LIMIT 1
How many types of products have Rodrick Heaney bought in total?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 types of products have Rodrick Heaney bought in total?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT t3.product_id) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney"
Find the number of distinct products Rodrick Heaney has bought so far.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 distinct products Rodrick Heaney has bought so far.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT t3.product_id) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney"
What is the total quantity of products purchased by "Rodrick Heaney"?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 total quantity of products purchased by "Rodrick Heaney"?` to a syntactically-correct PostgreSQL query.
SELECT sum(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney"
Tell me the total quantity of products bought by the customer called "Rodrick Heaney".
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 `Tell me the total quantity of products bought by the customer called "Rodrick Heaney".` to a syntactically-correct PostgreSQL query.
SELECT sum(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney"
How many customers have at least one order with status "Cancelled"?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customers have at least one order with status "Cancelled"?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT customer_id) FROM customer_orders WHERE order_status = "Cancelled"
Return the number of customers who have at least one order with "Cancelled" status.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 number of customers who have at least one order with "Cancelled" status.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT customer_id) FROM customer_orders WHERE order_status = "Cancelled"
How many orders have detail "Second time"?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 orders have detail "Second time"?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customer_orders WHERE order_details = "Second time"
Tell me the number of orders with "Second time" as order detail.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 `Tell me the number of orders with "Second time" as order detail.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customer_orders WHERE order_details = "Second time"
Find the customer name and date of the orders that have the status "Delivered".
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customer name and date of the orders that have the status "Delivered".` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name , t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id WHERE order_status = "Delivered"
What are the customer name and date of the orders whose status is "Delivered".
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customer name and date of the orders whose status is "Delivered".` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name , t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id WHERE order_status = "Delivered"
What is the total number of products that are in orders with status "Cancelled"?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 total number of products that are in orders with status "Cancelled"?` to a syntactically-correct PostgreSQL query.
SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_status = "Cancelled"
Find the total quantity of products associated with the orders in the "Cancelled" status.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 total quantity of products associated with the orders in the "Cancelled" status.` to a syntactically-correct PostgreSQL query.
SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_status = "Cancelled"
Find the total amount of products ordered before 2018-03-17 07:13:53.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 total amount of products ordered before 2018-03-17 07:13:53.` to a syntactically-correct PostgreSQL query.
SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_date < "2018-03-17 07:13:53"
What is the total amount of products purchased before 2018-03-17 07:13:53?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 total amount of products purchased before 2018-03-17 07:13:53?` to a syntactically-correct PostgreSQL query.
SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t1.order_date < "2018-03-17 07:13:53"
Who made the latest order?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 `Who made the latest order?` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.order_date DESC LIMIT 1
Find the name of the customer who made an order most recently.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customer who made an order most recently.` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.order_date DESC LIMIT 1
Which product has been ordered most number of times?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 product has been ordered most number of times?` to a syntactically-correct PostgreSQL query.
SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY count(*) DESC LIMIT 1
What is the most frequently ordered product? Tell me the detail of the product
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 most frequently ordered product? Tell me the detail of the product` to a syntactically-correct PostgreSQL query.
SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY count(*) DESC LIMIT 1
Find the name and ID of the product whose total order quantity is the largest.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 and ID of the product whose total order quantity is the largest.` to a syntactically-correct PostgreSQL query.
SELECT t2.product_details , t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY sum(t1.order_quantity) LIMIT 1
What are the name and ID of the product bought the most.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 ID of the product bought the most.` to a syntactically-correct PostgreSQL query.
SELECT t2.product_details , t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY sum(t1.order_quantity) LIMIT 1
Find all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona.` to a syntactically-correct PostgreSQL query.
SELECT address_content FROM addresses WHERE city = "East Julianaside" AND state_province_county = "Texas" UNION SELECT address_content FROM addresses WHERE city = "Gleasonmouth" AND state_province_county = "Arizona"
What are all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 addresses in East Julianaside, Texas or in Gleasonmouth, Arizona.` to a syntactically-correct PostgreSQL query.
SELECT address_content FROM addresses WHERE city = "East Julianaside" AND state_province_county = "Texas" UNION SELECT address_content FROM addresses WHERE city = "Gleasonmouth" AND state_province_county = "Arizona"
Find the name of customers who did not pay with Cash.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customers who did not pay with Cash.` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers WHERE payment_method != 'Cash'
What is the name of customers who do not use Cash as payment method.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customers who do not use Cash as payment method.` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers WHERE payment_method != 'Cash'
Find the names of customers who never ordered product Latte.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customers who never ordered product Latte.` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte'
What are names of customers who never ordered product Latte.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 names of customers who never ordered product Latte.` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte'
Find the names of customers who never placed an order.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customers who never placed an order.` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id
What are the names of customers who never made an order.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customers who never made an order.` to a syntactically-correct PostgreSQL query.
SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id
Find the names of customers who ordered both products Latte and Americano.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customers who ordered both products Latte and Americano.` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Americano'
What are the names of customers who have purchased both products Latte and Americano?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']] -- Table: products columns : [['product id', 'number'], ['product details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']] -- Table: customer addresses columns : [['customer id', 'number'], ['address id', 'number'], ['date address from', 'time'], ['address type', 'text'], ['date address to', 'time']] -- Table: customer contact channels columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']] -- Table: customer orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['order date', 'time'], ['order details', 'text']] -- Table: order items columns : [['order id', 'number'], ['product id', 'number'], ['order quantity', '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 customers who have purchased both products Latte and Americano?` to a syntactically-correct PostgreSQL query.
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id JOIN products AS t4 ON t3.product_id = t4.product_id WHERE t4.product_details = 'Americano'
How many artists are there?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 artists are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM artist
Count the number of artists.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 artists.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM artist
List the age of all music artists.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 age of all music artists.` to a syntactically-correct PostgreSQL query.
SELECT Age FROM artist
What are the ages of all music artists?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 ages of all music artists?` to a syntactically-correct PostgreSQL query.
SELECT Age FROM artist
What is the average age of all artists?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 average age of all artists?` to a syntactically-correct PostgreSQL query.
SELECT avg(Age) FROM artist
Return the average age across all artists.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 average age across all artists.` to a syntactically-correct PostgreSQL query.
SELECT avg(Age) FROM artist
What are the famous titles of the artist "Triumfall"?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 famous titles of the artist "Triumfall"?` to a syntactically-correct PostgreSQL query.
SELECT Famous_Title FROM artist WHERE Artist = "Triumfall"
Return the famous titles of the artist called "Triumfall".
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 famous titles of the artist called "Triumfall".` to a syntactically-correct PostgreSQL query.
SELECT Famous_Title FROM artist WHERE Artist = "Triumfall"
What are the distinct Famous release dates?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 distinct Famous release dates?` to a syntactically-correct PostgreSQL query.
SELECT distinct(Famous_Release_date) FROM artist
Give the distinct famous release dates for all artists.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 distinct famous release dates for all artists.` to a syntactically-correct PostgreSQL query.
SELECT distinct(Famous_Release_date) FROM artist
Return the dates of ceremony and the results of all music festivals
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 dates of ceremony and the results of all music festivals` to a syntactically-correct PostgreSQL query.
SELECT Date_of_ceremony , RESULT FROM music_festival
What are the dates of ceremony and results for each music festival?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 dates of ceremony and results for each music festival?` to a syntactically-correct PostgreSQL query.
SELECT Date_of_ceremony , RESULT FROM music_festival
What are the category of music festivals with result "Awarded"?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 category of music festivals with result "Awarded"?` to a syntactically-correct PostgreSQL query.
SELECT Category FROM music_festival WHERE RESULT = "Awarded"
Return the categories of music festivals that have the result "Awarded".
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 categories of music festivals that have the result "Awarded".` to a syntactically-correct PostgreSQL query.
SELECT Category FROM music_festival WHERE RESULT = "Awarded"
What are the maximum and minimum week on top of all volumes?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 maximum and minimum week on top of all volumes?` to a syntactically-correct PostgreSQL query.
SELECT max(Weeks_on_Top) , min(Weeks_on_Top) FROM volume
Give the maximum and minimum weeks on top across all volumes.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 maximum and minimum weeks on top across all volumes.` to a syntactically-correct PostgreSQL query.
SELECT max(Weeks_on_Top) , min(Weeks_on_Top) FROM volume
What are the songs in volumes with more than 1 week on top?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 songs in volumes with more than 1 week on top?` to a syntactically-correct PostgreSQL query.
SELECT Song FROM volume WHERE Weeks_on_Top > 1
Give the songs included in volumes that have more than 1 week on top.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 songs included in volumes that have more than 1 week on top.` to a syntactically-correct PostgreSQL query.
SELECT Song FROM volume WHERE Weeks_on_Top > 1
Please list all songs in volumes in ascending alphabetical order.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 `Please list all songs in volumes in ascending alphabetical order.` to a syntactically-correct PostgreSQL query.
SELECT Song FROM volume ORDER BY Song
What are the the songs in volumes, listed in ascending order?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 the songs in volumes, listed in ascending order?` to a syntactically-correct PostgreSQL query.
SELECT Song FROM volume ORDER BY Song
How many distinct artists do the volumes associate to?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 artists do the volumes associate to?` to a syntactically-correct PostgreSQL query.
SELECT COUNT(DISTINCT Artist_ID) FROM volume
Count the number of distinct artists who have volumes.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 distinct artists who have volumes.` to a syntactically-correct PostgreSQL query.
SELECT COUNT(DISTINCT Artist_ID) FROM volume
Please show the date of ceremony of the volumes that last more than 2 weeks on top.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 `Please show the date of ceremony of the volumes that last more than 2 weeks on top.` to a syntactically-correct PostgreSQL query.
SELECT T1.Date_of_ceremony FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T2.Weeks_on_Top > 2
What are the dates of ceremony at music festivals corresponding to volumes that lasted more than 2 weeks on top?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 dates of ceremony at music festivals corresponding to volumes that lasted more than 2 weeks on top?` to a syntactically-correct PostgreSQL query.
SELECT T1.Date_of_ceremony FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T2.Weeks_on_Top > 2
Please show the songs that have result "nominated" at music festivals.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 `Please show the songs that have result "nominated" at music festivals.` to a syntactically-correct PostgreSQL query.
SELECT T2.Song FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T1.Result = "Nominated"
What are the songs in volumes that have resulted in a nomination at music festivals?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 songs in volumes that have resulted in a nomination at music festivals?` to a syntactically-correct PostgreSQL query.
SELECT T2.Song FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T1.Result = "Nominated"
What are the issue dates of volumes associated with the artist "Gorgoroth"?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 issue dates of volumes associated with the artist "Gorgoroth"?` to a syntactically-correct PostgreSQL query.
SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Artist = "Gorgoroth"
Return the issue dates of volumes that are by the artist named Gorgoroth.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 issue dates of volumes that are by the artist named Gorgoroth.` to a syntactically-correct PostgreSQL query.
SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Artist = "Gorgoroth"
What are the songs in volumes associated with the artist aged 32 or older?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 songs in volumes associated with the artist aged 32 or older?` to a syntactically-correct PostgreSQL query.
SELECT T2.Song FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age >= 32
Return names of songs in volumes that are by artists that are at least 32 years old.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 names of songs in volumes that are by artists that are at least 32 years old.` to a syntactically-correct PostgreSQL query.
SELECT T2.Song FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age >= 32
What is the average weeks on top of volumes associated with the artist aged 25 or younger?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 average weeks on top of volumes associated with the artist aged 25 or younger?` to a syntactically-correct PostgreSQL query.
SELECT avg(T2.Weeks_on_Top) FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age <= 25
Return the average number of weeks on top for volumes by artists that are at most 25 years old.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 average number of weeks on top for volumes by artists that are at most 25 years old.` to a syntactically-correct PostgreSQL query.
SELECT avg(T2.Weeks_on_Top) FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age <= 25
What are the famous title of the artists associated with volumes with more than 2 weeks on top?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 famous title of the artists associated with volumes with more than 2 weeks on top?` to a syntactically-correct PostgreSQL query.
SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2
Return the famous titles for artists that have volumes that lasted more than 2 weeks on top.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 famous titles for artists that have volumes that lasted more than 2 weeks on top.` to a syntactically-correct PostgreSQL query.
SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2
Please list the age and famous title of artists in descending order of age.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 `Please list the age and famous title of artists in descending order of age.` to a syntactically-correct PostgreSQL query.
SELECT Famous_Title , Age FROM artist ORDER BY Age DESC
What are the famous titles and ages of each artist, listed in descending order by age?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 famous titles and ages of each artist, listed in descending order by age?` to a syntactically-correct PostgreSQL query.
SELECT Famous_Title , Age FROM artist ORDER BY Age DESC
What is the famous release date of the artist with the oldest age?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 famous release date of the artist with the oldest age?` to a syntactically-correct PostgreSQL query.
SELECT Famous_Release_date FROM artist ORDER BY Age DESC LIMIT 1
Return the famous release date for the oldest artist.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 famous release date for the oldest artist.` to a syntactically-correct PostgreSQL query.
SELECT Famous_Release_date FROM artist ORDER BY Age DESC LIMIT 1
Please show the categories of the music festivals and the count.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 `Please show the categories of the music festivals and the count.` to a syntactically-correct PostgreSQL query.
SELECT Category , COUNT(*) FROM music_festival GROUP BY Category
Return the number of music festivals of each category.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 number of music festivals of each category.` to a syntactically-correct PostgreSQL query.
SELECT Category , COUNT(*) FROM music_festival GROUP BY Category
What is the most common result of the music festival?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 most common result of the music festival?` to a syntactically-correct PostgreSQL query.
SELECT RESULT FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1
Return the result that is most frequent at music festivals.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 result that is most frequent at music festivals.` to a syntactically-correct PostgreSQL query.
SELECT RESULT FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1
Please show the categories of the music festivals with count more than 1.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 `Please show the categories of the music festivals with count more than 1.` to a syntactically-correct PostgreSQL query.
SELECT Category FROM music_festival GROUP BY Category HAVING COUNT(*) > 1
What are the categories of music festivals for which there have been more than 1 music festival?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 categories of music festivals for which there have been more than 1 music festival?` to a syntactically-correct PostgreSQL query.
SELECT Category FROM music_festival GROUP BY Category HAVING COUNT(*) > 1
What is the song in the volume with the maximum weeks on top?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 song in the volume with the maximum weeks on top?` to a syntactically-correct PostgreSQL query.
SELECT Song FROM volume ORDER BY Weeks_on_Top DESC LIMIT 1
Return the song in the volume that has spent the most weeks on top?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 song in the volume that has spent the most weeks on top?` to a syntactically-correct PostgreSQL query.
SELECT Song FROM volume ORDER BY Weeks_on_Top DESC LIMIT 1
Find the famous titles of artists that do not have any volume.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 famous titles of artists that do not have any volume.` to a syntactically-correct PostgreSQL query.
SELECT Famous_Title FROM artist WHERE Artist_ID NOT IN(SELECT Artist_ID FROM volume)
What are the famous titles of artists who do not have any volumes?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 famous titles of artists who do not have any volumes?` to a syntactically-correct PostgreSQL query.
SELECT Famous_Title FROM artist WHERE Artist_ID NOT IN(SELECT Artist_ID FROM volume)
Show the famous titles of the artists with both volumes that lasted more than 2 weeks on top and volumes that lasted less than 2 weeks on top.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 `Show the famous titles of the artists with both volumes that lasted more than 2 weeks on top and volumes that lasted less than 2 weeks on top.` to a syntactically-correct PostgreSQL query.
SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2 INTERSECT SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top < 2
What are the famous titles of artists who have not only had volumes that spent more than 2 weeks on top but also volumes that spent less than 2 weeks on top?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 famous titles of artists who have not only had volumes that spent more than 2 weeks on top but also volumes that spent less than 2 weeks on top?` to a syntactically-correct PostgreSQL query.
SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2 INTERSECT SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top < 2
What are the date of ceremony of music festivals with category "Best Song" and result "Awarded"?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 date of ceremony of music festivals with category "Best Song" and result "Awarded"?` to a syntactically-correct PostgreSQL query.
SELECT Date_of_ceremony FROM music_festival WHERE Category = "Best Song" AND RESULT = "Awarded"
Return the dates of ceremony corresponding to music festivals that had the category "Best Song" and result "Awarded".
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 dates of ceremony corresponding to music festivals that had the category "Best Song" and result "Awarded".` to a syntactically-correct PostgreSQL query.
SELECT Date_of_ceremony FROM music_festival WHERE Category = "Best Song" AND RESULT = "Awarded"
What is the issue date of the volume with the minimum weeks on top?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 issue date of the volume with the minimum weeks on top?` to a syntactically-correct PostgreSQL query.
SELECT Issue_Date FROM volume ORDER BY Weeks_on_Top ASC LIMIT 1
Return the issue date of the volume that has spent the fewest weeks on top.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 issue date of the volume that has spent the fewest weeks on top.` to a syntactically-correct PostgreSQL query.
SELECT Issue_Date FROM volume ORDER BY Weeks_on_Top ASC LIMIT 1
How many distinct artists have volumes?
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 artists have volumes?` to a syntactically-correct PostgreSQL query.
SELECT COUNT(DISTINCT Artist_ID) FROM volume
Count the number of artists who have had volumes.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 artists who have had volumes.` to a syntactically-correct PostgreSQL query.
SELECT COUNT(DISTINCT Artist_ID) FROM volume
Please show the results of music festivals and the number of music festivals that have had each, ordered by this count.
-- Language PostgreSQL -- Tables: -- Table: artist columns : [['artist id', 'number'], ['artist', 'text'], ['age', 'number'], ['famous title', 'text'], ['famous release date', 'text']] -- Table: volume columns : [['volume id', 'number'], ['volume issue', 'text'], ['issue date', 'text'], ['weeks on top', 'number'], ['song', 'text'], ['artist id', 'number']] -- Table: music festival columns : [['id', 'number'], ['music festival', 'text'], ['date of ceremony', 'text'], ['category', 'text'], ['volume', 'number'], ['result', '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 `Please show the results of music festivals and the number of music festivals that have had each, ordered by this count.` to a syntactically-correct PostgreSQL query.
SELECT RESULT , COUNT(*) FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC