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:
1. Binary Datatypes
There are Three types of binary Datatypes which are given below:
Data Type | Description |
---|---|
binary | It has a maximum length of 8000 bytes. It contains fixed-length binary data. |
varbinary | It has a maximum length of 8000 bytes. It contains variable-length binary data. |
image | It 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 type | From | To | Description |
---|---|---|---|
float | -1.79E + 308 | 1.79E + 308 | It is used to specify a floating-point value e.g. 6.2, 2.9 etc. |
real | -3.40e + 38 | 3.40E + 38 | It specifies a single precision floating point number |
3. Exact Numeric Datatype
The subtypes are given below:
Data type | Description |
---|---|
int | It is used to specify an integer value. |
smallint | It is used to specify small integer value. |
bit | It has the number of bits to store. |
decimal | It specifies a numeric value that can have a decimal number. |
numeric | It is used to specify a numeric value. |
4. Character String Datatype
The subtypes are given below:
Data type | Description |
---|---|
char | It has a maximum length of 8000 characters. It contains Fixed-length non-unicode characters. |
varchar | It has a maximum length of 8000 characters. It contains variable-length non-unicode characters. |
text | It 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:
Datatype | Description |
---|---|
date | It is used to store the year, month, and days value. |
time | It is used to store the hour, minute, and second values. |
timestamp | It stores the year, month, day, hour, minute, and the second value. |
0 Comments