Query that returns tables with number of columns, ordered from the ones that have the most.
select table_schema, table_name, count(*) as columns from v_catalog.columns group by table_schema, table_name order by columns desc;
- table_schema - name of the schema
- table_name - name of the table
- columns - number of columns in table
- One row represents one table in a database
- Scope of rows: all tables in a database
- Ordered by number of columns descending - from tables with the most columns