当前位置:网站首页>PostgreSQL设置自增字段
PostgreSQL设置自增字段
2022-06-27 23:01:00 【code-x】
postgres 自增需要先进行创建自增序列, 指定自增值, 最小值, 最大值:
CREATE SEQUENCE "public"."tt_id_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1;设置序列所有者:
ALTER TABLE "public"."tt_id_seq" OWNER TO "postgres";设置自增从1开始:
SELECT setval('"public"."tt_id_seq"', 1, false);自增字段添加默认建立连接:
nextval('tt_id_seq'::regclass)例
CREATE TABLE "public"."test" (
"id" int4 NOT NULL DEFAULT nextval('tt_id_seq'::regclass),
"name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL
PRIMARY KEY ("id")
)边栏推荐
- lodash实现防抖和节流功能及原生实现
- What are the requirements for customizing the slip ring for UAV
- plot_ Model error: pydot and graphviz are not installed
- Download, configuration and installation of MySQL
- . Mp4 video test address
- LabVIEW continuous sampling and limited sampling mode
- 无人机专用滑环定制要求是什么
- Flutter SliverAppBar全解析,你要的效果都在这了!
- Summary of attack methods of attack team
- Ceiling scheme 1
猜你喜欢

Official announcement! Apache Doris graduated from the Apache incubator and officially became the top project of Apache!
![[untitled]](/img/15/21020badab0d70450ccfb71f49da8a.png)
[untitled]

剑指 Offer 61. 扑克牌中的顺子

What is a through-hole conductive slip ring?

Deploy a mongodb single node server locally, enable auth authentication and enable oplog

Summary of wuenda's machine learning course (14)_ Dimensionality reduction

N methods of data De duplication using SQL

美团动态线程池实践思路已开源

JVM的内存模型简介

What is promise
随机推荐
.mp4视频测试地址
股票投资交流群安全吗?入群免费开户靠谱嘛?
Code neatness -- function
#795 Div.2 E. Number of Groups set *
Informatics Olympiad all in one 1359: enclosed area
What is promise
Is it safe to open an account online now? Novice is just on the road, ask for the answer
Cloud native O & M article plan
Taro--- day1--- construction project
哪个证券炒股开户佣金是最便宜,最安全的
What is the application scope and function of the conductive slip ring of single crystal furnace
MySQL 18: execution of write statements
【说明】Jmeter乱码的解决方法
Acwing第 57 场周赛【未完结】
Web mouse click special effects case collection (red heart in live broadcast room)
What are the requirements for customizing the slip ring for UAV
796 div.2 C. managing history thinking
Latest MySQL advanced SQL statement Encyclopedia
1696D. Permutation graph thinking
Ceiling scheme 1