CREATE TABLE employee (
empid INT PRIMARY KEY,
fname VARCHAR2(50),
lname VARCHAR2(50)
);
CREATE TABLE manager (
mgrid INT
REFERENCES employee ( empid )
);
CREATE TABLE barista (
baristaid INT
REFERENCES employee ( empid ),
mgrid INT
REFERENCES manager ( mgrid )
);
Для таблицы бариста выдает ошибку,
ORA-02270: no matching unique or primary key for this column-list
02270. 00000 - "no matching unique or primary key for this column-list"
*Cause: A REFERENCES clause in a CREATE/ALTER TABLE statement
gives a column-list for which there is no matching unique or primary
key constraint in the referenced table.
*Action: Find the correct column names using the ALL_CONS_COLUMNS
catalog view
Я тоже пробовал,
ALTER TABLE barista
ADD CONSTRAINT fk_mgrid FOREIGN KEY ( mgrid )
REFERENCES manager ( mgrid );
Но я получил ту же ошибку. Подскажите, пожалуйста, что не так? Спасибо вам заранее.