1

In the ORDER BY clause, what impact does '5' have on the whole query output? I thought ORDER BY could only work in relations with DESC or ASC.

SELECT
employee_id,
first_name,
last_name,
hire_date,
salary
FROM
employees
WHERE
(salary * 1.5) < 15000
ORDER BY
hire_date, 5;

1
  • Which learning material do you use to prepare for this exam?
    – miracle173
    Mar 4 at 17:06

1 Answer 1

4

A number 'n' in the ORDER BY clause refers to the nth field in your SELECT clause.

In your example, number 5 refers to the salary column in the SELECT. It will therefore order by hire_date first, then on salary second.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.