Using Teradata SQL: How to find all the tables in a database or user area

Using Teradata SQL: How to find all the tables in a database or user area

This SQL lets you find all the tables in a particular database or your user area (your personal database) in Teradata, or table names that match a pattern.

Jamie Whitehorn
Jamie Whitehorn

Sometimes it can be useful to find all the tables in a particular database or your user area (your personal database) in Teradata. This SQL will do that for you -

SELECT * FROM  dbc.tables WHERE databasename = (SELECT USER) AND TABLEKIND = 'T';

To find tables that match a naming pattern or convention you can use -

 SELECT * FROM  dbc.tables WHERE databasename LIKE 'Customer%' AND TABLEKIND = 'T';

"Real difficulties can be overcome, it is only the imaginary ones that are unconquerable." - Theodore N. Vail