MySQL Forums
Forum List  »  Newbie

Re: How to normalize?
Posted by: Sergio Dann
Date: May 02, 2021 01:02PM

Hello, thank you for reply. I tried to explain my question, draw a simple DB. But it seems you even not tried to watch this screenshot. You prefer SQL query text from mysql workbench instead of screenshot?

There are 3 tables with expenses and just one table with payment records.
This payment table contains 3 FK to each of expenses tables.

I can not merge 3 expenses tables into one, don't want to make flat table.

But 3 foreign keys in payments table is also not ok.
There is additional control needed to be ensured that the some payment is linked with proper expense table.

Anomalies could be here : for example, one payment record can have 2 active foreign keys or all 3.
But just 1 of 3 is allowed by logic.

Few records with same FK value could be in sequence, but not a record with 2 or 3 filled FK in same time.

I want to get a solutions. Please.

Options: ReplyQuote


Subject
Written By
Posted
May 02, 2021 05:22AM
May 02, 2021 11:01AM
Re: How to normalize?
May 02, 2021 01:02PM
May 02, 2021 02:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.