From the course: Advanced MySQL Database Administration
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Stored procedures - MySQL Tutorial
From the course: Advanced MySQL Database Administration
Stored procedures
- [Instructor] All right. Next up, we're going to talk about stored procedures. So, MySQL gives us the ability to store and call frequently used queries on the server. People will often refer to these as just procedures or commonly stored procedures, or sometimes sprocs. Benefits include more efficient query writing and performance and the ability to share complex procedures more easily between analysts and database users. And I'll give you an example of what I mean by that in just a moment. So, when we want to invoke a stored procedure, we're going to use a CALL statement. So, here's an example where we're going to be using the thriftshop schema, and then we'll be creating this stored procedure called sp_selectAllInventory. And it's actually a very simple stored procedure. All it's doing is selecting * from inventory. So, in practice, there would be no reason to create this stored procedure. It's just as easy to run the SELECT *, but it's just a good example to get our feet wet with…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.