开发者社区 问答 正文

mysql字段默认值的问题

mysql中是否可以把某一列的默认值设为字符串+id的组合呢?

比如商品1111

其中1111是id列的值,id列是自增长的,可以实现吗??除了用触发器

展开
收起
小旋风柴进 2016-03-11 11:00:06 2162 分享 版权
1 条回答
写回答
取消 提交回答
  • 不行,默认值必须是静态值或者current_timestamp特例:

    The DEFAULT value clause in a data type specification indicates a default value for a column. With one exception, the default value must be a constant
    2019-07-17 18:58:41
    赞同 展开评论