A stored procedure handles complex data structures. You can create it in the PHPMyAdmin database and use it anywhere by simply adding the database. connection. Let’s learn in this tutorial how to simply create a stored procedure in your PHPMyAdmin using the Routines menu.
Stored Procedure in PHPMyAdmin
The Routine Menu
In your PHPMyAdmin, select a database for which you wish to create a stored procedure. Click on the Routines Menu and then ‘Add a new Routine’. You may then see a pop-up dialogue, enter the details to add the required parameters and then make a new stored procedure. You can then use this in your application or website.
You can make a procedure with or without parameters. Consider the SQL queries below to create a stored procedure.
Without Parameters
CREATE PROCEDURE `GetUsersEmail`() NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER BEGIN Select * From users; END
With Parameters
CREATE PROCEDURE `GetUsersEmail`(IN `uEmail` VARCHAR(255)) NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER BEGIN select * from users where email = uEmail; END
We can then use these stored procedures in any app, like a Laravel application. Follow the next tutorial how how to use a stored procedure in Laravel.