How Can I Reference Multiple Primary Keys For A Vector Type Primary Key

Posted by AndreiC on Stack Overflow See other posts from Stack Overflow or by AndreiC
Published on 2010-04-19T20:25:34Z Indexed on 2010/04/19 20:43 UTC
Read the original article Hit count: 267

Filed under:

Hi, I have the following scenario: a table of projects and a table of persons, working on one or serveral projects. Also, I have a project id column (of type int), in the first table, which is a primary key there and I have a vector of project ids, as a column of type int, in my second table (persons), that references primary keys from the first table.

What is the correct syntax for referencing multiple primary keys, from a vector foreign key. This is the way I am trying to create the table, but I am not sure what to place at the indicated line:

CREATE TABLE Persons(
    Person_Id int,
    ...,
    ProjectsList int[],
    FOREIGN KEY (ProjectsList) REFERENCES Projects(Project_id) -- not sure what how to define the link here
);

I hope my explanations are not over-complicated. Thank you in advance for helping!

© Stack Overflow or respective owner

Related posts about sql