Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Friday, 16 February 2024

Different Data types in TERADATA

In Teradata, there are various data types available to store different types of data. Here are some common data types in Teradata along with examples:

1. INTEGER: Signed integer with a range of -2^31 to 2^31-1.

    CREATE TABLE example_table (

        id INTEGER

    );

2. VARCHAR: Variable-length character string with a maximum length specified.

    CREATE TABLE example_table (

        name VARCHAR(255)

    );

3. DECIMAL: Fixed-point number with exact precision and scale.

    CREATE TABLE example_table (

        amount DECIMAL(10, 2)

    );

4. DATE: Date value in the format 'YYYY-MM-DD'.

    CREATE TABLE example_table (

        birth_date DATE

    );

5. TIME: Time value in the format 'HH:MM:SS'.

    CREATE TABLE example_table (

        check_in TIME

    );

6. TIMESTAMP: Date and time value with fractional seconds precision.

    CREATE TABLE example_table (

        created_at TIMESTAMP(6)

    );

7. FLOAT: Floating-point number with single precision.

    CREATE TABLE example_table (

        price FLOAT

    );

8. BYTEINT: Signed integer with a range of -128 to 127.

    CREATE TABLE example_table (

        flag BYTEINT

    );

9. CHARACTER: Fixed-length character string with a maximum length specified.

    CREATE TABLE example_table (

        code CHARACTER(5)

    );

10. CLOB: Character large object for storing large text data.

    CREATE TABLE example_table (

        description CLOB

    );

These are some commonly used data types in Teradata, and they can be used to define columns in tables. Each data type has specific storage requirements and constraints that should be considered when designing database schemas.

No comments:

Post a Comment

Please provide your feedback in the comments section above. Please don't forget to follow.