"order by clauses" can create conflicts with each other?

2

Is it possible that if we have multiple clauses in order by , they are in conflict with each other? For example:

select candidato.nome
from candidato, perfil_oferta, prova_de_afericao
where candidato.bi = prova_de_afericao.cod_prova and
prova_de_afericao.nr_identificacao = perfil_oferta.nr_identificacao and 
prova_de_afericao.classificacao > 
(select avg(prova_de_afericao.classificacao) from prova_de_afericao)
order by 
        perfil_oferta.nr_identificacao DESC, 
        prova_de_afericao.cod_prova DESC, 
        candidato.nome ASC;

The result can not be simultaneously sorted according to the 3 clauses, so my question is whether there is any priority attached to the clauses, or how they are organized if it is not possible to arrange an order that satisfies the 3 clauses.     

asked by anonymous 19.11.2015 / 18:15

1 answer

4

If I understood your question correctly the answer is no.

In the ORDER BY clause, whoever is set first has priority.

Explaining using your example:

The bank will be sorted using the descending_profile.nr_identification profile.

If there is any conflict in the nr_identification field, then this conflict will be solved by ordering the cod_prova, also descending.

If there is conflict in both nr_identification and cod_prova, then the last criterion will be used for tiebreaker.

Note that the other sorts are only used when there is "conflict", so one will not influence the other to the point of conflict.

If you have any questions, you can refer to the following link link

    
19.11.2015 / 18:23