create table kit(id int unsigned not null auto_increment, creator int unsigned not null, name varchar(16) not null, script longtext not null, tag as concat(select username from user where id = creator, '/', name), primary key (id));
doesn't work because I am trying to make tag
a computed column
I want two tables, user
looks like
+----+------------------+
| id | username |
+----+------------------+
| 1 | 1234567890123456 |
+----+------------------+
and kit
looks like
+----+---------+--------+--------+-------------------------+
| id | creator | name | script | tag |
+----+---------+--------+--------+-------------------------+
| 1 | 1 | kitkit | long | 1234567890123456/kitkit |
+----+---------+--------+--------+-------------------------+
The tag column should be auto-computed from the username of the creator and the name of the kit.
I thought my column declaration would work:
tag as concat(select username from user where id = creator, '/', name)
but I guess not.