LoginSignup
8
5

More than 5 years have passed since last update.

【PostgreSQL】UPDATEで時間/日付を加算するSQL

Posted at

個人的なメモ

1秒加算

$ UPDATE table_name SET "column_name" = ("column_name" + INTERVAL '1 SECOND') where 条件;

1日加算

$ UPDATE table_name SET "column_name" = ("column_name" + INTERVAL '1 DAY') where 条件;

分だとMINUTE、時間だとHOUR、一週間だとWEEK
減算だと ("column_name" - INTERVAL '1 SECOND') にするだけ

8
5
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
8
5