--增加表cw_users的外键约束fk_users_group,表中的group_id受表cw_users_group中的主键id约束
begin transaction
alter table cw_users add constraint fk_users_group
foreign key (group_id)
references cw_users_group([id]) on update cascade on delete cascade
commit transaction
原文:http://www.cnblogs.com/thinker-cxz/p/4839804.html