Add foreign key constraint

Add foreign key constraint (associated field between braces) 

   - the ALTER TABLE Table 

   - the ADD CONSTRAINT constraint name FOREIGN KEY (associated field) references the primary table (associated field); 

   - for example: 

  the ALTER  TABLE BusinessBills 

   the ADD  CONSTRAINT FK_BusinessBillPackageBusinessBills a FOREIGN  KEY (BusinessBillPackageId) References BusinessBillPackage (Id);

 

Guess you like

Origin www.cnblogs.com/jasonlai2016/p/11433297.html