What is Data Type?
Data type is represent of Data. In data type, When computer programs store data in variables, each variable must be assigned a specific data type.
Data types used database application.
What is SQL Data Type?
SQL has different data type such as, Numeric, Characters, Binary, Date and Time.
When a table has to be created in SQL, its data type has to be given for each column of the table.
User can choose the data type as per his requirement.
SQL Data Type have list below here :
Character String Data Type :
Data Type | Syntax | Description |
---|---|---|
Character String | CHAR | It is used to fixed Length string and that can contain letters, numbers, and special characters. (Maximum length of 8,000 characters). |
Character String | VARCHAR | It is used to variable Length string and that can contain letters, numbers, and special characters. (Maximum length of 8,000 characters). |
Unicode Character String | NCHAR | It is used to fixed width Unicode string. (Maximum length of 4,000 Characters). |
Unicode Character String | NVARCHAR | It is used to variable width Unicode string. (Maximum length of 4,000 Characters). |
Character String | TEXT | It is used to variable length, (Maximum length of 2GB). |
Unicode Character String | NTEXT | It is used to variable width, (Maximum length of 2GB). |
Binary Data Type :
Data Type | Syntax | Description |
---|---|---|
Binary value | BINARY | It is used to fixed length binary data. (Maximum size of 8,000 Bytes). |
Binary value | VARBINARY | It is used to variable length binary data. (Maximum size of 8,000 Bytes). |
Image | IMAGE | It is used to variable length binary data. (Maximum size of 2,147,483,647 Bytes). |
Numeric Data Type :
Data Type | Syntax | Description |
---|---|---|
Decimal | DECIMAL | It is used to specify a fixed point number. It is specify by d parameter. (Range is from 1038+1 to 1038-1). |
Integer | INT | This is Equal to INT(size). (Range is from -2,14,74,83,648 to +2,14,74,83,647) |
Small Integer | SMALLINT | A small integer. (Range is from -32768 to +32767). |
Big Integer | BIGINT | A Big integer. (Range is from 92,23,37,20,36,85,47,75,808 to +92,23,37,20,36,85,47,75,807). |
Tiny Integer | TINYINT | Tiny integer is very small integer(Range is from 0 to 255). |
Bit | BIT | It is used for a bit-value type. (Range is from 0 to 1). |
Image | IMAGE | It is used to variable length binary data. (Maximum size of 2,147,483,647 Bytes). |
Float | FLOAT | Float used for specify floating point number. (Range is from -1.79E+308 to +1.79E+308). |
Date and Time Data Type :
Data Type | Syntax | Description |
---|---|---|
Date | DATE | It is used for applying date format. for example Aug22, 1997(YYYY-MM-DD). |
Time | TIME | It is used for applying time. for example(4:00AM) |
Datetime | DATETIME | It is used for combination of applying date and time. for example January 1, 1958 to December 31, 9999(format : YYYY-MM-DD HH:MI:SS) |
Timestamp | TIMESTAMP | Its value is stored as the number of seconds. for example format : YYYY-MM-DD HH:MI:SS (store year, month, day, hour, minute and second) |
0 Comments