DBAtlas · Atlas de operaciones de bases de datos

Listar tablas / colecciones

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 devuelve las tablas del esquema actual; all_tables, las accesibles.

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 *.*

Solo para el esquema public: WHERE table_schema = 'public'.

MySQL

SHOW TABLES;
-- Another schema: SHOW TABLES FROM mydb;

Para más detalle: 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;

Atajo: SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE';

MongoDB

show collections
// or: db.getCollectionNames()

Para ver también las colecciones del sistema: db.getCollectionInfos().

Redis

SCAN 0 MATCH * COUNT 100
# Continue with SCAN <cursor> ... using the returned cursor

Redis no tiene 'tablas'; se listan claves. NUNCA use KEYS * en producción (bloquea); SCAN se basa en cursor.

Abrir en DBAtlas →