I have a composite primary key in 1 table in oracle. I want to create a foreign key for one table entry in my second table that references the composite primary key in the firs
CREATE TABLE groupspersonx(
personid number, groupid number,
CONSTRAINT pk_persongroupid PRIMARY KEY(personid, groupid));
CREATE TABLE restrictedgroups (
pid number,
groupid number,
name varchar2(50),
dateadded date,
since date,
notes varchar2(1024),
CONSTRAINT pk_groupid PRIMARY KEY(groupid),
CONSTRAINT fk_persongroup FOREIGN KEY(pid,groupid) REFERENCES groupspersonx(personid, groupid));
* number of references columns is equals with foreign key columns