KRIS ROSALES
BSIT-3B
Java
DATA TYPES MAXIMUM VALUE MINIMUM VALUE MEMORY EXAMPLE
ALLOCATIO
N
127 (inclusive)(2^7 -1) -128 (-2^7) Byte data byte a = 100 , byte
1. byte type is used b = -50
data type is to save space
a 8-bit in large
signed two.s arrays,
complement mainly in
integer place of
integers,
since a byte
is four times
smaller than
an int.
32,767(inclusive) (2^15 -32,768 (-2^15) Short data short
2. short -1) type can also
data type is be used to s= 10000 , short r
a 16-bit save memory = -20000
signed two's as byte data
complement type. A short
integer is 2 times
smaller than
an int
2,147,483,647(inclusive). -2,147,483,648. (-2^31) Integer is int a = 100000, int
3. Integer (2^31 -1) generally b = -200000
data type is used as the
a 32-bit default data
signed two's type for
complement integral
integer. values unless
there is a
concern about
memory.
9,223,372,036,854,775,8 -9,223,372,036,854,775, This type is int a = 100000L, int
4. long 07 (inclusive). (2^63 -1) 808 . (-2^63) used when a b = -200000L
data type is wider range
a 64-bit than int is
signed two's needed.
complement
integer
CHAR(size) or CHARACTER(size) - A string of fixed
SQL length. The maximum size of a CHAR string is 1 billion
characters.
BOOLEAN - A boolean value either true, false or null. VARCHAR(size), LONGVARCHAR(size), CHARACTER
VARYING(size), LONG CHARACTER
VARYING(size), TEXT(size) or STRING(size) - A
string of variable length. The size constraint of these string by java.math.BigDecimal and therefore can represent
types do not have to be given and defaults to the maximum numeric values of any precision and scale.
possible size of strings that the database is able to store. The
maximum size of these string types is 1 billion characters.
DATE - A day/month/year value. The DATE type does not
have any near time bounding issues and is able to represent
CLOB - A string of variable length without a size constraint. dates many millennia in the future and the past.
The maximum size of a CLOB object is 1 billion characters. The TIMESTAMP type is internally represented
by java.util.Date.
TINYINT - An 8-bit signed integer value. The range
of TINYINT is -128 to 127. TIME - A time of day value.
SMALLINT - A 16-bit signed integer value. The range TIMESTAMP - A day/month/year and time of day value.
of SMALLINT is -32768 to 32767. The TIMESTAMP type does not have any near time bounding
issues and is able to represent dates many millennia in the
future and the past. The TIMESTAMP type is internally
INTEGER or INT - A 32-bit signed integer value. The range
represented by java.util.Date.
of INTEGER is -2147483648 to 2147483647.
BINARY(size), VARBINARY(size) or LONGVARBINA
BIGINT - A 64-bit signed integer value. The range
RY(size) - A variable sized binary object. The size
of BIGINT is -9223372036854775808 to
constraint is optional and defaults to the maximum size. The
9223372036854775807.
maximum size of a binary object is 2 billion bytes.
FLOAT or DOUBLE - A 64-bit precision floating point value.
BLOB - A variable sized binary object with no size
These types are analogous to the Java double type.
constraint. The maximum size of a binary object is 2 billion
bytes.
REAL, NUMERIC or DECIMAL - A higher precision numeric
value. These numeric types are represented ALGOL
TypeName Support Storage Data Description
Types for SQL
(Data Warehouse
only)
BINARY Profiling System varbinary Binary
BOOL Both bit Boolean (0 or 1)
CURRENCY Both money 64-bit currency
DATE Both datetime Standard date
DATETIME Both datetime SQL Date-time