1.navicat设置默认值

1.找到对应表名,右键点击设计表,找到对应的字段,下方有默认。直接填值,点击保存即可。

navicat设置默认值,唯一值,大于等于0

2.设置唯一值 

设计表中点击索引,选取字段,如下所示,保存即可

navicat设置默认值,唯一值,大于等于0

 

navicat设置默认值,唯一值,大于等于0

 

3.设置数据库的某个字段必须>=0

alter table t_bin_stock
add constraint ck_quantity check(quantity>=0)

t_bin_stock :表名

ck_quantity  : 约束名,可随便写,最好以ck开头

quantity       : 你需要控制的字段

 

4.设置数据库的某个字段必须=0or=1

alter table t_bin_stock
add constraint ck_quantity check(quantity=0 or quantity=1)

相关文章:

  • 2022-02-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
  • 2022-12-23
  • 2021-06-11
  • 2021-10-17
相关资源
相似解决方案