Integer vs String in database

前端 未结 16 653
后悔当初
后悔当初 2020-12-05 13:42

When defining datatypes in a database, I have always had a problem with choosing whether to use integers or strings to store certain \'numerical\' data.

Say I am bui

16条回答
  •  猫巷女王i
    2020-12-05 14:19

    Post code is not a number: it's a code or identifier. The same applies to phone numbers.

    Number of files in a torrent is an integer.

    Not least, in this case you can create a CHECK CONSTRAINT LIKE '[09][09][09][09]' to keep data correct at the database level.

提交回复
热议问题