I am doing an assignment for college that I can't seem to find an example of in our book for how to do properly.
In one of my tables I have two columns that are both primary keys and foreign keys
I have "invoice_number" that is part of my Primary Key and it is a Foreign Key in another table and I have "item_number" which is the other part of the Primary Key and is a Foreign Key in another table.
What is throwing me in the fact they are also foreign keys. For a composite PK I can just do
CONSTRAINT invoice_num_item_num_pk
PRIMARY KEY (invoice_number, itemnumber)
but I am not sure how to also setup the FK constraint and in what order it needs to be done.
In one of my tables I have two columns that are both primary keys and foreign keys
I have "invoice_number" that is part of my Primary Key and it is a Foreign Key in another table and I have "item_number" which is the other part of the Primary Key and is a Foreign Key in another table.
What is throwing me in the fact they are also foreign keys. For a composite PK I can just do
CONSTRAINT invoice_num_item_num_pk
PRIMARY KEY (invoice_number, itemnumber)
but I am not sure how to also setup the FK constraint and in what order it needs to be done.