Answers for "how to add foreign key in postgres table"

SQL
3

postgres add foreign key to existing table

ALTER TABLE tblA ADD COLUMN colA VARCHAR(10); /* 1st add column */
ALTER TABLE tblA ADD CONSTRAINT colA /* Make colA on tblA a foreign key */
FOREIGN KEY (colA) REFERENCES tblB (colB); /* colB must be a pk on tblB*/
Posted by: Guest on August-27-2021
4

postgres add foreign key to existing table

UPDATE student
SET name = institute.inst_name
FROM institute
WHERE student.student_id = institute.inst_id;
Posted by: Guest on August-19-2021

Code answers related to "how to add foreign key in postgres table"

Code answers related to "SQL"

Browse Popular Code Answers by Language