0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

psqlの使い方(ライトユーザー向け)

Last updated at Posted at 2020-12-19

🚀起動

$ psql -h {接続先アドレス} -p {接続先ポート} -U {接続ユーザー}

例:ローカル接続

$ psql -h localhost -p 5432 -U postgres

-hは省略可。
-pも、デフォルト(5432)であれば省略可。

psqlの終了

# \q

👀データベース一覧の確認

# \l

🛠️データベース作成

# create database {データベース名};

例:sampleという名前のデータベースを作成

# create database sample;

カレントデータベースの変更

# \c {データベース名}

例:sampleデータベースへ変更

# \c sample

👀テーブル一覧の確認

# \z

👀テーブル定義の確認

# \d {テーブル名}

以上。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?