create table bookstore3(
bookid int not null,
price  char(10) not null,
publisher varchar(10)  not null unique,
bookname  char (10)  not null,
constraint bookstore3_pk primary key (bookid)
);
create table sale2(
bookname char(10)  not null,
bookid int not null,
price  char(10) not null,
timedate char (10) not null,
number   varchar(10)  not null unique,
constraint sale2_pk primary key (bookname),
constraint sale2_bookstore3_fk foreign key (bookid)
  references bookstore3(bookid)
);
create table stock2(
bookname char(10) not null,
number   varchar(10)  not null unique,
publisher char(10)   not null,
price     char(10)   not null,
constraint  stock2_pk primary key (bookname),
constraint  stock2_bookstore3_fk foreign key (bookname)
  references  bookstore3(bookname)
);
下面的提示是
Msg 1776, Level 16, State 0, Line 18
在被引用表 'bookstore3' 中没有与外键 'stock2_bookstore3_fk' 中的引用列列表匹配的主键或候选键。
Msg 1750, Level 16, State 0, Line 18
无法创建约束。请参阅前面的错误消息。