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;
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
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