postgresql - Postgres Automatically Generate Value for Field -
i have postgres table called users. table has these fields:
user_id, first_name, last_name, email, user_code
is there way can have user_code field of table automatically generated in following format: initials of first_name , last_name in uppercase letters. in cases user_code should 2 characters long. however, if same code exists should add digit representing number user_code is? example if have user_code aj , add aj second aj should aj2 , third should aj3 , on. first should initials without numbers
Comments
Post a Comment