constraint 外键表名_id_fk foreign key (外键字段名) references 主表名(主表id)
create table FirNav
(
    id 
int primary key identity(1,1not null,
    navName 
varchar(10not null,
);

create table SecNav
(
    id 
int primary key identity(1,1not null,
    navName 
varchar(10not null,
    firId 
int ,
    
constraint SecNav_id_fk foreign key (firId) references FirNav(id)
);

create table ThirdNav
(
    id 
int primary key identity(1,1not null,
    navName 
varchar(10not null,
    secId 
int,
    
constraint ThirdNav_id_fk foreign key (secId) references SecNav(id)
);

相关文章:

  • 2022-12-23
  • 2021-06-03
  • 2022-02-09
  • 2022-12-23
  • 2021-12-14
  • 2021-11-05
猜你喜欢
  • 2021-08-13
  • 2021-09-13
  • 2021-12-04
  • 2021-11-15
  • 2021-12-04
相关资源
相似解决方案