Relationship between tables with two foreign keys

Cretu Eusebiu

I have a users(id) table and a friends(user_id1, user_id2) where user_id1 and user_id2 are both foreign keys to the users table.

What relationship is this ?

I think is One to Many, but since I have the user id two times it's a bit confusing. (I have to make a diagram and don't know what relationship to use).

xmojmr

This UML class diagram describes the situation (yuml.me script (click to edit))

enter image description here

In UML terms the line's name is navigable association with known multiplicity.

In order to draw a diagram you don't need to give the relationship another "name"

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

two foreign keys to same primary key select statement MYSQL

来自分类Dev

Joining two tables with one table having a different foreign key

来自分类Dev

Postgresql: How to relate data between two tables?

来自分类Dev

SQLite with NULLABLE foreign keys

来自分类Dev

SQL SELECT between two non-joinable tables

来自分类Dev

The relationship between SelectionDAG and SelectionDAGISel

来自分类Dev

即使Foreign_keys为ON,FOREIGN KEY约束也会失败

来自分类Dev

烧瓶foreign_keys仍然显示AmbiguousForeignKeysError

来自分类Dev

AmbiguousForeignKeysError 即使在指定 foreign_keys 之后

来自分类Dev

Is there any way to find out the tables relationship?

来自分类Dev

What is the relationship between the PhantomReference and ReferenceQueue?

来自分类Dev

Trying to add a foreign relationship to my users model with Devise, then update it

来自分类Dev

Symfony 2.3 Join tables using composite keys

来自分类Dev

Flask-SQLAlchemy-模型没有属性“ foreign_keys”

来自分类Dev

django“ use_natural_foreign_keys = True”问题

来自分类Dev

链接表中的SQLAclhemy foreign_keys错误[Flask]

来自分类Dev

Can't link two tables?

来自分类Dev

Two inner joins with same tables

来自分类Dev

Create ID automatically for all entries into tables with same foreign key

来自分类Dev

Designing a relationship between documents in Couchbase/CouchDB?

来自分类Dev

Check if two arrays share any common keys

来自分类Dev

Quickly merge tables with keys that are one-to-one and onto

来自分类Dev

Memory Management for Lookup Tables with string keys in C++

来自分类Dev

Entity framework one-to-many relationship - how to rename foreign key name when it is named Id?

来自分类Dev

Trying to insert into two tables using php and mysqli

来自分类Dev

Codeigniter, join of two tables with a WHERE clause

来自分类Dev

MySQL SELECT from two tables with COUNT

来自分类Dev

sqlite:如何在iOS中启用外键(PRAGMA foreign_keys始终返回0)

来自分类Dev

Laravel 6 PHPUnit测试-找不到驱动程序(SQL:PRAGMA foreign_keys = ON;)

Related 相关文章

  1. 1

    two foreign keys to same primary key select statement MYSQL

  2. 2

    Joining two tables with one table having a different foreign key

  3. 3

    Postgresql: How to relate data between two tables?

  4. 4

    SQLite with NULLABLE foreign keys

  5. 5

    SQL SELECT between two non-joinable tables

  6. 6

    The relationship between SelectionDAG and SelectionDAGISel

  7. 7

    即使Foreign_keys为ON,FOREIGN KEY约束也会失败

  8. 8

    烧瓶foreign_keys仍然显示AmbiguousForeignKeysError

  9. 9

    AmbiguousForeignKeysError 即使在指定 foreign_keys 之后

  10. 10

    Is there any way to find out the tables relationship?

  11. 11

    What is the relationship between the PhantomReference and ReferenceQueue?

  12. 12

    Trying to add a foreign relationship to my users model with Devise, then update it

  13. 13

    Symfony 2.3 Join tables using composite keys

  14. 14

    Flask-SQLAlchemy-模型没有属性“ foreign_keys”

  15. 15

    django“ use_natural_foreign_keys = True”问题

  16. 16

    链接表中的SQLAclhemy foreign_keys错误[Flask]

  17. 17

    Can't link two tables?

  18. 18

    Two inner joins with same tables

  19. 19

    Create ID automatically for all entries into tables with same foreign key

  20. 20

    Designing a relationship between documents in Couchbase/CouchDB?

  21. 21

    Check if two arrays share any common keys

  22. 22

    Quickly merge tables with keys that are one-to-one and onto

  23. 23

    Memory Management for Lookup Tables with string keys in C++

  24. 24

    Entity framework one-to-many relationship - how to rename foreign key name when it is named Id?

  25. 25

    Trying to insert into two tables using php and mysqli

  26. 26

    Codeigniter, join of two tables with a WHERE clause

  27. 27

    MySQL SELECT from two tables with COUNT

  28. 28

    sqlite:如何在iOS中启用外键(PRAGMA foreign_keys始终返回0)

  29. 29

    Laravel 6 PHPUnit测试-找不到驱动程序(SQL:PRAGMA foreign_keys = ON;)

热门标签

归档