Mat*_*ijs 4 sql database-design relational integrity
我正在为我的食谱设计一个数据库。我在我的设计中创建了多个表格:书籍、作者、食谱、成分,对于所有这些项目,我想将媒体(图像或视频)链接到所有这些表格中的项目。
我在想这样的设计:
media_id,
rid (primary key of foreign table),
rtype (1=book, 2=author, 3=recipe, 4=ingredient),
media_type(1=image,2=video),
media_url
Run Code Online (Sandbox Code Playgroud)
但是我将如何确保关系完整性?
谢谢