I have the following, how do I make the id (primary key) self incremented from the db point of view? Thank you.
I feel that, if there are several different threads(or sessions) access below userTable at the same time, it will be a little bit tricky to maintain the id by myself.
CREATE TABLE if not exists userTable
(
userid integer,
loginname string,
mobilephone string,
workemail string,
primary key (userid)
);
What is the best way to model this?
You can define a primary key field as an IDENTITY column and the system will allocate and increment that field for you on insert.
See: More information here https://docs.oracle.com/en/database/other-databases/nosql-database/20.2/java-driver-table/defining-tables-identity-colum…