Procedure to update salary
SQL
Easy
3 views
Problem Description
Create procedure sp_hike_salary(p_emp_id, p_percent) that increases salary for that employee.
Input Format
SQL procedure
Output Format
Procedure created
Sample Test Case
Input:
Employees(emp_id, salary)
Output:
Procedure created
Constraints
Assume employee exists
Official Solution
CREATE PROCEDURE sp_hike_salary(IN p_emp_id INT, IN p_percent DECIMAL(5,2)) BEGIN UPDATE Employees SET salary = salary + (salary * p_percent / 100) WHERE emp_id = p_emp_id; END;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!