Welcome! 登入 註冊
美寶首頁 美寶百科 美寶論壇 美寶落格 美寶地圖

Advanced

Create a Table with Incremental Primary Key

Posted by mepoadm 
Create a Table with Incremental Primary Key

分類標籤: PostgreSQL
1. Add primary key when creating a table

CREATE TABLE example
(
id bigserial primary key,
name VARCHAR(255) not null,
value bigint
);

2. Add primary key by updating a table

ALTER TABLE example add primary key (id);



Edited 2 time(s). Last edit at 02/28/2019 11:39PM by mepoadm.
(編輯記錄)