Prepare > SQL > Basic Select > Employee Salaries

2023. 7. 14. 19:53HackerRank-My SQL

 

Employee Salaries | HackerRank

Print the names of employees who earn more than $2000 per month and have worked at the company for less than 10 months.

www.hackerrank.com

 

문제


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

 

 

 

 

코드


SELECT NAME FROM EMPLOYEE
WHERE salary > 2000 AND months < 10;

 

 

두 번째 시도

SELECT NAME FROM EMPLOYEE
WHERE SALARY > 2000 AND MONTHS < 10
ORDER BY EMPLOYEE_ID;