Define a column as MD5 sum of other columns in MySql Suppose I have following table - 

id   name  
--   ----
1    kshitiz


Is it possible to define another column that is the md5 sum (or some other hash) of values in the previous two columns?

id   name    hash
--   ----    ----
1    kshitiz 392b6be97993de246fe188ac5d0052a7
if you are talking of column definition as in create table, there isn't a data type for hash.

However, it's best to use binary(20) and unhex function to convert your sha-1 into a binary data type because it saves a lot of space.

create table user(
id int primary key auto_increment not null,
username varchar(50),
password binary(20)
);

insert into user(username) values('ndefontenay');

update user set
password = unhex(sha1(concat(last_insert_id(),username)))
where id = last_insert_id();

select upper(sha1(concat(1,'ndefontenay'))) as "on insert",hex(password) as "on retrieve"
from user
where id = 1;