mysql Tinyint as unsigned

前端 未结 3 786
臣服心动
臣服心动 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:18

    You mark the unsigned with the keyword unsigned. So, when making a table for an example:

    CREATE TABLE `example_table` (
      `example_col` tinyint(3) unsigned NOT NULL
    );
    

    See Create Table instead for more, or the Alter table.

提交回复
热议问题