Which is best data type for phone number in MySQL and what should Java type mapping for it be?

后端 未结 10 1593
有刺的猬
有刺的猬 2020-12-04 11:09

I am using MySQL with Spring JDBC template for my web application. I need to store phone number with only digits (10). I am little bit confused about data type using data ty

10条回答
  •  执笔经年
    2020-12-04 11:37

    VARCHAR with probably 15-20 length would be sufficient and would be the best option for the database. Since you would probably require various hyphens and plus signs along with your phone numbers.

提交回复
热议问题