SELECT
department_name,
first_name,
last_name,
salary
FROM
(
SELECT
department_name,
ROW_NUMBER() OVER (
PARTITION BY department_name
ORDER BY salary DESC) row_num,
first_name,
last_name,
salary
FROM
employees e
INNER JOIN departments d
ON d.department_id = e.department_id
) t
WHERE
row_num = 1;
Here, what is the meaning of alias as it is running without alias as well…everywhere…as whether we write d.department_name or directly write department name it is not showing any error…what is the purpose of alias…also we are giving alias to table t but we directly access the row_num without using alias…??
But if not provide then definitely give error of not providing alias