query to create trigger in mysql -


I have a table named sample_table and its columns are col_a, col_b, col_c. I am trying to create a trigger in MySQL 5.6 which will update the col_c when joining a line (in the form of the conlat (col_a, col_b) for the question I have written:

  After inserting on sample_table for each row, create trig_sample_table trigger col_c = concat (col_a, col_b) setting;  

In running this SQL, the error I am getting is: Error 1064 (42000): There is an error in your SQL syntax; Check which manual is related to using the 'end' on line 6 for the correct syntax for your syntax.

Could any of you please help me in creating a trigger as a help?

You need to make it before entering . Try it: Create a trg_sample_table trigger

  before inserting on sample_table for each row new.col_c = concat (new.col_a, new.col_b); End;  

You can not modify the row that you have still triggered after entering . If you want to modify it, before insert it .


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -