You are on page 1of 4

Muqaddas.

FA17-BSE-103.

Data Types Of SQL


Character data types:-

Name of data type Size of data type Description


The size restriction for this data This data type stores the string
CHAR type is 1-2000 bytes. value, and the size of the string is
fixed at the time of declaring the
variable.

VARCHAR & VARCHAR2 The size restriction for this data This data type is used to store
type is 1-4000 bytes for table string but length of the string is
column size and 1-32767 bytes not fixed. It is always a good
for variables. practice to use VARCHAR2
instead of VARCHAR to avoid
behavioral changes.

NCHAR The size restriction for this data This data type is same as CHAR
type is 1-2000 bytes. data type but the character set
will of the national character set.

NVARCHAR2 The size restriction for this data This data type is same as
type is 1-2000 bytes. VARCHAR2 but the character
set will of the national character
set.
CLOB Maximum size for this data type CLOB data type stores the data
is 128 TB (terabyte). into the character set.

NCLOB Maximum size for this data type NCLOB stores the data into
is also 128 TB (terabyte). native character set.

LONG Maximum size for this data type Used to store large character set
is also 2 GB (gigabyte). data.

Numeric data types:-


Name of data type Size of data type Description
INTEGER INTEGER provides 4 bytes of Represents an integer and can
storage for integer values. store whole numbers in a specific
range.

SMALLINT The size restriction for this data Same as INTEGER type except
type is 2 bytes. that it might hold a smaller range
of values

BIGINT The BIGINT data type provides 8 This data type is use
bytes of storage for integer when integer values might
values. exceed the range.

REAL It can store numbers up to 4 bytes Represents numeric values.


and 7 digits of precision.

DECIMAL Maximum size is 10^38-1 and Used to store number that have
minimum size is -10 ^38+1. Hold fixed precision and scale.
5-17 bytes.

FLOAT FLOAT data can hold 8 bytes or Used to specify precision i-e
15 places after the decimal point. number of digits after the
decimal point.

DOUBLE Provides 8 bytes storage as Double data is similar to the


FLOAT data type. float, except that it allows for
much larger numbers.

TINYINT The TINYINT data type provides They are tiny in nature and used
1 byte of storage. to store integer values.

Date data types:-


Name of data type Size of data type Description
DATE Storage value of this data type is  The DATE data type
3 bytes. provides for storage of a
year-month-day in the
range supported
by java.sql.Date.
 Displayed as 'YYYY-MM-
DD'

TIME Storage value of this data type  The TIME data type
is 5 bytes. provides for storage of a
time-of-day value.
 Displayed as 'YYYY-MM-
DD hh:mm:ss[.nnnnnnn]'

TIMESTAMP Storage value of this data type  The TIMESTAMP data


is 8 bytes. type stores a combined
DATE and TIME value,
and allows a fractional-
seconds value of up to 9
digits.
 Displayed as 'YYYY-MM-
DD hh:mm:ss

Binary data types:-

Name of data type Size of data type Description


BLOB This data type stores the LOB This data type stores the
data in the binary file format up unstructured data such as
to the maximum size of 128 TB. multimedia objects, images, etc.

BFILE The size of BFILE is to a limited BFILE are the data types that
operating system, and they are stored the unstructured binary
read-only files and can't be format data outside the database
modified. as an operating-system file.
LONG RAW

Stores raw data up to maximum LONG RAW is used to store data


size of 2 GB (gigabytes). in binary format and accepts
media objects, images etc.

You might also like