Is it possible to auto generate a number if nothing is supplied for a column in the table
#SurveyId,Name,PhoneNumber
1,David,071234234
1,John, NULL
expected output
#SurveyId,Name,PhoneNumber
1,David,071234234
1,John, 3274985AUTO
I would like to write a trigger for my table to carry out the auto generation option; i would like to use UUID() for auto generating number
syntax error:
15:10:23 CREATE TRIGGER mobilecheck BEFORE INSERT ON reg02_maininfo `FOR EACH ROW IF NEW.farmermobile IS NULL THEN SET NEW.farmermobile = floor(rand()*900000)+100000 Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 2 0.0015 sec`