Header Ads Widget

SQL Datatype

SQL Datatype

  • SQL Datatype is used to define the values that a column can contain.
  • Every column is required to have a name and data type in the database table.

Datatype of SQL:


DBMS SQL Datatype

1. Binary Datatypes

There are Three types of binary Datatypes which are given below:

Data TypeDescription
binaryIt has a maximum length of 8000 bytes. It contains fixed-length binary data.
varbinaryIt has a maximum length of 8000 bytes. It contains variable-length binary data.
imageIt has a maximum length of 2,147,483,647 bytes. It contains variable-length binary data.

2. Approximate Numeric Datatype :

The subtypes are given below:

Data typeFromToDescription
float-1.79E + 3081.79E + 308It is used to specify a floating-point value e.g. 6.2, 2.9 etc.
real-3.40e + 383.40E + 38It specifies a single precision floating point number

3. Exact Numeric Datatype

The subtypes are given below:

Data typeDescription
intIt is used to specify an integer value.
smallintIt is used to specify small integer value.
bitIt has the number of bits to store.
decimalIt specifies a numeric value that can have a decimal number.
numericIt is used to specify a numeric value.

4. Character String Datatype

The subtypes are given below:

Data typeDescription
charIt has a maximum length of 8000 characters. It contains Fixed-length non-unicode characters.
varcharIt has a maximum length of 8000 characters. It contains variable-length non-unicode characters.
textIt has a maximum length of 2,147,483,647 characters. It contains variable-length non-unicode characters.

5. Date and time Datatypes

The subtypes are given below:

DatatypeDescription
dateIt is used to store the year, month, and days value.
timeIt is used to store the hour, minute, and second values.
timestampIt stores the year, month, day, hour, minute, and the second value.

Post a Comment

0 Comments