Does the table consist of foreign keys?

I am very new to databases and I am new to data abstraction coming from Java. To teach myself, I am working on an online application that, among other things, will allow users to be part of several groups.

Having sketched the database, it looks like I will need something like a Membership table:

UserID|GroupID
------|-------
  1   |   1
  1   |   2
  2   |   1
  2   |   3
  2   |   5

I am a little wary of this, since it contains only two foreign keys and serves only to connect two objects. Is this standard practice such a relationship? If not, what is the preferred method?

Again, I am very new to databases. My book does not mention such a situation, therefore, if there is any keyword that reflects this function, which I forgot ...

Thank.

+4
2

" " " " ( " " ).

, UserID, GroupID , . ( ), :

  • () {UserID, GroupID}. , , . UserID ( ), GroupID, , B-tree, .
  • () {GroupID, UserID}. , . (.. ) (1)).
  • {UserID, GroupID} () {GroupID, UserID} ( ). , : , .
  • (1) (2) (3) , (, {UserGroupID}). , "" , , , . , ORM .

(1) (2), cluster ( ). , , . (3), covering, .

+5

Source: https://habr.com/ru/post/1539305/


All Articles