Calculate Special Bonus II

ASKED IN INTERVIEW
2pts
Apple

Problem Statement

Apple HR is implementing a new performance-based bonus structure. The bonus for an employee is 50% of their salary if:

  1. Their employee ID is an even number.
  2. The length of their name is strictly greater than 5 characters.

If these conditions are not met, the bonus is 0.

Rules:

  • Output columns: employee_id, bonus.
  • Results must be sorted by employee_id in ascending order.
Tests your understanding of
Conditional Logic, String Functions and Arithmetic

Input Tables

employees
employee_id(INTEGER)name(VARCHAR)salary(INTEGER)
2Meghan3000
3Addison3800
7Kody7400
8Adryan6100
9Arun3400
employee_benefits
employee_id(INTEGER)has_insurance(BOOLEAN)
2true
8false
departments
dept_id(INTEGER)employee_id(INTEGER)
12
28

Expected Output

employee_id(INTEGER)bonus(DECIMAL)
21500
30
70
83050
90

Tags

EasyASKED IN INTERVIEWConditional LogicString FunctionsArithmetic
10-15 min
84%

Hints