Ive just seen the following syntax : select * from table order by column = "b" desc
I guess that the rows with value “b” will come first but i am not sure.
What does the query mean and how sorting works in this case.
Ive searched on google about it but … no success.
In SQL, you are not limited by sorting on values of existing columns: you can specify complex expressions inside your
order byclause. This query sorts by the value of a boolean expression: the expression will be true for the rows wherecolumn = 'b', andfalsein all other rows. As the result, rows with column = ‘b’ will come first, because theorder byclause specifies descending order, and in SQL,trueis represented as 1, andfalseis 0.