Complete the code to declare an input parameter named 'user_id' of type INT.
CREATE PROCEDURE GetUserName([1] INT) BEGIN SELECT name FROM users WHERE id = user_id; END;The IN keyword declares an input parameter that passes a value into the procedure.
Complete the code to declare an output parameter named 'total_count' of type INT.
CREATE PROCEDURE CountUsers([1] INT) BEGIN SELECT COUNT(*) INTO total_count FROM users; END;The OUT keyword declares an output parameter that returns a value from the procedure.
Fix the error in the procedure declaration by choosing the correct parameter mode for 'balance'.
CREATE PROCEDURE UpdateBalance(IN user_id INT, [1] balance DECIMAL(10,2)) BEGIN SET balance = balance + 100; END;
The INOUT keyword allows the parameter to be used for both input and output, so the procedure can read and modify 'balance'.
Fill both blanks to declare an INOUT parameter 'score' of type INT and assign it a new value inside the procedure.
CREATE PROCEDURE AdjustScore([1] score INT) BEGIN SET score [2] score + 10; END;
INOUT allows the parameter to be read and updated. The = operator assigns the new value.
Fill all three blanks to declare an OUT parameter 'result', assign it a value, and select it after procedure execution.
CREATE PROCEDURE CalculateSum(IN a INT, IN b INT, [1] result INT) BEGIN SET result [2] a + b; END; CALL CalculateSum(5, 10, @sum); SELECT [3];
OUT declares the output parameter. = assigns the sum. @sum is the session variable used to retrieve the output value.