2
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?

More than 3 years have passed since last update.

MySQLのint型をint(11)にする必要ある?単純にintでいいのではないかと。

Posted at

【MySQLのint型をint(11)にする必要ある?単純にintでいいのではないかと。】

MySQLのint(11) : MySQLの方言

  • ()内で指定した桁数に満たない場合は、左側を空白で埋める。
  • int(11)は表示幅を11に指定している
  • 表示に関する指定をしているだけ。
  • ※ 有効桁数の指定をしている訳ではない
  • 格納するデータに関する指定では決してない。

**int(11)でもint(1)でもint型に入れられる値の範囲は同じ  **
 → それなら、intにZEROFILLを指定する意味ってある??
 → パフォーマンスにも特に影響がないので何か理由がない限りは不要で良いと思いました

(この解釈が誤っている場合はご指摘くださいm(_ _)m)

int型に入れられる値の範囲

  • signed: -2,147,483,648 ~ 2,147,483,647
  • unsigned: 0 ~ 4,294,967,295
2
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
2
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?