LoginSignup
0
0

More than 1 year has passed since last update.

PostgreSQLでvaluesからselectした結果をinsertする

Last updated at Posted at 2022-06-06

忘れるのでメモです。
CSVから一時テーブルへの取込みするときなど、複数行のデータを加工しながら一度に取り込みたいときによく使います。

insert into "宛先テーブル"
(
    name,
    age
)
select
    t.name,
    t.age
from (
    values
    ('bob', 22),
    ('jane', 19),
    ('mike', 30)
) as t (name, age)
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