1

Topic: The help in request writing

People knowing, help ignorant with the task decision.
For search % under the contract tables T1, T2, T3 if ID contracts is present at several tables the commission undertakes from the table with smaller number (the data in T1 more priority T2 are viewed, 2 is more priority 3). Table T4 contains numbers of all contracts and their correspondence with ID. To write the request returning numbers of contracts and value of the commissions on them.
The screen of the task with tables is attached.

2

Re: The help in request writing

SELECT t4.dog_nom, COALESCE (t1.commis, t2.commis, t3.commis) commis
FROM t4
NATURAL LEFT JOIN t1
NATURAL LEFT JOIN t2
NATURAL LEFT JOIN t3
WHERE t4.dog_nom IN (123, 456, 789)

3

Re: The help in request writing

Akina, thanks for the answer, but request do not deduce desirable result. On an output it is had "Empty set" sad

4

Re: The help in request writing

Rewrite NATURAL JOIN on the normal conditional.

5

Re: The help in request writing

Akina, there is no same result. An empty dial-up. Used LEFT JOIN T1 USING (Dog_id) etc. or I not so understood. Whether generally it is possible to appropriate to values NULL the data from other table (as on a picture)

6

Re: The help in request writing

Not USING, a LEFT JOIN... ON.

7

Re: The help in request writing

USING and ON after all one and too as a matter of fact. The empty dial-up produces

8

Re: The help in request writing

SergeyKalmykov wrote:

USING and ON after all one and too as a matter of fact.

Is not present. If tables more than 2 (just your case), it is not known, the field what of tables will be used at binding of the third with a sheaf +. Whereas in ON the table is underlined explicitly.
And in your case is still worse - NATURAL can connect tables on TWO fields. Names and types coincide...