我有表像SQL - PostgreSQL中,基于其他列的增量列的值
create table test(employee integer NOT NULL, code character varying(200), number integer)
我想自动递增列“数量”上的每个插入记录
insert into test(employee, code) values(17,'bangalore')
insert into test(employee, code) values(17,'bangalore')
insert into test(employee, code) values(17,'mumbai')
我想导致像
employee code number
17 bangalore 1
17 bangalore 2
17 bangalore 3
17 mumbai 1
17 mumbai 2
17 bangalore 4
17 mumbai 3
18 bangalore 1
18 bangalore 2
18 mumbai 1
18 mumbai 2
做**不**发布代码或注释中的其他信息。 ** [编辑] **你的问题。 –
你为什么要存储这些信息?您可以在检索数据时轻松生成这些数字。 –
我想存储多个地方引用的相同数据 –