0

There are lots of similar posts like this to query the number of lines for all tables in a PostggreSQL database, but these provides the estimated values; I need the exact one which I can find with

SELECT count(*) FROM "TableName";

How to combine this into a query to list all tables

SELECT tables.table_name AS "TabName"
   FROM information_schema.tables
  ORDER BY tables.table_name;

Additional: Each table has an ID-number as first column but for each table these column-names are different. Is there a way to find the name for the first column for all tables and to find the maximum value; ideally combined into the above query which should provide then three columns:

  1. TableName
  2. NumberOfLines
  3. maxID

Thank you!

StOMicha
  • 315
  • 1
  • 3
  • 12

0 Answers0