Integer vs String in database

前端 未结 16 595
后悔当初
后悔当初 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条回答
  •  攒了一身酷
    2020-12-05 14:22

    I don't use a numerical data type unless I expect to do math on the data. Why risk finding a problem in the future for something that you were "sure" would always be a number that someone decides to put a non-numeric character in.

    If you aren't going to do math on it make it a string.

提交回复
热议问题