我已创建了4个其他表,但无法运行此表。我确定它与:
有关AgentID varchar2(4), CONSTRAINT FOREIGN KEY Riders_AgentId_FK REFERENCES Agents(AgentID)
但我不知道该改变什么......
CREATE TABLE Riders(
RiderID varchar2(4) CONSTRAINT Riders_RiderID_PK PRIMARY KEY ,
FirstName VARCHAR(255) CONSTRAINT Riders_FirstName_NN NOT NULL,
LastName VARCHAR(255) CONSTRAINT Riders_LastName_NN NOT NULL,
Street VARCHAR(255),
City VARCHAR(255),
State VARCHAR(255),
Zip varchar(255),
Phone varchar(255),
DateJoined DATE,
AgentID varchar2(4), CONSTRAINT FOREIGN KEY Riders_AgentId_FK REFERENCES Agents(AgentID),
TeamID varchar2(4)
);
答案 0 :(得分:0)
看一下这一行(约束的名称是在关键字CONSTRAINT
之后给出的:
AgentID varchar2(4) CONSTRAINT Riders_AgentId_FK FOREIGN KEY(AgentID) REFERENCES Agents(AgentID),
在:
CREATE TABLE Riders(
RiderID varchar2(4) CONSTRAINT Riders_RiderID_PK PRIMARY KEY ,
FirstName VARCHAR(255) CONSTRAINT Riders_FirstName_NN NOT NULL,
LastName VARCHAR(255) CONSTRAINT Riders_LastName_NN NOT NULL,
Street VARCHAR(255),
City VARCHAR(255),
State VARCHAR(255),
Zip varchar(255),
Phone varchar(255),
DateJoined DATE,
AgentID varchar2(4) CONSTRAINT Riders_AgentId_FK FOREIGN KEY(AgentID) REFERENCES Agents(AgentID),
TeamID varchar2(4)
);
其他几点说明:
NUMBER
(RiderID
,AgentID
,AgentID
Agents
表)varchar
字段可能应为varchar2