SQL Data Types
It specifie what type of data an object have. SQL Each column, variable and expression has a related data type.After creating your tables You can use these data types.
Numeric Data Types
bigint-Allows whole numbers between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807
int-Allows whole numbers between -2,147,483,648 and 2,147,483,647
smallint-Allows whole numbers between -32,768 and 32,767
tinyint- Allows whole numbers from 0 to 255
bit-Integer that can be 0, 1, or NULL
decimal-Fixed precision and scale numbers.
Allows numbers from -10^38 +1 to 10^38 â??1.
numeric-Fixed precision and scale numbers.
Allows numbers from -10^38 +1 to 10^38 â??1.
money-Monetary data from -922,337,203,685,477.5808 to 922,337,203,685,477.5807
smallmoney-Monetary data from -214,748.3648 to 214,748.3647
float-Floating precision number data from -1.79E + 308 to 1.79E + 308.
real- Floating precision number data from -3.40E + 38 to 3.40E + 38
Date Time Data Types
datetime-From January 1, 1753 to December 31, 9999 with an accuracy of 3.33 milliseconds
datetime2-From January 1, 0001 to December 31, 9999 with an accuracy of 100 nanoseconds
smalldatetime-From January 1, 1900 to June 6, 2079 with an accuracy of 1 minute
date-Store a date only. From January 1, 0001 to December 31, 9999
time-Store a time only to an accuracy of 100 nanoseconds
datetimeoffset- The same as datetime2 with the addition of a time zone offset
timestamp-Stores a unique number that gets updated every time a row gets created or modified. The timestamp value is based upon an internal clock and does not correspond to real time. Each table may have only one timestamp variable
TEXT Data Types
CHAR(size)-Holds a fixed length string (can contain letters, numbers, and special characters). The fixed size is specified in parenthesis. Can store up to 255 characters
VARCHAR(size)-Holds a variable length string (can contain letters, numbers, and special characters). The maximum size is specified in parenthesis. Can store up to 255 characters. Note: If you put a greater value than 255 it will be converted to a TEXT type
TINYTEXT-Holds a string with a maximum length of 255 characters
TEXT -Holds a string with a maximum length of 65,535 characters
BLOB-For BLOBs (Binary Large OBjects). Holds up to 65,535 bytes of data
MEDIUMTEXT-Holds a string with a maximum length of 16,777,215 characters
MEDIUMBLOB-For BLOBs (Binary Large OBjects). Holds up to 16,777,215 bytes of data
LONGTEXT-Holds a string with a maximum length of 4,294,967,295 characters
LONGBLOB-For BLOBs (Binary Large OBjects). Holds up to 4,294,967,295 bytes of data
ENUM-Let you enter a list of possible values. You can list up to 65535 values in an ENUM list. If a value is inserted that is not in the list, a blank value will be inserted.
SET-Similar to ENUM except that SET may contain up to 64 list items and can store more than one choice