SQL database relationships: unable to determine between manyToMany and oneToMany

Deadly 提交于 2021-01-29 18:34:48

问题


I have two database tables "Users" and "Transactions" where the "Transactions" table looks like below. The "Transactions" table has a record of each transaction between two accounts where the differentiator is "senderAccount" and "recipientAccount" columns.

id | transactionId | senderAccount | recipientAccount | Amount |
—--+---------------+---------------+------------------+--------+
 1 | ijiej33       |      A        |         B        |   100  |  

The relationship between "Users" and "Transactions" is one to many since every user can have multiple transactions, but is the relationship between "Transactions" and "Users" table also many to many since a single record is owned by two users which are the sender and recipient?

来源:https://stackoverflow.com/questions/65870087/sql-database-relationships-unable-to-determine-between-manytomany-and-onetomany

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!