MySQL: Two foreign keys in one table referring to another table
问题 I've come across something that seemed simple before but has me scratching my head again. I have a table for users: user_id (PK) | username| email | something ... and a table for "views" for when one user has viewed another user: view_id (PK) | viewer_id | viewed_id | view_date The "viewer_id" and "viewed_id" are both user_ids, allowing me to search separately for instances when a user was the viewer or the one being viewed. I initially thought that both of these columns would be foreign keys