LoginSignup
0
0

More than 1 year has passed since last update.

MySQLで小数点を挿入できるフィールドdecimal

Posted at

金額を管理するデータベースでintを使って値を扱っていましたが、
小数点の単価を入れたいと言われたので、利用したdecimal型についてメモ。

decimalは、桁数を(M,D)の形で指定。内訳は以下の通り。

M…扱う少数の最大桁数
D…小数点以下の桁数

decimal(6.3)だと全桁数が6桁、小数点3桁の範囲の桁数であれば挿入可能。

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