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

后端 未结 10 1609
有刺的猬
有刺的猬 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:51

    you can use var-char,String,and int ,it depends on you, if you use only country code with mobile number than you can use int,if you use special formate for number than use String or var-char type, if you use var-char then must defile size of number and restrict from user.

提交回复
热议问题