Junior — Middle
What data types or values cannot be used as a value for a secondary key in a database table?
sobes.tech AI
Answer from AI
You cannot use the following as a value for a secondary (foreign) key in a database table:
- NULL — the foreign key must reference an existing value in the primary table, and NULL does not guarantee referential integrity.
- Data types that do not support comparison or indexing — for example, large binary objects (BLOB), text fields without length restrictions (CLOB) are usually not used for keys.
- Floating types (FLOAT, DOUBLE) — due to storage and rounding characteristics, it is not recommended to use them as keys, as comparison may be unreliable.
The foreign key should reference a unique and indexed field (usually the primary key) with a clearly defined data type that supports exact comparison, such as INTEGER, VARCHAR with limited length, etc.