In: Computer Science
You have been accepted as an intern at an IT start-up. In a database design session, you see that phone number, post code and some other attributes have been defined as numeric datatype. Do you think it is the correct decision? If not, suggest the reasons why this is not appropriate.
No, I don't think that defining phone number, post code and some other attributes as the numeric data type is the correct decision. This is because the length of the value in this field will be very less and only numerical data will be allowed. There are some countries where post code contains both numbers and alphabets and if post code is defined as numeric datatype then it will not accept post code of these countries. Also, in the phone numbers, there is a convention to put "+" at the starting, followed by country code. Even putting the "+" sign may create a problem when the phone number is defined as a numeric datatype. Other attributes may be name, country, city, and other fields where data may be in the alphabets and declaring it as numeric datatype will create a problem. Instead of using numeric datatype, if VARCHAR(or string) datatype is used then there will be larger limit on length on value and there won't be any constraint on type of value.