views and triggers

Source: Internet
Author: User
views and base tables vs views and select

Only a SELECT statement is saved in the view, and the source data is from the base table Check View

When you update the base table data by checking the view, only the update statements that meet the check criteria can be executed successfully.
Local Check View
When you check the view to update a table, the UPDATE statement can be performed correctly only if the view's check condition is met. (The value of with_check_option is 1)
When you update a table through a cascading view, only update statements that meet all the checks for all views of that view will execute correctly. (The value of With_check_option is 2) trigger events and time in MySQL

Trigger event has 3 insert Update Delete

The trigger time has 2 kinds of before after the use of triggers the SELECT statement in the trigger cannot return a result set the same table cannot create two trigger programs that trigger events cannot use transaction-related statements ( Start Transaction,commit,rollback and so on) MySQL triggers operate on records, and when you batch update data, introducing triggers can lead to a reduction in the performance of bulk update operations. In the MyISAM engine, triggers do not guarantee atomicity. And in the InnoDB, you can. When the InnoDB storage engine implements an external health constraint relationship, you can use the cascading options to maintain the external health data, whereas in MyISAM you can use triggers to implement cascading modifications and deletions. The MySQL trigger cannot perform an update operation on this table. In the Before trigger, the new value from the growing field is 0, not the self-added field value that is automatically generated when the record is actually inserted. Temporary Tables

As a derived table for the main query, in order to complete the query, temporary tables need to be created automatically to store the temporary result set, which is created by MySQL itself, maintained by itself, called the Automatically created temporary table view, subquery, temporary table, derived table

Views are usually used in the FROM clause of a subquery statement, and the subquery is used in the WHERE clause or the HAVING clause of the main query.
If the statement of the main query for the view is update, delete, insert, and the main query executes an update operation for a specific field, the main query statement will be faulted.
A derived table has a shorter life cycle than a temporary table, and the derived table is cleared immediately after the execution of this SELECT statement.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.