1
Create Table Person (
ID integer primary key
, [name] character(15) not null 
, address character(15)
, phone integer
);

Create Table Surveyor (
 surveyID integer 
 , certificationDate Datetime 
 , ID integer 
 , primary KEY (surveyID,ID)
 , FOREIGN KEY (ID) REFERENCES Person
 );

 Create Table Points (
 PntID integer primary key
 , N float not null
 , E float not null
 , Height float not null
 );

 Create Table Polygon (
polyID integer primary key 
, area float not null 
 , atleastonepoint integer not null
, foreign key (atleastonepoint) references Points(PntID)
 , check (area > 0)
);



Create Table Block (
blockID integer 
, blockName  character (15) not null
, polyID integer 
, polyLength float not null
  , primary KEY (blockID,polyID)
, onemunicipalAuthority character (15) not null
, foreign key (polyID) references polygon
  , check (polyLength > 0)
);


Create Table Parcel (
  parcelname character (15) 
  , blockID integer 
, polyID integer 
  , primary KEY (parcelname,blockID,polyID)
, foreign key (polyID) references polygon
, foreign key (blockID) REFERENCES block 
);

错误:关系必须在具有相同数据类型的相同数量的字段上,当我尝试实现最后一个时,CREATE => Parcel

提前谢谢

4

1 回答 1

1

试试这个命令:

Create Table Parcel (
  parcelname character (15) 
  , blockID integer 
, polyID integer 
  , primary KEY (parcelname,blockID,polyID)
, foreign key (polyID) references polygon
, foreign key (blockID,polyID) REFERENCES block 
);
于 2012-11-25T20:20:38.730 回答