Reputation: 7249
I have a simple database design. It has entities: User
Place
Review
. Basically a user can post a place (location of some place) and a user can post a review. Right now i have a ternary relationship between the 3 to be able to post a review about a place by a user.
It's like
User
---- <post>
---- Review
and Place
---- <post>
---- User
So, it's a 3 way.
First of all is the correct usage? As in, can i do that? I don't really care if it's not the best way, I just want to know if that is legit?
Second, i made Review
a weak entity, but how can I make it so it takes the primary key of User and the primary key of Places? If i make it a weak entity will it automatically accept both of their primary ids?
Thanks!
Upvotes: 1
Views: 2654
Reputation: 9340
First of all is the correct usage? As in, can i do that? I don't really care if it's not the best way, I just want to know if that is legit?
No to my eyes, as I see you connect place to itself in the 2nd relation. I assume it's a typo and you mean User
----<post>
----Place
.
Second, i made Review a weak entity, but how can I make it so it takes the primary key of User and the primary key of Places? If i make it a weak entity will it automatically accept both of their primary ids?
The requirement is missing a couple of important things, such as:
etc., so it's a bit difficult to give exact answer.
One example with the following assumptions:
You could create this relation:
User(m)--<post>--(n)Place
|
|
Review
If you explain a bit more maybe I could lead you to the expected solution.
Upvotes: 0