Database Management
MySQL
Subjective
Oct 01, 2025
What are stored procedures and their advantages?
Detailed Explanation
Stored procedures are precompiled SQL code stored in the database.
Advantages:
• Better performance (precompiled)
• Reduced network traffic
• Code reusability
• Enhanced security
• Centralized business logic
Example:
DELIMITER //
CREATE PROCEDURE GetUserOrders(IN user_id INT)
BEGIN
SELECT * FROM orders WHERE user_id = user_id;
END //
DELIMITER ;
CALL GetUserOrders(123);
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts