From the course: MySQL Advanced Topics (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Creating a stored procedure

Creating a stored procedure - MySQL Tutorial

From the course: MySQL Advanced Topics (2019)

Creating a stored procedure

- [Instructor] A stored procedure is defined with the create procedure statement. Here again, we're using the album database, and I drop procedure if it exists, and I create the procedure, it's called list albums. It's very simple, it just has two statements in it. Again we use delimiter, which is a command in the client side here in the My SQL workbench, which allows the client to send all of this as one statement, even though it includes semicolons, To send all of that to the server to create the procedure. And then we call list albums, which is the name of the procedure. And when I execute this, you'll see we get our zo--, it's expected we get the result of the two select statements, which is all of the albums and all of the rows and all the columns of album and track tables. So this is a very simple procedure and you can see how that's constructed and how it works. Let's go ahead and look at a slightly more complex…

Contents