On showing tables
25
Feb 2015
Showing the existing tables in a database can be really handy. Unfortunately, MySQL’s SHOW TABLES; is not a standard sql command. Although it quite honestly should be. Thus, for quick reference, here goes:
- MySQL:
SHOW TABLES; - Postgres:
SELECT name FROM pg_catalog.pg_tables; - SQLite:
SELECT name FROM sqlite_master WHERE type = 'table';
There probably is a SELECT-Syntax for MySQL too, but who really cares? The one above is so much shorter in any case.