不解释:

---先创建外键的column
ALTER TABLE tblLicenses
  ADD ProductID int not null;

---添加外键
ALTER TABLE tblLicenses
ADD FOREIGN KEY (ProductID)
REFERENCES tblProducts(ID)

---先创建外键的column
Alter Table tblActivationRecords
Add LicenseID bigint not null;

---添加带名字的外键
ALTER TABLE tblActivationRecords
ADD CONSTRAINT fk_Activation_License
FOREIGN KEY (LicenseID)
REFERENCES tblLicenses(ID)

基本上各种操作w3school都有了。

http://www.w3school.com.cn/sql/sql_foreignkey.asp

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-12
  • 2021-07-04
  • 2021-07-14
  • 2021-12-31
相关资源
相似解决方案