# Employee Salaries

Write a query that prints a list of employee names (i.e.: the *name* attribute) for employees in **Employee** having a salary greater than  per month who have been employees for less than  months. Sort your result by ascending *employee\_id*.

{% embed url="<https://www.hackerrank.com/challenges/salary-of-employees/problem?isFullScreen=true>" %}

Sol:

SELECT name FROM Employee WHERE salary > 2000 AND months < 10 ORDER BY employee\_id asc;

Explanation:

* SELECT name: This part of the query specifies that we want to retrieve the values from the name column of the Employee table.
* FROM Employee: This specifies the table from which we want to retrieve the data, which is the Employee table.
* WHERE salary > 2000 AND months < 10: This is a condition added to the query using the WHERE clause. It filters the rows in the Employee table so that only rows where the salary is greater than 2000 and the value in the months column is less than 10 are included in the result.
* ORDER BY employee\_id ASC: This part of the query specifies the order in which the results should be sorted. It orders the results in ascending order based on the values in the employee\_id column.

This query retrieves the names of employees from the Employee table where their salary is greater than 2000 and the value in the months column is less than 10. The results are then ordered in ascending order based on the employee\_id column.
