Skip to content

Instantly share code, notes, and snippets.

@workze
Created April 29, 2020 02:24
Show Gist options
  • Save workze/26b79108c6299b59c238578aa96350d2 to your computer and use it in GitHub Desktop.
Save workze/26b79108c6299b59c238578aa96350d2 to your computer and use it in GitHub Desktop.
mysql generate column 生成列
create table `tt` (
`id` int(11) not null,
`first_name` varchar(20),
`last_name` varchar(20),
`full_name` varchar(40) as ( concat(first_name, ' ', last_name) )
primary key (`id`)
) engine=InnoDb DEFAULT charset=utf8mb4;
插入:1、不带full_name;2、只能带 DEFAULT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment