Last answered:

16 Dec 2021

Posted on:

06 Nov 2021

0

Regarding assignment on UNION:

Does that  "-"  after ORDER BY clause mean the inverse of DESC?

3 answers ( 0 marked as helpful)
Posted on:

06 Nov 2021

0

yeah i think that too.
it changes the DESC output to AES only to number but kept NULL at the bottom.

Posted on:

08 Nov 2021

1

The minus sign "-" basically sorts the result set based on the negation of the contents of the column (I guess it will work best if the column contains numeric or date values). Hence when you convert the emp_no values to be negative, -13009 will be greater than -50720 for instance; sorting them in descending order will put them in ascending order and still keep the NULL values at the bottom since they were initially ordered DESC.
This is as far as I understand. Also, this technique makes the query slower.

Instructor
Posted on:

16 Dec 2021

3

Hi Meenakshi, Yogesh and AbdElrahman!
Thanks for reaching out.

The meaning is that it reverses the order you chose and places the non-null values up front in the result set.

Hope this helps.
Best,
Tsvetelin

Submit an answer