使用这个一般是用作识别码的,当做定义表格的主键。generated语法则可以自定义你想怎么产生这个值的策略。
Create table nomination
(
nominationID
BigINT Not Null
Primary Key generated always as identity,
nominee char(6) Not Null,
nominator char(6) Not Null,
reason V
ArchAR(250),
nomdate date Not Null,
categoryid INTEGER Not Null,
check (nominee != nominator) not enforced enable query optimization,
For
eign Key CategoryExists (categoryid)
references category (categoryid) on delete restrict
)
Create table category
(
CategoryID INTEGER
PRimary Key Generated Always as Identity
(Start With 1 Increment by 1 minvalue 0 maxvalue 999999999
no cycle cache 5 no order),
CateogryN
ame
VARCHAR(50) Not Null,
Eligibility VARCHAR(250)
)