0

在为主键创建约束时,我收到了 Movie 表(在末尾列出)的右括号错误。这怎么能建造得更好?

create table Director
(DirectorID number (10,0),
DirectorName varchar2 (30),
DirectorBio varchar2 (300),
constraint DirectorID_PK primary key(DirectorID));

create table Actor
(ActorID number (10,0),
ActorName varchar2 (30),
ActorBio varchar2 (300),
constraint ActorID_PK primary key(ActorID));

create table Award
(AwardID number (10,0),
ActorID number (10,0),
DirectorID number (10,0),
AwardName varchar2 (20),
AwardType varchar2 (20),
AwardDate number (4,0),
constraint ActorID_FK foreign key (ActorID) references Actor(ActorID),
constraint DirectorID_FK foreign key (DirectorID) references Director(DirectorID));

create table Distributor
(DistributorID number (10,0),
CompanyName varchar2 (30),
Address1 varchar2 (30),
Address2 varchar2 (30),
City varchar2 (20),
State varchar2 (2),
Zipcode number (7,0),
PhoneNumber number (10,0),
Email varchar2 (20),
Homepage varchar2 (100),
constraint DistributorID_PK primary key(DistributorID));


create table Movie 
(MovieID number (10,0), 
ActorID number (10,0), 
DirectorID number (10,0), 
Title varchar2  (30), 
Genre varchar2 (20), 
Year number (4,0), 
AwardID number (10,0),
Rating varchar2 (4), 
QuantityPerUnit number (10,0), 
UnitsInStock number (10,0), 
Length number (10,0), 
MovieType varchar2 (20), 
DistributorID number (10,0)
constraint MovieID_PK primary key(MovieID),
constraint ActorID_FK foreign key (ActorID) references Actor(ActorID),
constraint AwardID_FK foreign key (AwardID) references Award(AwardID),
constraint DistributorID_FK foreign key (DistributorID) references Distributor(DistributorID),
constraint DirectorID_FK foreign key references Director(DirectorID));
4

1 回答 1

5

存在语法错误。DistributorID列后没有逗号

DistributorID number (10,0), -- Add comma here
于 2013-03-05T02:55:13.287 回答