Data types in sql

Most Database, such as Oracle, MySQL, MS SQL have various datatypes. These data types can be divided into diffrent categories as given below:

  • Numerical Data type
  • Character/String Data type
  • Date Data type
  • Binary Data type

These are described below:

Numerical Data type:

Used to store zero,negative and positive numerical values.these values can be be fixed-point or floating-point.
No Datatype Description
1 Number(P,S) Floating-point number
P refers to precision
S refers to scale
2 Number(P) Fixed-point number with a scale zero and precision p
3 Number Floating-point number with precision of 38

Character/String Data type:

No Datatype Description
1 CHAR(SIZE) Fixed length character data of length size bytes. This should be used for fixed length data. Such as codes A100, B102...,
255 bytes Default and minimum size is 1 byte.
Variable length character string having maximum length size bytes. You must specify size
max length is 2000 characters
3 LONG Stores large amount of character strings of variable length
max length is up to 2 GB

Date Data type:

Used to store date and time.
The information stored about date and time is century,year,month,day,hour,minute and second.
The current date and time can be retrieved using function SYSDATE.
The standard format is DD-MON-YY to store date.

Binary Data type:

No Datatype Description
1 RAW Stroes binary type data.
maximum length is up to 255  bytes.
2 LONG RAW Stroes large amount of binary type data.
Max length is up to 2 gb.

Subscribe us on Youtube

Share This Page on


sasmita patra | 14-Jul-2017 08:29:24 am

In Number data type if it should be (5,2), Then how to write it in a box

Ask Question