Find tables with specific column name in Snowflake

Query below finds all tables that have 'N_NAME' column.

See also tables that don't have a column with specific name.

Query

select t.table_schema, 
       t.table_name
from information_schema.tables t
inner join information_schema.columns c on 
       c.table_schema = t.table_schema and c.table_name = t.table_name
where t.table_type = 'BASE TABLE'
       and column_name ='N_NAME'
order by t.table_schema, 
       t.table_name;

Columns

  • table_schema - name of schema of found table
  • table_name - name of found table

Rows

  • One row represents a table
  • Scope of rows: all found tables
  • Ordered by schema name, table name

Sample results

List of tables that have 'N_NAME' column.

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
0
There are no comments. Click here to write the first comment.