sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image 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 users are logged in?
SQL: SELECT count(*) FROM users WHERE user_login  =  1
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image 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: Count the number of users that are logged in.
SQL: SELECT count(*) FROM users WHERE user_login  =  1
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image 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: Find the description of the most popular role among the users that have logged in.
SQL: SELECT role_description FROM ROLES WHERE role_code  =  (SELECT role_code FROM users WHERE user_login  =  1 GROUP BY role_code ORDER BY count(*) DESC LIMIT 1)
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image 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 description of the most popular role among users that have logged in?
SQL: SELECT role_description FROM ROLES WHERE role_code  =  (SELECT role_code FROM users WHERE user_login  =  1 GROUP BY role_code ORDER BY count(*) DESC LIMIT 1)
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image 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: Find the average access count of documents with the least popular structure.
SQL: SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image 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 access count of documents that have the least common structure?
SQL: SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image 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 all the image name and URLs in the order of their names.
SQL: SELECT image_name ,  image_url FROM images ORDER BY image_name
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image 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 urls of images, sorted alphabetically?
SQL: SELECT image_name ,  image_url FROM images ORDER BY image_name
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image 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: Find the number of users in each role.
SQL: SELECT count(*) ,  role_code FROM users GROUP BY role_code
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image 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 different role codes for users, and how many users have each?
SQL: SELECT count(*) ,  role_code FROM users GROUP BY role_code
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image 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 document types have more than 2 corresponding documents?
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*)  >  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: roles 
columns : [['role code', 'text'], ['role description', 'text']]

 -- Table: users 
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]

 -- Table: document structures 
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]

 -- Table: functional areas 
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]

 -- Table: images 
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]

 -- Table: documents 
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]

 -- Table: document functional areas 
columns : [['document code', 'text'], ['functional area code', 'text']]

 -- Table: document sections 
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]

 -- Table: document sections images 
columns : [['section id', 'number'], ['image 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: Give the codes of document types that have more than 2 corresponding documents.
SQL: SELECT document_type_code FROM documents GROUP BY document_type_code 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: How many companies are there?
SQL: SELECT count(*) FROM Companies
-- 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: Count the number of companies.
SQL: SELECT count(*) FROM Companies
-- 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 companies in descending order of market value.
SQL: SELECT name FROM Companies ORDER BY Market_Value_billion 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 the company names in descending order of the company's market value.
SQL: SELECT name FROM Companies ORDER BY Market_Value_billion 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: What are the names of companies whose headquarters are not "USA"?
SQL: SELECT name FROM Companies WHERE Headquarters != 'USA'
-- 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 companies whose headquarters are not located in "USA".
SQL: SELECT name FROM Companies WHERE Headquarters != 'USA'
-- 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: What are the name and assets of each company, sorted in ascending order of company name?
SQL: SELECT name ,  Assets_billion FROM Companies ORDER BY name 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: List the name and assets of each company in ascending order of company name.
SQL: SELECT name ,  Assets_billion FROM Companies ORDER BY name 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: What are the average profits of companies?
SQL: SELECT avg(Profits_billion) FROM Companies
-- 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: Compute the average profits companies make.
SQL: SELECT avg(Profits_billion) FROM Companies
-- 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: What are the maximum and minimum sales of the companies whose industries are not "Banking".
SQL: SELECT max(Sales_billion) ,  min(Sales_billion) FROM Companies WHERE Industry != "Banking"
-- 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 maximum and minimum sales of the companies that are not in the "Banking" industry.
SQL: SELECT max(Sales_billion) ,  min(Sales_billion) FROM Companies WHERE Industry != "Banking"
-- 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 different industries are the companies in?
SQL: SELECT count(DISTINCT Industry) FROM Companies
-- 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: Count the number of distinct company industries.
SQL: SELECT count(DISTINCT Industry) FROM Companies
-- 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 in descending order of building height.
SQL: SELECT name FROM buildings ORDER BY Height 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: What are the names of buildings sorted in descending order of building height?
SQL: SELECT name FROM buildings ORDER BY Height 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: Find the stories of the building with the largest height.
SQL: SELECT Stories FROM buildings ORDER BY Height 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: What is the stories of highest building?
SQL: SELECT Stories FROM buildings ORDER BY Height 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 name of a building along with the name of a company whose office is in the building.
SQL: SELECT T3.name ,  T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id
-- 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: For each company, return the company name and the name of the building its office is located in.
SQL: SELECT T3.name ,  T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id
-- 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 names of the buildings that have more than one company offices.
SQL: SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id HAVING COUNT(*)  >  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 buildings have more than one company offices? Give me the building names.
SQL: SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id HAVING COUNT(*)  >  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: Show the name of the building that has the most company offices.
SQL: SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id 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 building has the largest number of company offices? Give me the building name.
SQL: SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id  =  T2.id JOIN Companies AS T3 ON T1.company_id  =  T3.id GROUP BY T1.building_id 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: Please show the names of the buildings whose status is "on-hold", in ascending order of stories.
SQL: SELECT name FROM buildings WHERE Status  =  "on-hold" ORDER BY Stories ASC