概要
毎回postgresqlのコマンドを忘れて調べたりしているので、備忘録としてメモを残す
コマンド一覧
特定のスキーマのテーブル情報を表示
SELECT column_name, data_type, is_nullable, character_maximum_length, numeric_precision, numeric_scale, colum_default
FROM information_schema.columns
WHERE table_schema = 'スキーマ名'
AND table_name = 'テーブル名'スキーマを選択
SET search_path TO スキーマ名;データのインサート
insert into テーブル名 (カラム1,カラム2,...) values (値1,値2,...);データのアップデート
update テーブル名 set カラム名=値 where 条件;データの削除
delete from テーブル名 where 条件;UUIDの作成
# gen_random_uuid()関数を使用する
insert into テーブル名 (カラム1) values (gen_random_uuid());


コメント