반응형

@notepad_jj2

츄르사려고 코딩하는집사입니다.


1. [HackerRank] Employee Salaries 오라클(Oracle)

 

2. 문제 출처

https://www.hackerrank.com/challenges/salary-of-employees/problem

 

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

 

3. 문제

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.

Input Format

The Employee table containing employee data for a company is described as follows:

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

Sample Output

Angela Michael Todd Joe

Explanation

Angela has been an employee for  month and earns  per month.

Michael has been an employee for  months and earns  per month.

Todd has been an employee for  months and earns  per month.

Joe has been an employee for  months and earns  per month.

We order our output by ascending employee_id.

 

4. 풀이

- 이 문제는 EMPLOYEE라는 테이블에서 SALARY가 2000보다 크고, MONTHS가 10보다 작은 이름을 출력하면 된다.

- 정렬은 EMPLOYEE_ID를 기준으로 오름차순으로 정렬하면 된다.

 

5. 소스 코드

 

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

 


반응형
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기