Reputation: 23
I want my table look like this with only imputing the comment value:
ID ID2 Comment
1 1 Hi!
2 2 Hi!
Upvotes: 1
Views: 491
Reputation: 48780
You don't mention your database, so this answers tackles the general problem.
Most databases support a single identity column per table. The only database [I know of] that supports multiple identity columns is PostgreSQL. Hurray PostgreSQL!
Here's an example:
create table t (
id1 int generated always as identity,
id2 int generated always as identity,
comment varchar(50)
);
insert into t (comment) values ('Hi Anna');
insert into t (comment) values ('Hi Peter');
select * from t;
Result:
id1 id2 comment
--- --- --------
1 1 Hi Anna
2 2 Hi Peter
Note that by default thay all start at 1, but each generation can have different parameters. Namely, they can start on a different starting point, different limit, cycle, etc.
Upvotes: 2