Write a query that prints a list of employee names (i.e.: the name attribute) for employees in Employee having a salary greater than $2,000 per month who have been employees for less than 10 months. Sort your result by ascending employee_id.
Input Format
The Employee table containing employee data for a company is described as follows:
![](https://blog.kakaocdn.net/dn/bBAZ0a/btsIZ0jlTXg/FFKUOZtGfXTMpyHEYptP0k/img.png)
where employee_id is an employee's ID number, name is their name, months is the total number of months they've been working for the company, and salary is the their monthly salary.
Sample Input
![](https://blog.kakaocdn.net/dn/eaTisd/btsI0ZDy2Kx/lxRAgBwZ2UNINv7jouOwmK/img.png)
Sample Output
Angela
Michael
Todd
Joe
Explanation
Angela has been an employee for 1 month and earns $3,443 per month.
Michael has been an employee for 6 months and earns $2,017 per month.
Todd has been an employee for 5 months and earns$3,396 per month.
Joe has been an employee for 9 months and earns $3,573 per month.
We order our output by ascending employee_id.
SELECT
NAME
FROM
EMPLOYEE
WHERE
SALARY > 2000
AND
MONTHS < 10
'SQL > HackerRank' 카테고리의 다른 글
[MySQL/HackerRank] The PADS (0) | 2024.08.11 |
---|---|
[MySQL/HackerRank] Type of Triangle (0) | 2024.08.11 |
[MySQL/HackerRank] Employee Names (0) | 2024.08.11 |
[MySQL/HackerRank] Higher Than 75 Marks (0) | 2024.08.11 |
[MySQL/HackerRank] Weather Observation Station 12 (0) | 2024.08.11 |