创建表两个主键外键~~~

create table A

(

  id int primary key not null,

  name nvarchar(20) not null,

  address  varchar(50) not null

)

这个是主表(设置了一个主键)

create table B

(

  id int not null foreign key references A(id) on delete cascade,

  orderid int not null,

  class nvarchar(20) not null,

  primary key(id,orderid)

)

主要是分清主表和次表的关系啦……

徐燕平
原文地址:https://www.cnblogs.com/xyp0605/p/1882602.html