N
N
neomichi2016-11-20 13:11:19
SQL
neomichi, 2016-11-20 13:11:19

How to make such connection in sql?

How is it possible to link tables so that, for example, C.id is equal to either A.id or B.id , moreover, A.id does not match B.id
Of course, I know about triggers, but I wanted to do without them....

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Edward, 2016-11-21
@edb

Without them, in this particular case, nothing. You can't create a constraint with this kind of logic.

N
nApoBo3, 2016-11-22
@nApoBo3

According to the mind, for this you should make a third table in which all A.id and B.id will be entered. Or take such a restriction to a higher level of logic, or in software, or in a trigger.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question