Home > Net >  What is '-' in front of a column in mysql mean?
What is '-' in front of a column in mysql mean?

Time:10-13

What is the significance of "-" (Last line of the code, before a.emp_no) in the following code? I have been trying to understand but I want sure answers. Please Help!!!!!!!!!!!!!!!!!!

SELECT *
FROM
(SELECT
    e.emp_no,
    e.first_name,
    e.last_name,
    NULL AS dept_no,
    NULL AS from_date
FROM
    employees.employees e
WHERE
    last_name = 'Denis' 
UNION SELECT
    NULL AS emp_no,
    NULL AS first_name,
    NULL AS last_name,
    dm.dept_no,
    dm.from_date
FROM
   employees.dept_manager dm) as a
ORDER BY -a.emp_no DESC;

CodePudding user response:

if emp_no is a number - then it is asking to order by the negative of the number. you could also say

order by a.emp_no
  • Related