I\'m a bit of a newbie and I can\'t get my head around primary keys as foreign keys. To me, foreign keys are meant to connect two rows of a table together. Therefore, it wou
I think you can have the foreign key point to any column (or columns), if there is an index created with those columns at the beginning.
Try executing
CREATE INDEX user_username_idx ON user(username);
and then creating your foreign key should work.