You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
483 B
SQL

/*Write a query to display the employee id, name ( first name and last name ), salary and the SalaryStatus column with a title
HIGH and LOW respectively for those employees whose salary is more than and less than the average salary of all employees.
*/
SELECT employee_id, first_name, last_name, salary,
CASE WHEN salary >=
(SELECT AVG(salary)
FROM employees) THEN 'HIGH'
ELSE 'LOW'
END AS SalaryStatus
FROM employees;