In this tutorial, you will get a basic idea about Teradata data types and their uses.
What is a Data Type?
Data Type defines the types of data that can be stored in a particular column of a table. Each column in a table is associated with a data type. For example, if you want to store “Robert” in the name column, the column should be declared as char
or varchar
.
Whenever you are creating a table in Teradata, you need to declare data types for each of the columns. You can choose the name and data type of the column as per your requirement.
Teradata Data Types
Following are the most commonly used data types in Teradata.
Data Types | Length (Bytes) | Range of values |
BYTEINT | 1 | -128 to +127 |
SMALLINT | 2 | -32768 to +32767 |
INTEGER | 4 | -2,147,483,648 to +2147,483,647 |
BIGINT | 8 | -9,233,372,036,854,775,80 8 to +9,233,372,036,854,775,8 07 |
DECIMAL | 1-16 | |
NUMERIC | 1-16 | |
FLOAT | 8 | IEEE format |
CHAR | Fixed Format | 1-64,000 |
VARCHAR | Variable | 1-64,000 |
DATE | 4 | YYYYYMMDD |
TIME | 6 or 8 | HHMMSS.nnnnnn or HHMMSS.nnnnnn+HHMM |
TIMESTAMP | 10 or 12 | YYMMDDHHMMSS.nnnnnn or YYMMDDHHMMSS.nnnnnn +HHMM |