Complete the code to create a stored procedure that selects all rows from the employees table.
CREATE PROCEDURE GetAllEmployees() BEGIN SELECT * FROM [1]; END;The stored procedure should select from the employees table to retrieve all employee records.
Complete the code to call the stored procedure named GetAllEmployees.
CALL [1]();To execute the stored procedure, use the exact procedure name GetAllEmployees with CALL.
Fix the error in the stored procedure that tries to update salary but misses the WHERE clause.
CREATE PROCEDURE UpdateSalary(IN emp_id INT, IN new_salary DECIMAL(10,2)) BEGIN UPDATE employees SET salary = [1]; END;
The UPDATE statement must set salary to new_salary and include a WHERE clause to target the correct employee by emp_id.
Fill both blanks to create a stored procedure that inserts a new employee with name and age.
CREATE PROCEDURE AddEmployee(IN emp_name VARCHAR(50), IN emp_age INT) BEGIN INSERT INTO employees ([1], [2]) VALUES (emp_name, emp_age); END;
The columns to insert into are name and age matching the input parameters.
Fill all three blanks to create a stored procedure that deletes an employee by id and returns the number of affected rows.
CREATE PROCEDURE DeleteEmployee(IN emp_id INT) BEGIN DELETE FROM employees WHERE id = [1]; SELECT ROW_COUNT() AS [2]; END;
The DELETE statement uses emp_id to identify the row, and affected_rows is the alias for the count of deleted rows.