Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

これは、PostgreSQL Advent Calendar 2019の13日目の記事です。 今回は、PostgreSQLが提供するround関数について取り上げます。round()は、PostgreSQL日本語ドキュメントでは「最も近い整数への丸め」と説明されていて、数値の四捨五入に使われている方も多いのではないでしょうか。実際に、PostgreSQLバージョン12で、1.0から3.0までのNUMERIC型の値を0.1刻みでround()に渡すと、下記のとおり四捨五入していることを確認できます。 =# SELECT num, round(num::NUMERIC) FROM generate_series(1.0, 3.0, 0.1) num; num | round -----+------- 1.0 | 1 1.1 | 1 1.2 | 1 1.3 | 1 1.4 | 1 1.5 |
Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article? これはなに? 今までMySQLしか使った事なかったのですが、PostgreSQLを使うことになった為、MySQLとの違いを纏めた記事です。 [PostgreSQLとMySQL、使うならどっち? データベース専門家が8つの視点で徹底比較!](https://employment.en- japan.com/engineerhub/entry/2017/09/05/110000#%E6%AF%94%E8%BC%83%E3%83%9D%E3%82%A4%E3%83%B3%E3%83%88%E3%82%B9%E3%83%88%E3%82%A2%
よく使うPostgreSQLで利用可能なコマンドのチートシートです。 環境:psql (PostgreSQL) 9.5.0 端末上で使うコマンド サーバの起動 $ pg_ctl start -D /usr/local/var/postgres サーバの終了 $ pg_ctl stop -D /usr/local/var/postgres サーバが起動しているかの確認 $ ps aux | grep postgres データベース接続 $ psql -d database -U user -h host -d: データベース名(未指定だと、ログインユーザー名のデータベースに接続する) -U: ユーザ名(未指定だと、ログインユーザー名になる) -h: ホスト名(未指定だと、localhostになる) データベース一覧表示 $ psql -l PostgreSqlバージョン表示 $ psql -
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く