Complete the code to declare an input parameter in a MySQL stored procedure.
CREATE PROCEDURE AddNumbers([1] num1 INT, num2 INT)
BEGIN
SELECT num1 + num2 AS sum_result;
END;The IN keyword declares an input parameter for the procedure. It means the value is passed into the procedure.
Complete the code to declare an output parameter in a MySQL stored procedure.
CREATE PROCEDURE GetCount([1] totalCount INT)
BEGIN
SELECT COUNT(*) INTO totalCount FROM users;
END;The OUT keyword declares an output parameter. It allows the procedure to return a value to the caller.
Fix the error in the procedure parameter declaration to allow both input and output.
CREATE PROCEDURE UpdateScore(playerId INT, [1] score INT) BEGIN SET score = score + 10; END;
The INOUT keyword allows the parameter to be used for both input and output, so the procedure can read and modify it.
Fill both blanks to declare an IN parameter and an OUT parameter in a procedure.
CREATE PROCEDURE CalculateTax([1] amount DECIMAL(10,2), [2] tax DECIMAL(10,2)) BEGIN SET tax = amount * 0.15; END;
The first parameter is input only (IN), and the second parameter is output only (OUT).
Fill all three blanks to declare an IN parameter, an OUT parameter, and an INOUT parameter in a procedure.
CREATE PROCEDURE AdjustValues([1] inputVal INT, [2] outputVal INT, [3] inoutVal INT) BEGIN SET outputVal = inputVal * 2; SET inoutVal = inoutVal + 5; END;
The first parameter is input only (IN), the second is output only (OUT), and the third is both input and output (INOUT).