创建表格

 CREATE TABLE test
 ( id serial,
 name varchar(16) not null
 );

 

postgreSQL 自动递增序号

查询当前创建好的表格

postgreSQL 自动递增序号

插入数据

BEGIN TRANSACTION;
INSERT INTO test(name)  VALUES('A0001');
commit;

 

再次查询表格,ID为1

postgreSQL 自动递增序号

 

插入第二条数据,序号自动为2

BEGIN TRANSACTION;
INSERT INTO test(name) VALUES('A0002');
commit;

 

postgreSQL 自动递增序号

 

重复第二步操作

postgreSQL 自动递增序号

 未完待续…

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
  • 2021-08-30
  • 2021-12-25
猜你喜欢
  • 2021-11-15
  • 2022-12-23
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
相关资源
相似解决方案