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?

More than 3 years have passed since last update.

Integer Data-type between Java and MySQL

Last updated at Posted at 2020-06-09

MySQLへJAVAからアクセスする場合のIntergerデータ型対応の表。
MySQLのIntegerデータ型を格納できるJAVAのデータ型を掲載する。

MySQL Type Bytes Min Max Java Type Min Max
TINYINT 1 -128 (-2^7) 127 (2^7-1) Byte -128 (-2^7) 127 (2^7-1)
SMALLINT 2 -32,768 (-2^15) 32,767 (2^15-1) Short -32,768 (-2^15) 32,767 (2^15-1)
MEDIUMINT 3 -8,388,608 (-2^23) 8,388,607 (2^23-1) Integer -2,147,483,648 (-2^31) 2,147,483,647 (2^31-1)
INT 4 -2,147,483,648 (-2^31) 2,147,483,647 (2^31-1) Integer
BIGINT 8 -9,223,372,036,854,775,808 (-2^63) 9,223,372,036,854,775,807 (2^63-1) Long -9,223,372,036,854,775,808 (-2^63) 9,223,372,036,854,775,807 (2^63-1)
UNSINGED
TINYINT
1 0 255 (2^8-1) Short -32,768 (-2^15) 32,767 (2^15-1)
UNSINGED
SMALLINT
2 0 65,535 (2^16-1) Integer -2,147,483,648 (-2^31) 2,147,483,647 (2^31-1)
UNSINGED
MEDIUMINT
3 0 16,777,215 (2^24-1) Integer
UNSINGED
INT
4 0 4,294,967,295 (2^32-1) Long -9,223,372,036,854,775,808 (-2^63) 9,223,372,036,854,775,807 (2^63-1)
UNSINGED
BIGINT
8 0 18,446,744,073,709,551,615 (2^64-1) BigInteger
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?