Find Which Tables Have a Particular Column Name: Quick Tip

Your Vertica database probably contains hundreds, if not thousands, of tables. Trying to remember which tables contain a certain column can be a daunting task….

OpenText  profile picture
OpenText

October 09, 20181 minute read

Shot of a young computer programmer working on source code

Your Vertica database probably contains hundreds, if not thousands, of tables. Trying to remember which tables contain a certain column can be a daunting task. Instead, query the V_CATALOG.COLUMNS system table!

Example:

Which tables have a column named “DateKey”?

dbadmin=> SELECT table_schema, table_name, column_name
dbadmin-> FROM v_catalog.columns
dbadmin-> WHERE column_name = 'DateKey'
dbadmin-> ORDER BY 1, 2, 3;
table_schema | table_name | column_name
--------------+-------------------------+-------------
warehouse | BridgeCustomerAccount | DateKey
warehouse | BridgeHouseholdCustomer | DateKey
warehouse | DimDate | DateKey
warehouse | FactAccount | DateKey
warehouse | FactAccountScore | DateKey
warehouse | FactCustomer | DateKey
warehouse | FactCustomerScore | DateKey
warehouse | FactHousehold | DateKey
warehouse | FactHouseholdScore | DateKey
(9 rows)

Which tables have a column with a name that contains the text “ssn”?

dbadmin=> SELECT table_schema, table_name, column_name
dbadmin-> FROM v_catalog.columns
dbadmin-> WHERE column_name ILIKE '%ssn%';
table_schema | table_name | column_name
--------------+---------------+-------------
public | employee_fact | ssn
dw | emp_dim | SSN
(2 rows)

Have fun!

Share this post

Share this post to x. Share to linkedin. Mail to
OpenText avatar image

OpenText

OpenText, The Information Company, enables organizations to gain insight through market-leading information management solutions, powered by OpenText Cloud Editions.

See all posts

More from the author

All we want for Christmas:  An open letter to Santa from a modern legal team  

All we want for Christmas:  An open letter to Santa from a modern legal team  

As legal professionals embracing digital transformation, our wish list is a bit different this year.

December 11, 2024 4 minute read

Supercharge Your Data Strategy with the Latest Insights on Data and AI

Supercharge Your Data Strategy with the Latest Insights on Data and AI

Introducing the 2024 CXO Insights Guide on Data & AI Guide

October 31, 2024 6 minute read

From breakdown to breakthrough: How predictive and prescriptive maintenance are revolutionizing operations

From breakdown to breakthrough: How predictive and prescriptive maintenance are revolutionizing operations

Cut downtime, save costs, improve safety and stay ahead of failures with advanced analytics and AI-powered maintenance strategies.

October 16, 2024 7 minute read

Stay in the loop!

Get our most popular content delivered monthly to your inbox.