MySQL - Set default value for field as a string concatenation function

后端 未结 3 1952
面向向阳花
面向向阳花 2021-02-05 23:31

I have a table that looks a bit like this actors(forename, surname, stage_name);

I want to update stage_name to have a default value of

forename.\" \".su         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-06 00:06

    According to 10.1.4. Data Type Default Values no, you can't do that. You can only use a constant or CURRENT_TIMESTAMP.

    OTOH if you're pretty up-to-date, you could probably use a trigger to accomplish the same thing.

提交回复
热议问题