English 中文(简体)
• 如何在非行中设计美国ER与FAVORITE(or LIKE)模式之间的关系
原标题:How to design the relations between USER and FAVORITE(or LIKE) models in DB

I have these models(tables): USER, PHOTO, BOOK, QUESTION etc. And now I wanna add the favorite or like feature to the site, that is user can like some photos or books or questions, and of course a photo can be liked by many users. So I wanna ask you how to implement this kind of thing.

a page to show the books, photos, quesitons etc which are liked by the current login user; how many people like the book.

这里我的想法很简单。

<><><>>>>

表格:books_users

书籍_iduser_id

表格:photos_users

照片_iduser_id

表格:questions_users

问题_iduser_id

<>B>。

表格:users_ similars

专栏类型为持有图书、照片信息。

A或B?

确实,我两人都在欧佩组织中试图在持有同样权利的物体之间建立继承关系。 但是,在数据对比方面,最好是把事情放在一个表(计划B)中,或保持其完整性(计划A)。 在非行的设计方面,我没有太多的经验,因此,请告诉我什么东西?

最佳回答

_model_01”/

这使用超型/次型关系。 关于另外几个类似的例子和解释:,见以下网址:

问题回答

暂无回答




相关问题
How to model a many-to-many relationship in App Engine?

I have a question regarding how to model a many-to-many relationship in App Engine: A Blogentry can have many tags, a tag can apply to many blog entries. I see a couple of scenarios: Use a Set of ...

How to emulate tagged union in a database?

What is the best way to emulate Tagged union in databases? I m talking about something like this: create table t1 { vehicle_id INTEGER NOT NULL REFERENCES car(id) OR motor(id) -- not valid ... } ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

How to best implement a 1:1 relationship in a RDBMS?

Yesterday while working on a project I came up on a peculiar 1:1 relationship which left me wondering - how to best implement this (clearly, we had done it wrong :D) The idea is that there are two ...

Automatic filling entity properties

I have some type an architect(?) question I develop an application, based on Spring and Hibernate (annotated configuration) For each table in my database I added 4 fields: createdBy and modifiedBy(...