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?

PostgreSQLで文字列置換の更新

Posted at

カラムに改行コード入れたくないのに入っちゃってたってことありますよね?下記で修正できます。

UPDATE `books` SET `title` = replace(title, '\n', '') where id = 1;

where 句なしでも、対応する行を検索してくれるので、1万行あっても3行だけ更新をしてくれます。でも、安全面を考慮して、where句はなるべくつけましょ

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?