Medium sql

MySQL stored procedure raise #14

Problem

MySQL: MySQL stored procedure raise #14

Hints
  • Use MySQL docs syntax for LIMIT and functions

Your practice code

Ready — edit the code above and click Run.

Solution

DELIMITER //
CREATE PROCEDURE raise_salary(IN emp_id INT, IN pct DECIMAL(5,2))
BEGIN
  UPDATE employees SET salary = salary * (1 + pct/100) WHERE id = emp_id;
END //
DELIMITER ;

Try solving on your own first, then reveal the official answer.

Explanation

MySQL-specific syntax: LIMIT, AUTO_INCREMENT, ENGINE=InnoDB, DELIMITER for procedures.

Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details