Yelp / dataset-examples

Samples for users of the Yelp Academic Dataset
http://www.yelp.com/academic_dataset
Other
1.23k stars 615 forks source link

yelp_db.sql - Table "friend" should have two foreign keys #37

Open albertodelazzari opened 6 years ago

albertodelazzari commented 6 years ago

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

Does this make sense?

Thanks a lot.