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 =>时,关系必须在具有相同数据类型的相同数量的字段上。包
thanx
答案 0 :(得分: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
);