What is the equivalent of Java long
in the context of MySQL data types?
Asked
Active
Viewed 7.5k times
66

informatik01
- 16,038
- 10
- 74
- 104

syker
- 10,912
- 16
- 56
- 68
2 Answers
84
SIGNED BIGINT
is a 8-bytes long integer just like Java's long
.

Crozin
- 43,890
- 13
- 88
- 135
-
23Note that in MySQL all `INT` types are signed by default. – NullUserException Sep 23 '10 at 18:05
22
Java long max value is positive: 9,223,372,036,854,775,807
This means for positive only unsigned numbers UNSIGNED BIGINT(19)
should be enough or you can just use UNSIGNED BIGINT
which is equal to UNSIGNED BIGINT(20)
If you are going to use negative numbers as well BIGINT(19)
will be enough.

Fırat Küçük
- 5,613
- 2
- 50
- 53