Amazon Interview Question
Quality Assurance EngineersCountry: India
This is a question of semantics. You are trying to decide the appropriate datatype for storage which can be a tricky question. The best rule of thumb is to store your data as integers if you will need to use the data as an integer.
In other words, since you will never be using a postal code as a number it does not make sense to store it as one. It doesn't matter what the data looks like, it matters what it is. Is a postal code a number? No, it's a string of characters that just happens to be made up of wholly numeric characters. Therefore a postal code is best stored as a string.
It might be a data integrity issue, based on reusability of that field in application. If it is required to be reused in number format, it is an issue, otherwise no. The impact is dependent on the business requirement of the application under test, and is directly proportional to the priority of the issue.
According to my research and knowledge,it depends if the numerical data entered by the user will be used for any mathematical calculaitons or not.If it is not going to be used for any calculation.For eg in case of zip postal code 0100. You are not going to perform any operation on these numbers so you should save it as text.
- kajal singla September 19, 2015Beacuse storing it as interger would make it '100' but actually it is '0100'.So text is preferable in that case.
Correct me if i'm wrong