postgresql数据库 实现id 自增

网友投稿 1118 2022-10-10

postgresql数据库 实现id 自增

postgresql数据库 实现id 自增

创建单列自增行

CREATE SEQUENCE upms_log_id_seq START 10;

创建数据库sql:

重点行

"ar_id" int4 DEFAULT nextval('upms_log_id_seq'::regclass) NOT NULL,

/*Navicat PGSQL Data TransferSource Server : 本地库PostgreSqlSource Server Version : 100700Source Host : localhost:5432Source Database : postgresSource Schema : publicTarget Server Type : PGSQLTarget Server Version : 100700File Encoding : 65001Date: 2019-04-23 18:09:26*/-- ------------------------------ Table structure for alarm_rules-- ----------------------------DROP TABLE IF EXISTS "public"."alarm_rules";CREATE TABLE "public"."alarm_rules" ("ar_id" int4 DEFAULT nextval('upms_log_id_seq'::regclass) NOT NULL,"bc_id" int4 NOT NULL,"rule_name" varchar(100) COLLATE "default","rule_type" varchar(100) COLLATE "default","parameter_0" varchar(100) COLLATE "default","parameter_1" varchar(100) COLLATE "default")WITH (OIDS=FALSE);COMMENT ON TABLE "public"."alarm_rules" IS 'ss表';COMMENT ON COLUMN "public"."alarm_rules"."ar_id" IS '唯一id';COMMENT ON COLUMN "public"."alarm_rules"."bc_id" IS '关联基础表id';COMMENT ON COLUMN "public"."alarm_rules"."rule_name" IS '名称';COMMENT ON COLUMN "public"."alarm_rules"."rule_type" IS '类型';COMMENT ON COLUMN "public"."alarm_rules"."parameter_0" IS '参数';COMMENT ON COLUMN "public"."alarm_rules"."parameter_1" IS '参数';-- ------------------------------ Alter Sequences Owned By -- ------------------------------ ------------------------------ Primary Key structure for table alarm_rules-- ----------------------------ALTER TABLE "public"."alarm_rules" ADD PRIMARY KEY ("ar_id");

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:小程序中数据列表切换组件(小程序中数据列表切换组件是什么)
下一篇:微信小程序罗列,不定期更新!(微信小程序罗列,不定期更新怎么办)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~