Bigquery query to find the column names of a table
Update: This is now possible! See the INFORMATION SCHEMA
docs and the answers below.
Answer, circa 2012:
It's not currently possible to retrieve table metadata (i.e. column names and types) via a query, though this isn't the first time it's been requested.
Is there a reason you need to do this as a query? Table metadata is available via the tables API.
How to find all the column names of a table where the column names match a certain string? (BigQuery)
You need to run a query like
SELECT
column_name
FROM
`bigquery-public-data`.census_bureau_usa.INFORMATION_SCHEMA.COLUMNS
WHERE
column_name like '%age%' and table_name='population_by_zip_2000'
This returns:
Can we get Column Name from specific Table in Google BigQuery?
I got result using Java:
Tables tableRequest = bigquery.tables();
Table table = tableRequest.get(projectName,datasetName,tableName).execute();
List<TableFieldSchema> fields = table.getSchema().getFields();
Related Topics
Writing a Recursive SQL Query on a Self-Referencing Table
Replacing Text in a Blob Column
Sql Server String to Varbinary Conversion
Sql Select Rows Containing Part of String
Issue of Multiple SQL Notifications in ASP.NET Web Application on Page Refresh
Cascading Deletes in Postgresql
Insufficient Privileges When Creating Tables in Oracle SQL Developer
Is There a Tool to Generate a Full Database Ddl for SQL Server? What About Postgres and MySQL
Why Aren't Nulls Counted in Count(Columnname)
Sql Two Tables and Creating a Link Table
Creating Trigger That Runs on Two Tables
What Is This Operand (*= Star-Equals) in SQL Server 2000
Query to Calculate Average Time Between Successive Events
Oracle SQL Query for Records with Timestamp That Falls Between Two Timestamps