Question

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()
);
Was it helpful?

Solution

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)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top