mysql Tinyint as unsigned

前端 未结 3 799
臣服心动
臣服心动 2021-02-12 11:05

I tried to write t=t|128 but got an out of range error. I suspect tinyint is signed. However http://dev.mysql.com/doc/refman/5.5/en/numeric-types.html says it may be unsigned (b

3条回答
  •  我寻月下人不归
    2021-02-12 11:30

    Firstly, you should do something with negative values, otherwise ALTER TABLE...UNSIGNED will throw an error. For example you could increase all values -

    UPDATE table SET tiny_field = tiny_field + 128;
    

    Then use ALTER TABLE to change field type/option.

提交回复
热议问题