Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Stuck and need your help in a relational schema
Post Flair (click to view more posts with a particular flair)
Post Body

I have 3 tables : Purchases, Payments and Sellers. And these are the constraints: - A purchase has 1 seller - A payment has 1 seller - A payement can have 1 or many purchases (purchases that have the Same Seller) - A purchase can have 0 or many payments (Partial payments)

I've tried 2 solutions but both of them could have tuples in the database that do not respect the previous constraints.

What is the right and correct relational schema for this case? Thanks in advance !

Edit : I will try to elaborate my problem more : There is a many-to-many relationship between Purchases and Payments, this will give us another Intermediate table we will name Purchase_Payment. in this case it's possible to have tuples in this table in which the Seller of the Payment is different than the Seller of the Purchase (Even though it would be practically impossible to happen as in the UI of my app, I will force the user to choose a Seller before making a payment. But in theory it's possible to have such an inacceptable tuple in my intermediate table which made me think that maybe I have a wrong relational schema). I hope that the problem is more understandable now

Author
Account Strength
70%
Account Age
3 years
Verified Email
Yes
Verified Flair
No
Total Karma
129
Link Karma
41
Comment Karma
41
Profile updated: 6 days ago
Posts updated: 19 hours ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago