Table with field abd text field hash_code varchar
I would like to have in hash_code the md5 value of abd field without to do so from the code.
is that possibile? Thanks
CodePudding user response:
mysql> create table mytable ( abd varchar(100), hash_code char(32) as (md5(abd)) );
Query OK, 0 rows affected (0.01 sec)
mysql> insert into mytable set abd = 'now is the time for all good men to come to the aid of their country';
Query OK, 1 row affected (0.01 sec)
mysql> select * from mytable\G
*************************** 1. row ***************************
abd: now is the time for all good men to come to the aid of their country
hash_code: 60a5d53255faa66033c9851adb40947a