Mondoze Knowledge Base

Search our articles or browse by category below

MySQL Trigger and View

Last modified: October 7, 2022
You are here:
Estimated reading time: 1 min

What is MySQL Trigger and View

Trigger

The MySQL trigger is a database object that is associated with a table. It will be activated when a defined action is executed for the table. The trigger can be executed when you run one of the following MySQL statements on the table: INSERT, UPDATE and DELETE. It can be invoked before or after the event which means it can be schedule to run at certain time.

View

A view works like a table, but it is not a table. It never exists; it is only a prepared SQL statement that is run when you reference the view name.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

MySQL creates a temporary table based on the view definition statement and then executes the incoming query on this temporary table.

First, MySQL combines the incoming query with the query defined the view into one query. Then, MySQL executes the combined query

Both of the properties above can be granted by using the “MySQL Database Wizard” in the cPanel control panel while you can also grant the privilege for the user to a specific database on Website Panel control panel as well by using the “Database manager” option. You may refer below on how to enable the trigger and view on cPanel:

1. Click on the “MySQL” option.

2. Click on the database username shown at the “Privileged Users” column.

3. Select the required privilege needed to be given to the database as per below.

4. Click on the “Make Changes” button to save the privilege assigned.

5. Done!

Was this article helpful?
Dislike 0
Views: 44