谁能告诉我这里有什么问题?

时间:2018-02-01 01:24:00

标签: sql oracle

谁能告诉我这里有什么问题?

从命令行中的第15行开始出错 -

CREATE TABLE USERINSC521SP18_EAA52.EmployeePhone
(
    EmployeeID int,
    EmployeePhone varchar(30) NOT NULL,
    Primary key (EmployeeID),
    EmployeeID int REFERENCES Employee(EmployeeID) on DELETE NO ACTION
)

错误:

  

ORA-00957:重复列名称
  00957. 00000 - “重复列名”

     

*原因:
  *行动:

2 个答案:

答案 0 :(得分:0)

你似乎想要:

CREATE TABLE USERINSC521SP18_EAA52.EmployeePhone (
    EmployeeID int primary key references Employee(EmployeeID) on DELETE NO ACTION,
    EmployeePhone varchar(30) NOT NULL
);

但为什么不将EmployeePhone存储在Employee

答案 1 :(得分:0)

应:

EmployeeID int REFERENCES Employee(EmployeeID) on DELETE NO ACTION)

是,

FOREIGN KEY(EmployeeID) REFERENCES Employee(EmployeeID) on DELETE NO ACTION)