If many-to-many relationships define anything other than a relationship

Assuming the typical many-to-many relationship between categories, you usually have a relationship like:

table -- ProductsCategories
column - ProductId
column - CategoryId

Is it not recommended to add other properties to these relationships, things that exist only in these specific relationships. For example (please forgive my scary examples, I'm not very good at examples):

table -- ProductsCategories
column - ProductId
column - CategoryId
column - DiscountForProductsInThisCategory
column - CategoryImageForProductsInThisCategory
+3
source share
7 answers

A many-to-many relationship is just a table with two relationships from one to many, think of it as three tables with 2 relationships, rather than two tables with relations and data associated with it. There is no difference in implementation.

In any case, this is perfectly acceptable.

+6

, , . . , , , , , , .

+6

, . , .

+5

, . AthleteRace , .

:

column - DiscountForProductsInThisCategory
column - CategoryImageForProductsInThisCategory

Category, , .

+3

, .

, . DiscountForProductsInThisCategory 1:1 PK , . ProductCategory .

1:1 (ProductId + CategoryId), ProductCategory.

+2

.

, . .

"" . , , , (StudentID, CourseID). , , , .

+1

, . , , , , , .

0

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


All Articles