HackerRank TOP 20 SQL Interview 7. Salary Review — MAANG question

Amber Ivanna Trujillo
3 min readDec 8, 2022

Time to complete — 29 minutes

Question Type = Medium

Asked in = Microsoft, Uber, Lyft, Bloomberg, Morgan Stanley, Apple, and Google.

Skills: PLSQl, loop statements, control structures, using explicit cursors

Insights — It should be read very carefully read and you must ask questions in between.

Question —

Write a PL/SQL block to increment Employees’ salaries by 10% with the following exceptions:

  • If the salary is already above the maximum salary for the employee’s grade, the salary remains unchanged.
  • If the increment would take the salary above the maximum salary for the employee’s grade, the salary is set at the maximum salary for the grade.

Display employee ID, employee name, current salary, and new salary each separated by a single space. Sort the results ascending by employee ID.

Job Grade Table

Store the job grade table into a collection variable.

Schema

There is 1 table: EMPLOYEES.

--

--

Amber Ivanna Trujillo
Amber Ivanna Trujillo

Written by Amber Ivanna Trujillo

I am Executive Data Science Manager. Interested in Deep Learning, LLM, Startup, AI-Influencer, Technical stuff, Interviews and much more!!!

No responses yet