In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces postgresql how to create self-increasing id, the article is very detailed, has a certain reference value, interested friends must read!
The word "test" here refers specifically to the table space (schema) in postgre, and the default table space is "public" DROP SEQUENCE if EXISTS "test". "testseq_id_seq"; CREATE SEQUENCE "test". "testseq_id_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; DROP TABLE if EXISTS "test". "testtable" CREATE TABLE "test". "testtable" ("id" int4 DEFAULT nextval ('testseq_id_seq'::regclass) NOT NULL,-- Table data association SEQUENCE. Take nextval (' testseq_id_seq') nextval ('testseq_id_seq' "create_date" timestamp (6), "age" int4, "name" varchar (6), "grade" float4) WITH (OIDS=FALSE); ALTER TABLE "test". "testtable" ADD PRIMARY KEY ("id") -- insert data without writing primary key nextval ('testseq_id_seq'); INSERT into "test". "testtable" (name) values (' 111');-- value data (varchar) in single quotation marks-- first create the first data of sequence.. -- SELECT nextval ('testseq_id_seq')
Nextval ('chengdu_boundary_id_seq'::regclass)
Method 2:
"id" SERIAL primary key NOT NULL
#
The above is all the content of the article "how postgresql creates self-increasing id". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.