1

schema

One question, I have supervisor set as foreign key. He collect information through Activity Participant and take it from person ID.

Question:

How should I create the Activity table? what do I have to write down about supervisor?

CREATE TABLE activity
(
act_id VARCHAR(8) CONSTRAINT activity_pk PRIMARY KEY,
act_type VARCHAR2(20),
act_desc VARCHAR2(30),
act_date DATE,
mor_aft VARCHAR2(9),
CONSTRAINT activity_sup_fk FOREIGN KEY (act_supVisor) REFERENCES person()
);
Andriy M
  • 76,112
  • 17
  • 94
  • 154
Denis Nurasy
  • 41
  • 1
  • 8

1 Answers1

2

A foreign key must reference a unique key of the referenced table. Either the table's primary key, or else a secondary unique key.

CONSTRAINT activity_sup_fk FOREIGN KEY (act_supVisor) 
  REFERENCES person(Person_id)
Bill Karwin
  • 538,548
  • 86
  • 673
  • 828