Last active
June 9, 2016 09:55
-
-
Save oliviermarin/50ed04815d33000b80d28f85f7726bf6 to your computer and use it in GitHub Desktop.
SQL | PostrgreSQL | Add a FOREIGN-KEY column in table t1 from table t2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE t1 | |
ADD COLUMN t1_fk INTEGER DEFAULT 1, | |
ADD FOREIGN KEY(t1_fk) REFERENCES t2(t2_pk); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment