0
0
Testing Fundamentalstesting~10 mins

Stored procedure testing in Testing Fundamentals - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to call the stored procedure named 'GetUserById' with parameter 5.

Testing Fundamentals
CALL GetUserById([1]);
Drag options to blanks, or click blank then click option'
A'5'
B5
CuserId
DNULL
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the parameter as a string with quotes.
Using a variable name instead of a value.
2fill in blank
medium

Complete the code to create a stored procedure named 'AddProduct' that inserts a product with name parameter.

Testing Fundamentals
CREATE PROCEDURE AddProduct(IN productName VARCHAR(100)) BEGIN INSERT INTO products(name) VALUES([1]); END;
Drag options to blanks, or click blank then click option'
ANEW.productName
B'productName'
Cname
DproductName
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around the parameter name.
Using a column name instead of the parameter.
3fill in blank
hard

Fix the error in the stored procedure call to 'UpdateStock' with productId and quantity parameters.

Testing Fundamentals
CALL UpdateStock([1], 10);
Drag options to blanks, or click blank then click option'
AproductId
B10
CNULL
D'productId'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the parameter as a quoted string.
Passing NULL instead of a valid value.
4fill in blank
hard

Fill both blanks to declare and set an output parameter 'totalCount' in a stored procedure.

Testing Fundamentals
CREATE PROCEDURE CountUsers(OUT [1] INT) BEGIN SELECT COUNT(*) INTO [2] FROM users; END;
Drag options to blanks, or click blank then click option'
AtotalCount
BuserCount
DcountUsers
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for the OUT parameter and the variable.
Forgetting to declare the OUT parameter.
5fill in blank
hard

Fill all three blanks to create a stored procedure 'DeleteUser' that deletes a user by id and returns success status.

Testing Fundamentals
CREATE PROCEDURE DeleteUser(IN [1] INT, OUT [2] BOOLEAN) BEGIN DELETE FROM users WHERE id = [3]; SET [2] = ROW_COUNT() > 0; END;
Drag options to blanks, or click blank then click option'
AuserId
Bsuccess
Ddeleted
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for the input parameter and WHERE clause.
Not setting the output parameter correctly.