设置主外建 主键 alter table XXX add constraint PK_XXX primary key(ID);外键 alter table XXX add constraint FK_XXX__YYY foreign key(YYY_ID) references YYY(ID) ON DELETE CASCADE;