以前使用mysql 设置自动增长的语句如下

create table person(id int not null primary key auto_increment);

mysql是用auto_increment这个属性来标识字段的自增,在使用insert 语句时候id 这个字段的值可以写 ''或NULL

 

postgresql 使用序列来标识字段的自增长

CREATE TABLE daodaoimg
(
id serial NOT NULL,
alttext text,
imgurl text
)

直行这条语句后 会自动生成daodaoimg_id_seq这个序列

insert 语句的时候可以不加id这个字段   insert into daodaoimg(alttext,imgurl) values('','');

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-26
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
  • 2021-12-17
相关资源
相似解决方案