sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the names of the buildings in "on-hold" status, and sort them in ascending order of building stories.
SQL: SELECT name FROM buildings WHERE Status  =  "on-hold" ORDER BY Stories ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Please show each industry and the corresponding number of companies in that industry.
SQL: SELECT Industry ,  COUNT(*) FROM Companies GROUP BY Industry
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Whah are the name of each industry and the number of companies in that industry?
SQL: SELECT Industry ,  COUNT(*) FROM Companies GROUP BY Industry
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Please show the industries of companies in descending order of the number of companies.
SQL: SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Sort all the industries in descending order of the count of companies in each industry
SQL: SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List the industry shared by the most companies.
SQL: SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Which industry has the most companies?
SQL: SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List the names of buildings that have no company office.
SQL: SELECT name FROM buildings WHERE id NOT IN (SELECT building_id FROM Office_locations)
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Which buildings do not have any company office? Give me the building names.
SQL: SELECT name FROM buildings WHERE id NOT IN (SELECT building_id FROM Office_locations)
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Show the industries shared by companies whose headquarters are "USA" and companies whose headquarters are "China".
SQL: SELECT Industry FROM Companies WHERE Headquarters  =  "USA" INTERSECT SELECT Industry FROM Companies WHERE Headquarters  =  "China"
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Which industries have both companies with headquarter in "USA" and companies with headquarter in "China"?
SQL: SELECT Industry FROM Companies WHERE Headquarters  =  "USA" INTERSECT SELECT Industry FROM Companies WHERE Headquarters  =  "China"
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the number of companies whose industry is "Banking" or "Conglomerate",
SQL: SELECT count(*) FROM Companies WHERE Industry  =  "Banking" OR Industry  =  "Conglomerate"
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many companies are in either "Banking" industry or "Conglomerate" industry?
SQL: SELECT count(*) FROM Companies WHERE Industry  =  "Banking" OR Industry  =  "Conglomerate"
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Show the headquarters shared by more than two companies.
SQL: SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*)  >  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: buildings 
columns : [['id', 'number'], ['name', 'text'], ['city', 'text'], ['height', 'number'], ['stories', 'number'], ['status', 'text']]

 -- Table: companies 
columns : [['id', 'number'], ['name', 'text'], ['headquarters', 'text'], ['industry', 'text'], ['sales billion', 'number'], ['profits billion', 'number'], ['assets billion', 'number'], ['market value billion', 'text']]

 -- Table: office locations 
columns : [['building id', 'number'], ['company id', 'number'], ['move in year', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Which headquarter locations are used by more than 2 companies?
SQL: SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*)  >  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many products are there?
SQL: SELECT count(*) FROM Products
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List the name of products in ascending order of price.
SQL: SELECT Product_Name FROM Products ORDER BY Product_Price ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the names and type codes of products?
SQL: SELECT Product_Name ,  Product_Type_Code FROM Products
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Show the prices of the products named "Dining" or "Trading Policy".
SQL: SELECT Product_Price FROM Products WHERE Product_Name  =  "Dining" OR Product_Name  =  "Trading Policy"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the average price for products?
SQL: SELECT avg(Product_Price) FROM Products
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the name of the product with the highest price?
SQL: SELECT Product_Name FROM Products ORDER BY Product_Price DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Show different type codes of products and the number of products with each type code.
SQL: SELECT Product_Type_Code ,  COUNT(*) FROM Products GROUP BY Product_Type_Code
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Show the most common type code across products.
SQL: SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Show the product type codes that have at least two products.
SQL: SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code HAVING COUNT(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Show the product type codes that have both products with price higher than 4500 and products with price lower than 3000.
SQL: SELECT Product_Type_Code FROM Products WHERE Product_Price  >  4500 INTERSECT SELECT Product_Type_Code FROM Products WHERE Product_Price  <  3000
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Show the names of products and the number of events they are in.
SQL: SELECT T1.Product_Name ,  COUNT(*) FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID  =  T2.Product_ID GROUP BY T1.Product_Name
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Show the names of products and the number of events they are in, sorted by the number of events in descending order.
SQL: SELECT T1.Product_Name ,  COUNT(*) FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID  =  T2.Product_ID GROUP BY T1.Product_Name ORDER BY COUNT(*) DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Show the names of products that are in at least two events.
SQL: SELECT T1.Product_Name FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID  =  T2.Product_ID GROUP BY T1.Product_Name HAVING COUNT(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Show the names of products that are in at least two events in ascending alphabetical order of product name.
SQL: SELECT T1.Product_Name FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID  =  T2.Product_ID GROUP BY T1.Product_Name HAVING COUNT(*)  >=  2 ORDER BY T1.Product_Name
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address details', 'text']]

 -- Table: locations 
columns : [['location id', 'number'], ['other details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: parties 
columns : [['party id', 'number'], ['party details', 'text']]

 -- Table: assets 
columns : [['asset id', 'number'], ['other details', 'text']]

 -- Table: channels 
columns : [['channel id', 'number'], ['other details', 'text']]

 -- Table: finances 
columns : [['finance id', 'number'], ['other details', 'text']]

 -- Table: events 
columns : [['event id', 'number'], ['address id', 'number'], ['channel id', 'number'], ['event type code', 'text'], ['finance id', 'number'], ['location id', 'number']]

 -- Table: products in events 
columns : [['product in event id', 'number'], ['event id', 'number'], ['product id', 'number']]

 -- Table: parties in events 
columns : [['party id', 'number'], ['event id', 'number'], ['role code', 'text']]

 -- Table: agreements 
columns : [['document id', 'number'], ['event id', 'number']]

 -- Table: assets in events 
columns : [['asset id', 'number'], ['event id', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List the names of products that are not in any event.
SQL: SELECT Product_Name FROM Products WHERE Product_ID NOT IN (SELECT Product_ID FROM Products_in_Events)
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

 -- Table: artwork 
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', '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.



Question: How many artworks are there?
SQL: SELECT count(*) FROM artwork
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

 -- Table: artwork 
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', '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.



Question: List the name of artworks in ascending alphabetical order.
SQL: SELECT Name FROM artwork ORDER BY Name ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

 -- Table: artwork 
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', '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.



Question: List the name of artworks whose type is not "Program Talent Show".
SQL: SELECT Name FROM artwork WHERE TYPE != "Program Talent Show"
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

 -- Table: artwork 
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', '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.



Question: What are the names and locations of festivals?
SQL: SELECT Festival_Name ,  LOCATION FROM festival_detail
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

 -- Table: artwork 
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', '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.



Question: What are the names of the chairs of festivals, sorted in ascending order of the year held?
SQL: SELECT Chair_Name FROM festival_detail ORDER BY YEAR ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

 -- Table: artwork 
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', '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.



Question: What is the location of the festival with the largest number of audience?
SQL: SELECT LOCATION FROM festival_detail ORDER BY Num_of_Audience DESC LIMIT 1