How can we count the number of rows in each table in db2?

You can use the following SQL statement to count the number of rows in each table:

SELECT TABSCHEMA, TABNAME, CARD
FROM SYSCAT.TABLES
WHERE TYPE = 'T'
ORDER BY TABSCHEMA, TABNAME;

This query will return a result set containing the schema (TABSCHEMA), table name (TABNAME), and row count (CARD) for each table. You can adjust the query conditions and sorting as needed.

bannerAds