Can 'false' match some string in mysql?

前端 未结 4 599
夕颜
夕颜 2021-01-21 15:48

I have a table like this:

CREATE TABLE IF NOT EXISTS `session` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `token` varchar(32) NOT NULL,
  `profile` varchar(1000         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-21 16:14

    Is there any reason you're not testing token is null or token like ''? Comparing a varchar to false is a bad idea regardless of whether the DB will catch your mistake or not... a varchar is never false, and false doesn't equal null.

提交回复
热议问题