Is it good practice to trim whitespace (leading an

2019-07-11 21:18发布

Presuming that the spaces are not important in a field's data, is it good practice to trim off the spaces when inserting, updating or selecting data from the table ?

I imagine different databases implement handling of spaces differently, so to avoid that headache, I'm thinking I should disallow leading and trailing spaces in any field data.

What do you think?

7条回答
贪生不怕死
2楼-- · 2019-07-11 22:05

For typical data enty it's not worth the overhead. Is there some reason you think you are going to get lots of extra blank lines? If you are then it might be a good idea to trim to keep DB size down but otherwise no.

查看更多
登录 后发表回答