How can I auto-generate a code for each record that contains information from different fields in my DB? For example, I would like the code to have this format: "000001.USA.en" where the number is just an incrementing serial number (I know how to do that), the three uppercase letters are the ISO country code, and the lowercase letters are the ISO language code. How can I string all these together into one code. (p.s. this is not intended to be the primary key, just a simple code needed by my employer.)
Each record will contain the country and language, but I would like the corresponding ISO codes (stored in the "Countries" and "Languages" tables) to be used in the generation.