简体   繁体   中英

Two foreign keys referencing to one primary key - what relation?

I have problem related to my database. I have user table, which I don't think I need to explain but then i got game table. After each game it will save record of which user was winner and which was loser. What type of relation should I use? I was thinking about many to many. User can have many games and also ech game can have same user winning multiple game as well as losing many games.

Am I right?

在此处输入图片说明

A foreign key is a column or a set of columns in one table that references the primary key columns in another table. The primary key is defined as a column (or set of columns) where each value is unique and identifies a single row of the tabl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM