INSERT INTO UserDetail(UserId, About) VALUES (1,'This is about insert text') ON DUPLICATE KEY UPDATE About = 'This is about update text';
'UserId' must be the primary key or Unique key to make this query work. When you hit this first time it will insert records into UserDetail table. Here we have made UserId Unique key. When you again execute the above SQL query again it will update the records which have UserId 1.