- 在 mysql 中可以用
SHOW TABLES來查看目前database中有那些 tables, 而在 PostgreSQL 中, 有兩種方法:- 如果是用 psql 連到 database 中的話可以使用
\dt這個指令來看. - 或是直接使用 SQL 語法來查詢:
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'; - Reference:
- 如果是用 psql 連到 database 中的話可以使用
*** The user comment on the postgresql document page *** Display or show tables in a PostgreSQL/PgSQL database on tech-recipes
* GROUP BY
**SELECTcolumn_nameFROMtable_nameGROUP BYcolumn_name;**SELECT table_catalog FROM information_schema.tables WHERE table_schema = 'public' GROUP BY table_catalog;/* Will display all table_catalogs but the sames will appear once only */
* LIKE
**SELECT * FROMtable_nameWHEREstringLIKEpattern;**SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_name LIKE 'm%';/* Will display all tables whose table_name starts with m*/
