LoginSignup
1
0

PostgreSQLのコマンド一覧

Last updated at Posted at 2024-03-31

接続前

内容 コマンド
サーバステータス表示 pg_isready
サーバ起動 pg_ctl start -D /usr/local/var/postgres
サーバ停止 pg_ctl stop -D /usr/local/var/postgres
データベース一覧表示 psql -l
データベース接続 psql -d (DB_NAME) -U (USER_NAME) -h (HOST_NAME)

データベース

内容 コマンド
抜ける \q
データベース一覧表示 \l
他のデータベースに接続 \c (DB_NAME)
テーブル一覧表示(sequence含む) \d
テーブル一覧表示(sequence含まない) \dt
スキーマ一覧表示 \dn
スキーマ詳細表示 \d (TABLE_NAME)
アクセス権限表示 \z
ユーザ一覧表示 \du
スキーマからテーブル情報取得 \dt (テーブル名).*

テーブル操作

内容 コマンド
データ一覧 select * from (TABLE_NAME);

参考

1
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
1
0