문제

create table Employee(E_ID char(15) PRIMARY KEY,name char(15),salary char(12), CONSTRAINT a_I FOREIGN KEY(L_ID) REFERENCES Department(D_id), constraint r_N FOREIGN KEY(M_ID)REFERENCES manger(M_ID))

도움이 되었습니까?

해결책

You don't have columns in this table called l_id or m_id, so I'm guessing it's reporting that in the error you haven't shown. You have to define the columns explicitly, before using them as foreign key references. I'm guessing they are both numbers, but use the appropriate data types from the other tables if not:

create table Employee(E_ID char(15) PRIMARY KEY,
  name char(15),
  salary char(12),
  l_id number,
  m_id number,
  CONSTRAINT a_I FOREIGN KEY(L_ID) REFERENCES Department(D_id), 
  constraint r_N FOREIGN KEY(M_ID)REFERENCES manger(M_ID)
)

This is shown in the documentation, including the foreign key example.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top