Bạn tham khảo đoạn này xem có đúng ý bạn không nhé.
QUOTE
CREATE TABLE DEPT (
DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY,
DNAME VARCHAR2(14) ,
LOC VARCHAR2(13)
);
CREATE TABLE EMP (
EMPNO NUMBER(4) CONSTRAINT PK_EMP PRIMARY KEY,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
HIREDATE DATE,
DEPTNO NUMBER(2) CONSTRAINT FK_DEPTNO REFERENCES DEPT
);
DEPTNO is a primary key for table DEPT and all values of this column are unique; on the other side, DEPTNO is a foreigh key for table EMP and it point on table DEPT, so this column can contain only values that listed in table DEPT.