Перечень статей   Терминология   Choose language


Сокращенная запись перестановки


В записях

Для записи перестановки предлагаю писать

select *
  from a, x
  where @a1~@x1 and @a2~@x1 and @a3~@x1;
вместо громоздкого выражения
select *
  from a
  where @a1<>@a2 and @a2<>@a3 and @a1<>@a3 and
    @a1 in (select @x1 from x) and
    @a2 in (select @x1 from x) and
    @a3 in (select @x1 from x);

Или например

select @a1,@b1,@c1
  from a,b,c, x
  where @a1~@x1 and @b1~@x1 and @c1~@x1;
вместо
select @a1,@b1,@c1
  from a,b,c
  where @a1<>@b1 and @b1<>@c1 and @a1<>@c1 and
    @a1 in (select @x1 from x) and
    @b1 in (select @x1 from x) and
    @c1 in (select @x1 from x);

В рациональном или xml-дереве

Если для дерева без спец-символов сокращенная запись перестановки

select *
  from a.b.c, x
  where a1~x1 and b1~x1 and c1~x1;
еще имеет громоздкий классический аналог
select *
  from a.b.c
  where a1<>b1 and b1<>c1 and a1<>c1 and
    a1 in (select x1 from x) and
    b1 in (select x1 from x) and
    c1 in (select x1 from x);
то сокращенная запись перестановки для дерева со спец-символами (что актуально для задачи коммивояжера) не имеет традиционных аналогов
select *
  from a.b*.c, x
  where b1~x1;
она означает, что-то вроде
select *
  from a.b[@b1 as k1].b[@b1 as m1].b[@b1 as n1].b[@b1 as p1].b[@b1 as q1].b[@b1 as r1].b[@b1 as s1]. ... .c
  where k1<>m1 and m1<>n1 and k1<>n1 and
    k1 in (select x1 from x) and
    m1 in (select x1 from x) and
    n1 in (select x1 from x) and
    p1 in (select x1 from x) and
    q1 in (select x1 from x) and
    r1 in (select x1 from x) and
    s1 in (select x1 from x) and ... ;

Тюрин Дмитрий



Перечень статей   Терминология   Choose language


Сайт управляется системой uCoz