Multiple choice technology databases

Which of the following DB2 data types can NOT be used to create an identity column?

  1. SMALLINT

  2. INTEGER

  3. DOUBLE

  4. NUMERIC

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Identity columns in DB2 automatically generate unique numeric values, typically used as primary keys. They require data types that guarantee consistent, predictable sequential values. SMALLINT, INTEGER, and NUMERIC are all exact numeric types suitable for identity columns. However, DOUBLE is a floating-point type that cannot guarantee precise sequential values due to rounding errors inherent in floating-point arithmetic. DB2 explicitly prohibits using approximate numeric types like DOUBLE, REAL, or FLOAT for identity columns to maintain data integrity and ensure reliable unique value generation.