For a sqlite table I want the primary key to be alphanumeric, not integer. If I have a 4-place NCHAR(4) column as the primary key, that means 36^4 or (10 numbers + 26 letters) ^ 4 => 1.6 million possible unique keys. Good enough! I've found the sqlite function combo
hex(randomblob(2))
and it will give me four random hex values, but I have no idea what my range is. I assume if it's hex I'm only getting 16 possible values per place, but is that 16 ^ 2 for 256 possible random values, or 16 ^ 4 since it's four places, or something entirely different? I'd really prefer to generate a four-place random alphanumeric key. Also, how do I get these values in the actual added records? With the simple integer key there's AUTOINCREMENT in the table create. I'm guessing it couldn't be done within CREATE TABLE.... Would this require a separate trigger, or would it be done in an INSERT statement at the time of record creation?