0 votes
1 view
in SQL by (43.7k points)

Can anyone explain the stored procedure in MySQL?

1 Answer

0 votes
by (103k points)

In MySQL, a Stored Procedure is a set of SQL codes that you can write and save that allows us to reuse the code whenever needed without having to rewrite it. Hence, if you have SQL queries that you use regularly then you can save it as a stored procedure. You just have to call the procedure for execution when required.

In short, if you have a SQL query that you need to run multiple times on a regular basis, save that as a stored procedure and use the EXEC command to reuse it.

Here is how you can create a stored procedure in MySQL:

CREATE PROCEDURE procedure_name

AS

sql_statement

GO;

You can use the following EXEC command to reuse a stored procedure:

EXEC procedure_name;

If you want to learn MySQL from top professionals, then check out this SQL Course by Intellipaat.

Also, watch this video on MySQL:

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jun 26 in SQL by Sudhir_1997 (43.7k points)
0 votes
1 answer
asked Jun 26 in SQL by Sudhir_1997 (43.7k points)
0 votes
1 answer
asked Jun 26 in SQL by Sudhir_1997 (43.7k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...