All the records which has no relation with the key

[b]query1[/b]

select t
from tag

[b]result1[/b]

1
2
3
4
5
7
9

The query1 above produces the result1 above.
The query2 below produces the result2 below.

[b]query2[/b]

select t1,t2
from relate

[b]result2[/b]

(t1) (t2)
(1)  (2)
(4)  (5)
(7)  (4)

I like to produce like the following.

when key is (1),
it produces all the records which has no relation with the key (1) in relate table.
It will be (3),(4),(5),(7),(9).

when key is (2),
it produces all the records which have no relation with the key (2) in relate table.
It will be (3),(4),(5),(7),(9).

when key is (3),
it produces all the records which has no relation with the key (3) in relate table.
It will be (1),(2),(4),(5),(7),(9).

when key is (4),
it produces all the records which has no relation with the key (4) in relate table.
It will be (1),(2),(3),(9).

when key is (5),
it produces all the records which has no relation with the key (5) in relate table.
It will be (1),(2),(3),(7),(9).

when key is (7),
it produces all the records which has no relation with the key (7) in relate table.
It will be (1),(2),(3),(5),(9).

when key is (9),
it produces all the records which has no relation with the key (9) in relate table.
It will be (1),(2),(3),(5),(6),(7).

Can’r think of a simpler way

select t1.t from table1 t1
 where (t1.t not in (select r.t1 from relate r where r.t2 = N))
   and (t1.t not in (select r.t2 from relate r where r.t1 = N))
   and (t1.t <> N)

Where N is the value of the key.

Your values for key=9 do not seem right.