Chapter 20 Stored Programs and Views

Table of Contents

20.1 Defining Stored Programs
20.2 Using Stored Routines (Procedures and Functions)
20.2.1 Stored Routine Syntax
20.2.2 Stored Routines and MySQL Privileges
20.2.3 Stored Routine Metadata
20.2.4 Stored Procedures, Functions, Triggers, and LAST_INSERT_ID()
20.3 Using Triggers
20.3.1 Trigger Syntax and Examples
20.3.2 Trigger Metadata
20.4 Using the Event Scheduler
20.4.1 Event Scheduler Overview
20.4.2 Event Scheduler Configuration
20.4.3 Event Syntax
20.4.4 Event Metadata
20.4.5 Event Scheduler Status
20.4.6 The Event Scheduler and MySQL Privileges
20.5 Using Views
20.5.1 View Syntax
20.5.2 View Processing Algorithms
20.5.3 Updatable and Insertable Views
20.5.4 View Metadata
20.6 Access Control for Stored Programs and Views
20.7 Binary Logging of Stored Programs

This chapter discusses stored programs and views, which are database objects defined in terms of SQL code that is stored on the server for later execution.

Stored programs include these objects:

Views are stored queries that when referenced produce a result set. A view acts as a virtual table.

This chapter describes how to use stored programs and views. The following sections provide additional information about SQL syntax for statements related to these objects: