[英]If I have 2 tables that must have many-to-many relationship to a tags table, do I need 2 intermediate tables?
Let's say I have 3 tables - images
, videos
and tags
. 假设我有3个表格-
images
, videos
和tags
。 Currently I have only one intermediate table called tag_image
which stores the relation between images and tags. 目前,我只有一个名为
tag_image
中间表,该表存储图像和标签之间的关系。 Do I need a second tag_video
intermediate table for the relationships between my videos and tags, or could I alter the tag_image
table and make it useable by both? 我是否需要第二个
tag_video
中间表来了解我的视频和标签之间的关系,还是可以更改tag_image
表并使两者均可用?
If I have 2 intermediate tables, would I be able to create a view and display all images AND videos that have a certain tag? 如果我有2个中间表,是否可以创建视图并显示具有特定标签的所有图像和视频?
Since there is a many to many relationship you will have to have to a separate table to keep the tag and video relationship. 由于存在多对多关系,因此必须保留单独的表格来保持标签和视频的关系。
Otherwise you will be having repetitive data in the tag_image
table. 否则,您将在
tag_image
表中包含重复数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.