我检查了所有列名称,尝试删除该列并添加一个新列,但是我仍然收到此错误。我的SQL查询有问题吗?
ORA-00904:“ DEPT_ID”:无效的标识符
alter table Employ add foreign key (Dept_Id) references Department(Dept_ID);
答案 0 :(得分:2)
类似这样的东西:
SQL> create table department (dept_id number primary key);
Table created.
SQL> create table employ (id number primary key,
2 dept_id number);
Table created.
SQL> alter table employ add constraint fk_ed foreign key (dept_id)
2 references department (dept_id);
Table altered.
SQL>