Advertisements
Advertisements
Question
Can you think of an attribute for which fixed length string is suitable?
Short Answer
Advertisements
Solution
Yes. A fixed-length string (CHAR) is suitable for attributes where the number of characters is always the same.
Example: A Gender attribute can use CHAR(1) because it can store values such as M or F.
Other examples include:
- Country code –
CHAR(2)(e.g.,IN,US) - PIN code –
CHAR(6)(when stored as a string) - Employee code –
CHAR(5)if every code has exactly 5 characters.
shaalaa.com
Is there an error in this question or solution?
