I am trying to design a table to store references to multiple tables as a target of the item in each row.An example should clarify what I am trying to do:Imagine you have 4 tables (images, videos, comments, likes)with likes being similar toCREATE TABLE `likes``target` int(11),`user_id` int(11),`created_at` timestampHow do you make it so the target could be a row of images, videos or comments (eg, you like an image, video or comment)Also how would you go about representing this within your code? (abstract class Like and concrete classes for LikeImage, LikeImage, LikeComment?) or maybe have an interface ILikeable  and then the Like object has a ILikeable object on hand?I'm running into this pattern more and more often making things such like (like an object) or subscribing (subscribe to changes on an object) to various targets and generating notifications (notify a user of a change on an object) that are generically able to target objects.Thanks for sharing your knowledge. Update:: Is there a nosql way to easily achieve this?
How to genericize foreign key references in table?
design patterns;sql;database design