MySQL has brought support for functions and stored procedures as of Version 5. A stored procedure is a set of SQL statements that can be stored on the server, so that they can be invoked later by a client, a trigger, or even another stored procedure.
Now, we will create a simple stored procedure that will select the employees with the lowest, highest, and average salaries in the company.
The default way of creating such a routine in Navicat is through the Function Wizard that is invoked by clicking on the New function button in the toolbar or by selecting the New Function command from the pop-up menu showing up with a right-click on the appropriate context.
In the Function Wizard window, select Procedure and ...