建立关联是通过外键引用实现的 例如建立一个学生表和班级表的关联,可以如下: create table class ( classid char(4) primary key not null, classname varchar(10) not null ) go create table student ( stuid char(6) primary key not null, sname varchar(10) not null, classid char(4) constraint fk_classid foreign key references class(classid) ) 嫌麻烦的话也可以使用SQL SERVER管理工具中的数据库关系图功能,只需要在关联的表间字段拖拽鼠标就可以了.

 

相关文章:

  • 2021-12-03
  • 2021-06-16
  • 2021-07-11
  • 2021-04-17
  • 2021-11-05
  • 2022-01-01
  • 2021-12-18
猜你喜欢
  • 2021-11-25
  • 2022-12-23
  • 2021-07-10
  • 2021-06-16
  • 2021-11-04
  • 2022-12-23
  • 2021-09-04
相关资源
相似解决方案