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:
- TableName
- NumberOfLines
- maxID
Thank you!