Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java long to MySql

Tags:

java

mysql

What is the equivalent of a Java long in the context of MySql variables?

like image 803
syker Avatar asked Sep 23 '10 18:09

syker


People also ask

How do I set long in MySQL?

CHAR(M) − A fixed-length string between 1 and 255 characters in length (for example CHAR(5)), right-padded with spaces to the specified length when stored. Defining a length is not required, but the default is 1. VARCHAR(M) − A variable-length string between 1 and 255 characters in length. For example, VARCHAR(25).

When should I use BIGINT in MySQL?

The number is used to display width. BIGINT takes 8 bytes i.e. 64 bits. The signed range is -9223372036854775808 to 9223372036854775807 and unsigned range takes positive value. The range of unsigned is 0 to 18446744073709551615.

Is Long equivalent to BIGINT?

The equivalent of Java long in the context of MySQL variables is BigInt. In Java, the long datatype takes 8 bytes while BigInt also takes the same number of bytes.


1 Answers

SIGNED BIGINT is a 8-bytes long integer just like Java's long.

like image 65
Crozin Avatar answered Oct 22 '22 11:10

Crozin