Hi, I loaded Yelp dataset into MySQL and I inferred the schema from it.
According to my understanding of the schema, the table "friend" should be a join table joining a user to another friend (user).
So I expected to have two foreign keys one starting from 'friend.user_id' and pointing to 'user.id' and the second one starting from 'friend.friend_id' and pointing to 'user.id' as well.
CONSTRAINT `fk_friends_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_friends_user2` FOREIGN KEY (`friend_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
Hi, I loaded Yelp dataset into MySQL and I inferred the schema from it. According to my understanding of the schema, the table "friend" should be a join table joining a user to another friend (user). So I expected to have two foreign keys one starting from 'friend.user_id' and pointing to 'user.id' and the second one starting from 'friend.friend_id' and pointing to 'user.id' as well.
Does this make sense?
Thanks a lot.