List columns by name length in Vertica database

This query returns columns in a database sorted by their name length.

Query

select column_name,
       length(column_name) col_length,
       table_schema,
       table_name
from v_catalog.columns
where table_schema in ('public2','online_sales', 'store')
order by col_length desc,
         column_name;

Columns

  • column_name - column name
  • col_length - column name length
  • table_schema - table schema name
  • table_name - table name

Rows

  • One row represents one column of each table in a database
  • Scope of rows: each column that exists in a database
  • Ordered by length descrending (from longest to shortest) and column name

Sample results

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.