brief_instruction stringlengths 16 224 | instruction stringlengths 687 8.77k | output stringlengths 18 577 |
|---|---|---|
What are the names of all the documents, as well as the access counts of each, ordered alphabetically? |
-- 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.
Translate `What are the names of all the documents, as well as the access counts of each, ordered alphabetically?` to a syntactically-correct PostgreSQL query.
| SELECT document_name , access_count FROM documents ORDER BY document_name |
Find the name of the document that has been accessed the greatest number of times, as well as the count of how many times it has been accessed? |
-- 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.
Translate `Find the name of the document that has been accessed the greatest number of times, as well as the count of how many times it has been accessed?` to a syntactically-correct PostgreSQL query.
| SELECT document_name , access_count FROM documents ORDER BY access_count DESC LIMIT 1 |
What is the name of the document which has been accessed the most times, as well as the number of times it has been accessed? |
-- 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.
Translate `What is the name of the document which has been accessed the most times, as well as the number of times it has been accessed?` to a syntactically-correct PostgreSQL query.
| SELECT document_name , access_count FROM documents ORDER BY access_count DESC LIMIT 1 |
Find the types of documents with more than 4 documents. |
-- 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.
Translate `Find the types of documents with more than 4 documents.` to a syntactically-correct PostgreSQL query.
| SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*) > 4 |
What are the codes of types of documents of which there are for or more? |
-- 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.
Translate `What are the codes of types of documents of which there are for or more?` to a syntactically-correct PostgreSQL query.
| SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*) > 4 |
Find the total access count of all documents in the most popular document type. |
-- 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.
Translate `Find the total access count of all documents in the most popular document type.` to a syntactically-correct PostgreSQL query.
| SELECT sum(access_count) FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1 |
What is the total access count of documents that are of the most common document type? |
-- 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.
Translate `What is the total access count of documents that are of the most common document type?` to a syntactically-correct PostgreSQL query.
| SELECT sum(access_count) FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 1 |
What is the average access count of documents? |
-- 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.
Translate `What is the average access count of documents?` to a syntactically-correct PostgreSQL query.
| SELECT avg(access_count) FROM documents |
Find the average access count across all documents? |
-- 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.
Translate `Find the average access count across all documents?` to a syntactically-correct PostgreSQL query.
| SELECT avg(access_count) FROM documents |
What is the structure of the document with the least number of accesses? |
-- 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.
Translate `What is the structure of the document with the least number of accesses?` to a syntactically-correct PostgreSQL query.
| SELECT t2.document_structure_description FROM documents AS t1 JOIN document_structures AS t2 ON t1.document_structure_code = t2.document_structure_code GROUP BY t1.document_structure_code ORDER BY count(*) DESC LIMIT 1 |
Return the structure description of the document that has been accessed the fewest number of times. |
-- 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.
Translate `Return the structure description of the document that has been accessed the fewest number of times.` to a syntactically-correct PostgreSQL query.
| SELECT t2.document_structure_description FROM documents AS t1 JOIN document_structures AS t2 ON t1.document_structure_code = t2.document_structure_code GROUP BY t1.document_structure_code ORDER BY count(*) DESC LIMIT 1 |
What is the type of the document named "David CV"? |
-- 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.
Translate `What is the type of the document named "David CV"?` to a syntactically-correct PostgreSQL query.
| SELECT document_type_code FROM documents WHERE document_name = "David CV" |
Return the type code of the document named "David CV". |
-- 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.
Translate `Return the type code of the document named "David CV".` to a syntactically-correct PostgreSQL query.
| SELECT document_type_code FROM documents WHERE document_name = "David CV" |
Find the list of documents that are both in the most three popular type and have the most three popular structure. |
-- 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.
Translate `Find the list of documents that are both in the most three popular type and have the most three popular structure.` to a syntactically-correct PostgreSQL query.
| SELECT document_name FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 3 INTERSECT SELECT document_name FROM documents GROUP BY document_structure_code ORDER BY count(*) DESC LIMIT 3 |
What are the names of documents that have both one of the three most common types and one of three most common structures? |
-- 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.
Translate `What are the names of documents that have both one of the three most common types and one of three most common structures?` to a syntactically-correct PostgreSQL query.
| SELECT document_name FROM documents GROUP BY document_type_code ORDER BY count(*) DESC LIMIT 3 INTERSECT SELECT document_name FROM documents GROUP BY document_structure_code ORDER BY count(*) DESC LIMIT 3 |
What document types do have more than 10000 total access number. |
-- 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.
Translate `What document types do have more than 10000 total access number.` to a syntactically-correct PostgreSQL query.
| SELECT document_type_code FROM documents GROUP BY document_type_code HAVING sum(access_count) > 10000 |
Return the codes of the document types that do not have a total access count of over 10000. |
-- 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.
Translate `Return the codes of the document types that do not have a total access count of over 10000.` to a syntactically-correct PostgreSQL query.
| SELECT document_type_code FROM documents GROUP BY document_type_code HAVING sum(access_count) > 10000 |
What are all the section titles of the document named "David CV"? |
-- 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.
Translate `What are all the section titles of the document named "David CV"?` to a syntactically-correct PostgreSQL query.
| SELECT t2.section_title FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code WHERE t1.document_name = "David CV" |
Give the section titles of the document with the name "David CV". |
-- 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.
Translate `Give the section titles of the document with the name "David CV".` to a syntactically-correct PostgreSQL query.
| SELECT t2.section_title FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code WHERE t1.document_name = "David CV" |
Find all the name of documents without any sections. |
-- 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.
Translate `Find all the name of documents without any sections.` to a syntactically-correct PostgreSQL query.
| SELECT document_name FROM documents WHERE document_code NOT IN (SELECT document_code FROM document_sections) |
What are the names of documents that do not have any sections? |
-- 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.
Translate `What are the names of documents that do not have any sections?` to a syntactically-correct PostgreSQL query.
| SELECT document_name FROM documents WHERE document_code NOT IN (SELECT document_code FROM document_sections) |
List all the username and passwords of users with the most popular role. |
-- 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.
Translate `List all the username and passwords of users with the most popular role.` to a syntactically-correct PostgreSQL query.
| SELECT user_name , password FROM users GROUP BY role_code ORDER BY count(*) DESC LIMIT 1 |
What are the usernames and passwords of users that have the most common role? |
-- 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.
Translate `What are the usernames and passwords of users that have the most common role?` to a syntactically-correct PostgreSQL query.
| SELECT user_name , password FROM users GROUP BY role_code ORDER BY count(*) DESC LIMIT 1 |
Find the average access counts of documents with functional area "Acknowledgement". |
-- 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.
Translate `Find the average access counts of documents with functional area "Acknowledgement".` to a syntactically-correct PostgreSQL query.
| SELECT avg(t1.access_count) FROM documents AS t1 JOIN document_functional_areas AS t2 ON t1.document_code = t2.document_code JOIN functional_areas AS t3 ON t2.functional_area_code = t3.functional_area_code WHERE t3.functional_area_description = "Acknowledgement" |
What are the average access counts of documents that have the functional area description "Acknowledgement"? |
-- 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.
Translate `What are the average access counts of documents that have the functional area description "Acknowledgement"?` to a syntactically-correct PostgreSQL query.
| SELECT avg(t1.access_count) FROM documents AS t1 JOIN document_functional_areas AS t2 ON t1.document_code = t2.document_code JOIN functional_areas AS t3 ON t2.functional_area_code = t3.functional_area_code WHERE t3.functional_area_description = "Acknowledgement" |
Find names of the document without any images. |
-- 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.
Translate `Find names of the document without any images.` to a syntactically-correct PostgreSQL query.
| SELECT document_name FROM documents EXCEPT SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code JOIN document_sections_images AS t3 ON t2.section_id = t3.section_id |
What are the names of documents that do not have any images? |
-- 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.
Translate `What are the names of documents that do not have any images?` to a syntactically-correct PostgreSQL query.
| SELECT document_name FROM documents EXCEPT SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code JOIN document_sections_images AS t3 ON t2.section_id = t3.section_id |
What is the name of the document with the most number of sections? |
-- 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.
Translate `What is the name of the document with the most number of sections?` to a syntactically-correct PostgreSQL query.
| SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code GROUP BY t1.document_code ORDER BY count(*) DESC LIMIT 1 |
Return the name of the document that has the most sections. |
-- 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.
Translate `Return the name of the document that has the most sections.` to a syntactically-correct PostgreSQL query.
| SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code GROUP BY t1.document_code ORDER BY count(*) DESC LIMIT 1 |
List all the document names which contains "CV". |
-- 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.
Translate `List all the document names which contains "CV".` to a syntactically-correct PostgreSQL query.
| SELECT document_name FROM documents WHERE document_name LIKE "%CV%" |
What are the names of documents that contain the substring "CV"? |
-- 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.
Translate `What are the names of documents that contain the substring "CV"?` to a syntactically-correct PostgreSQL query.
| SELECT document_name FROM documents WHERE document_name LIKE "%CV%" |
How many users are logged in? |
-- 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.
Translate `How many users are logged in?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM users WHERE user_login = 1 |
Count the number of users that are logged in. |
-- 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.
Translate `Count the number of users that are logged in.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM users WHERE user_login = 1 |
Find the description of the most popular role among the users that have logged in. |
-- 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.
Translate `Find the description of the most popular role among the users that have logged in.` to a syntactically-correct PostgreSQL query.
| 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) |
What is the description of the most popular role among users that have logged in? |
-- 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.
Translate `What is the description of the most popular role among users that have logged in?` to a syntactically-correct PostgreSQL query.
| 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) |
Find the average access count of documents with the least popular structure. |
-- 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.
Translate `Find the average access count of documents with the least popular structure.` to a syntactically-correct PostgreSQL query.
| SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1 |
What is the average access count of documents that have the least common structure? |
-- 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.
Translate `What is the average access count of documents that have the least common structure?` to a syntactically-correct PostgreSQL query.
| SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1 |
List all the image name and URLs in the order of their names. |
-- 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.
Translate `List all the image name and URLs in the order of their names.` to a syntactically-correct PostgreSQL query.
| SELECT image_name , image_url FROM images ORDER BY image_name |
What are the names and urls of images, sorted alphabetically? |
-- 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.
Translate `What are the names and urls of images, sorted alphabetically?` to a syntactically-correct PostgreSQL query.
| SELECT image_name , image_url FROM images ORDER BY image_name |
Find the number of users in each role. |
-- 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.
Translate `Find the number of users in each role.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , role_code FROM users GROUP BY role_code |
What are the different role codes for users, and how many users have each? |
-- 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.
Translate `What are the different role codes for users, and how many users have each?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , role_code FROM users GROUP BY role_code |
What document types have more than 2 corresponding documents? |
-- 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.
Translate `What document types have more than 2 corresponding documents?` to a syntactically-correct PostgreSQL query.
| SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*) > 2 |
Give the codes of document types that have more than 2 corresponding documents. |
-- 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.
Translate `Give the codes of document types that have more than 2 corresponding documents.` to a syntactically-correct PostgreSQL query.
| SELECT document_type_code FROM documents GROUP BY document_type_code HAVING count(*) > 2 |
How many companies are there? |
-- 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.
Translate `How many companies are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Companies |
Count the number of 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.
Translate `Count the number of companies.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Companies |
List the names of companies in descending order of market value. |
-- 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.
Translate `List the names of companies in descending order of market value.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Companies ORDER BY Market_Value_billion DESC |
Sort the company names in descending order of the company's market value. |
-- 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.
Translate `Sort the company names in descending order of the company's market value.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Companies ORDER BY Market_Value_billion DESC |
What are the names of companies whose headquarters are not "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.
Translate `What are the names of companies whose headquarters are not "USA"?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Companies WHERE Headquarters != 'USA' |
Find the names of the companies whose headquarters are not located in "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.
Translate `Find the names of the companies whose headquarters are not located in "USA".` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Companies WHERE Headquarters != 'USA' |
What are the name and assets of each company, sorted in ascending order of company name? |
-- 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.
Translate `What are the name and assets of each company, sorted in ascending order of company name?` to a syntactically-correct PostgreSQL query.
| SELECT name , Assets_billion FROM Companies ORDER BY name ASC |
List the name and assets of each company in ascending order of company name. |
-- 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.
Translate `List the name and assets of each company in ascending order of company name.` to a syntactically-correct PostgreSQL query.
| SELECT name , Assets_billion FROM Companies ORDER BY name ASC |
What are the average profits of 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.
Translate `What are the average profits of companies?` to a syntactically-correct PostgreSQL query.
| SELECT avg(Profits_billion) FROM Companies |
Compute the average profits companies make. |
-- 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.
Translate `Compute the average profits companies make.` to a syntactically-correct PostgreSQL query.
| SELECT avg(Profits_billion) FROM Companies |
What are the maximum and minimum sales of the companies whose industries are not "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.
Translate `What are the maximum and minimum sales of the companies whose industries are not "Banking".` to a syntactically-correct PostgreSQL query.
| SELECT max(Sales_billion) , min(Sales_billion) FROM Companies WHERE Industry != "Banking" |
Find the maximum and minimum sales of the companies that are not in the "Banking" 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.
Translate `Find the maximum and minimum sales of the companies that are not in the "Banking" industry.` to a syntactically-correct PostgreSQL query.
| SELECT max(Sales_billion) , min(Sales_billion) FROM Companies WHERE Industry != "Banking" |
How many different industries are the companies in? |
-- 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.
Translate `How many different industries are the companies in?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT Industry) FROM Companies |
Count the number of distinct company industries. |
-- 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.
Translate `Count the number of distinct company industries.` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT Industry) FROM Companies |
List the names of buildings in descending order of building height. |
-- 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.
Translate `List the names of buildings in descending order of building height.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM buildings ORDER BY Height DESC |
What are the names of buildings sorted in descending order of building height? |
-- 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.
Translate `What are the names of buildings sorted in descending order of building height?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM buildings ORDER BY Height DESC |
Find the stories of the building with the largest height. |
-- 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.
Translate `Find the stories of the building with the largest height.` to a syntactically-correct PostgreSQL query.
| SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1 |
What is the stories of highest building? |
-- 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.
Translate `What is the stories of highest building?` to a syntactically-correct PostgreSQL query.
| SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1 |
List the name of a building along with the name of a company whose office is in the building. |
-- 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.
Translate `List the name of a building along with the name of a company whose office is in the building.` to a syntactically-correct PostgreSQL query.
| 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 |
For each company, return the company name and the name of the building its office is located in. |
-- 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.
Translate `For each company, return the company name and the name of the building its office is located in.` to a syntactically-correct PostgreSQL query.
| 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 |
Show the names of the buildings that have more than one company offices. |
-- 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.
Translate `Show the names of the buildings that have more than one company offices.` to a syntactically-correct PostgreSQL query.
| 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 |
Which buildings have more than one company offices? Give me the building names. |
-- 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.
Translate `Which buildings have more than one company offices? Give me the building names.` to a syntactically-correct PostgreSQL query.
| 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 |
Show the name of the building that has the most company offices. |
-- 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.
Translate `Show the name of the building that has the most company offices.` to a syntactically-correct PostgreSQL query.
| 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 |
Which building has the largest number of company offices? Give me the building name. |
-- 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.
Translate `Which building has the largest number of company offices? Give me the building name.` to a syntactically-correct PostgreSQL query.
| 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 |
Please show the names of the buildings whose status is "on-hold", in ascending order of stories. |
-- 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.
Translate `Please show the names of the buildings whose status is "on-hold", in ascending order of stories.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM buildings WHERE Status = "on-hold" ORDER BY Stories ASC |
Find the names of the buildings in "on-hold" status, and sort them in ascending order of building stories. |
-- 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.
Translate `Find the names of the buildings in "on-hold" status, and sort them in ascending order of building stories.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM buildings WHERE Status = "on-hold" ORDER BY Stories ASC |
Please show each industry and the corresponding number of companies in that 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.
Translate `Please show each industry and the corresponding number of companies in that industry.` to a syntactically-correct PostgreSQL query.
| SELECT Industry , COUNT(*) FROM Companies GROUP BY Industry |
Whah are the name of each industry and the number of companies in that 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.
Translate `Whah are the name of each industry and the number of companies in that industry?` to a syntactically-correct PostgreSQL query.
| SELECT Industry , COUNT(*) FROM Companies GROUP BY Industry |
Please show the industries of companies in descending order of the number of 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.
Translate `Please show the industries of companies in descending order of the number of companies.` to a syntactically-correct PostgreSQL query.
| SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC |
Sort all the industries in descending order of the count of companies in each 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.
Translate `Sort all the industries in descending order of the count of companies in each industry` to a syntactically-correct PostgreSQL query.
| SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC |
List the industry shared by the most 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.
Translate `List the industry shared by the most companies.` to a syntactically-correct PostgreSQL query.
| SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1 |
Which industry has the most 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.
Translate `Which industry has the most companies?` to a syntactically-correct PostgreSQL query.
| SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1 |
List the names of buildings that have no company office. |
-- 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.
Translate `List the names of buildings that have no company office.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM buildings WHERE id NOT IN (SELECT building_id FROM Office_locations) |
Which buildings do not have any company office? Give me the building names. |
-- 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.
Translate `Which buildings do not have any company office? Give me the building names.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM buildings WHERE id NOT IN (SELECT building_id FROM Office_locations) |
Show the industries shared by companies whose headquarters are "USA" and companies whose headquarters are "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.
Translate `Show the industries shared by companies whose headquarters are "USA" and companies whose headquarters are "China".` to a syntactically-correct PostgreSQL query.
| SELECT Industry FROM Companies WHERE Headquarters = "USA" INTERSECT SELECT Industry FROM Companies WHERE Headquarters = "China" |
Which industries have both companies with headquarter in "USA" and companies with headquarter in "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.
Translate `Which industries have both companies with headquarter in "USA" and companies with headquarter in "China"?` to a syntactically-correct PostgreSQL query.
| SELECT Industry FROM Companies WHERE Headquarters = "USA" INTERSECT SELECT Industry FROM Companies WHERE Headquarters = "China" |
Find the number of companies whose industry is "Banking" or "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.
Translate `Find the number of companies whose industry is "Banking" or "Conglomerate",` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Companies WHERE Industry = "Banking" OR Industry = "Conglomerate" |
How many companies are in either "Banking" industry or "Conglomerate" 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.
Translate `How many companies are in either "Banking" industry or "Conglomerate" industry?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Companies WHERE Industry = "Banking" OR Industry = "Conglomerate" |
Show the headquarters shared by more than two 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.
Translate `Show the headquarters shared by more than two companies.` to a syntactically-correct PostgreSQL query.
| SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*) > 2 |
Which headquarter locations are used by more than 2 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.
Translate `Which headquarter locations are used by more than 2 companies?` to a syntactically-correct PostgreSQL query.
| SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*) > 2 |
How many products are there? |
-- 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.
Translate `How many products are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Products |
List the name of products in ascending order of price. |
-- 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.
Translate `List the name of products in ascending order of price.` to a syntactically-correct PostgreSQL query.
| SELECT Product_Name FROM Products ORDER BY Product_Price ASC |
What are the names and type codes of 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.
Translate `What are the names and type codes of products?` to a syntactically-correct PostgreSQL query.
| SELECT Product_Name , Product_Type_Code FROM Products |
Show the prices of the products named "Dining" or "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.
Translate `Show the prices of the products named "Dining" or "Trading Policy".` to a syntactically-correct PostgreSQL query.
| SELECT Product_Price FROM Products WHERE Product_Name = "Dining" OR Product_Name = "Trading Policy" |
What is the average price for 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.
Translate `What is the average price for products?` to a syntactically-correct PostgreSQL query.
| SELECT avg(Product_Price) FROM Products |
What is the name of the product with the highest price? |
-- 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.
Translate `What is the name of the product with the highest price?` to a syntactically-correct PostgreSQL query.
| SELECT Product_Name FROM Products ORDER BY Product_Price DESC LIMIT 1 |
Show different type codes of products and the number of products with each 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.
Translate `Show different type codes of products and the number of products with each type code.` to a syntactically-correct PostgreSQL query.
| SELECT Product_Type_Code , COUNT(*) FROM Products GROUP BY Product_Type_Code |
Show the most common type code across 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.
Translate `Show the most common type code across products.` to a syntactically-correct PostgreSQL query.
| SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code ORDER BY COUNT(*) DESC LIMIT 1 |
Show the product type codes that have at least two 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.
Translate `Show the product type codes that have at least two products.` to a syntactically-correct PostgreSQL query.
| SELECT Product_Type_Code FROM Products GROUP BY Product_Type_Code HAVING COUNT(*) >= 2 |
Show the product type codes that have both products with price higher than 4500 and products with price lower than 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.
Translate `Show the product type codes that have both products with price higher than 4500 and products with price lower than 3000.` to a syntactically-correct PostgreSQL query.
| SELECT Product_Type_Code FROM Products WHERE Product_Price > 4500 INTERSECT SELECT Product_Type_Code FROM Products WHERE Product_Price < 3000 |
Show the names of products and the number of events they are in. |
-- 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.
Translate `Show the names of products and the number of events they are in.` to a syntactically-correct PostgreSQL query.
| 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 |
Show the names of products and the number of events they are in, sorted by the number of events in descending order. |
-- 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.
Translate `Show the names of products and the number of events they are in, sorted by the number of events in descending order.` to a syntactically-correct PostgreSQL query.
| 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 |
Show the names of products that are in at least two events. |
-- 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.
Translate `Show the names of products that are in at least two events.` to a syntactically-correct PostgreSQL query.
| 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 |
Show the names of products that are in at least two events in ascending alphabetical order of 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.
Translate `Show the names of products that are in at least two events in ascending alphabetical order of product name.` to a syntactically-correct PostgreSQL query.
| 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 |
List the names of products that are not in any event. |
-- 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.
Translate `List the names of products that are not in any event.` to a syntactically-correct PostgreSQL query.
| SELECT Product_Name FROM Products WHERE Product_ID NOT IN (SELECT Product_ID FROM Products_in_Events) |
How many artworks are there? |
-- 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.
Translate `How many artworks are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM artwork |
List the name of artworks in ascending alphabetical order. |
-- 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.
Translate `List the name of artworks in ascending alphabetical order.` to a syntactically-correct PostgreSQL query.
| SELECT Name FROM artwork ORDER BY Name ASC |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.