Column Names

We wish to get the names of the columns of a table.

SELECT column_name
FROM refcon.dataset.INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'table_1';

Here is how this works:

  • INFORMATION_SCHEMA provides metadata for each table in the dataset.
  • COLUMNS view returns the info for each column in the table.
  • It also includes additional info such as:
    • ordinal_position: The 1-indexed offset of the column within the table; if it's a pseudo column such as _PARTITIONTIME or _PARTITIONDATE, the value isNULL.
    • is_nullable : YES or NO depending on whether the column's mode allowsNULL values.
SQL
I/O