DBAtlas · Atlas für Datenbankbetrieb

Tabellen / Collections auflisten

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 liefert die Tabellen im aktuellen Schema, all_tables die zugänglichen.

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

Nur für das Schema public: WHERE table_schema = 'public'.

MySQL

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

Für Details: 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;

Abkürzung: SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE';

MongoDB

show collections
// or: db.getCollectionNames()

Um auch System-Collections zu sehen: db.getCollectionInfos().

Redis

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

Redis hat keine „Tabellen“; es werden Keys aufgelistet. KEYS * NIEMALS in Produktion verwenden (blockiert); SCAN arbeitet cursorbasiert.

In DBAtlas öffnen →