Listar tabelas / coleções
Oracle
SELECT table_name FROM user_tables ORDER BY table_name;
-- All schemas: SELECT owner, table_name FROM dba_tables ORDER BY owner, table_name;user_tables retorna as tabelas do schema atual; all_tables, as que estão acessíveis.
PostgreSQL
SELECT table_schema, table_name
FROM information_schema.tables
WHERE table_type = 'BASE TABLE' AND table_schema NOT IN ('pg_catalog','information_schema')
ORDER BY 1, 2;
-- psql shortcut: \dt *.*Apenas para o schema public: WHERE table_schema = 'public'.
MySQL
SHOW TABLES;
-- Another schema: SHOW TABLES FROM mydb;Para detalhes: SELECT table_name, table_rows FROM information_schema.tables WHERE table_schema = DATABASE();
SQL Server
SELECT s.name AS schema_name, t.name AS table_name
FROM sys.tables t
JOIN sys.schemas s ON t.schema_id = s.schema_id
ORDER BY s.name, t.name;Atalho: SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE';
MongoDB
show collections
// or: db.getCollectionNames()Para ver também as coleções do sistema: db.getCollectionInfos().
Redis
SCAN 0 MATCH * COUNT 100
# Continue with SCAN <cursor> ... using the returned cursorO Redis não tem 'tabelas'; as chaves é que são listadas. NUNCA use KEYS * em produção (bloqueia); SCAN é baseado em cursor.