LoginSignup
0
0

参考ページ

37.54. tables

テーブルの数を数える

SELECT count(*) FROM information_schema.tables WHERE table_schema NOT IN ('pg_catalog', 'information_schema');

実行例

db_common=# SELECT count(*) FROM information_schema.tables WHERE table_schema NOT IN ('pg_catalog', 'information_schema');
 count 
-------
  1583
(1 row)

テーブル名が g で始まるものの数を数える

SELECT count(*) FROM information_schema.tables WHERE table_schema NOT IN ('pg_catalog', 'information_schema') and table_name like 'g%';

実行例

db_common=# SELECT count(*) FROM information_schema.tables WHERE table_schema NOT IN ('pg_catalog', 'information_schema') and table_name like 'g%';
 count 
-------
  1241
(1 row)

テーブルの一覧

all01.sql

SELECT table_name FROM information_schema.tables WHERE table_schema NOT IN ('pg_catalog', 'information_schema') order by table_name;

実行例

psql -Uscott db_common < all01.sql > all01.txt

テーブル名が g で始まるものの一覧

g01.sql
SELECT table_name FROM information_schema.tables WHERE table_schema NOT IN ('pg_catalog', 'information_schema') and table_name like 'g%' order by table_name;

実行例

psql -Uscott db_common < g01.sql > g01.txt
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0