views, triggers

Source: Internet
Author: User

1. View

A view is a virtual table.

the results of a Select query can be used as a virtual representation by using as a name.

Views can only be queried for use and cannot be added new.

Views cannot be built on other views and can only be based on other entity tables, and the data varies with the data of the entity table.

The view eliminates the process of building a table connection each time.

(1) Create a view

Create View View name

As

Table JOIN statement

Go

(2) Modify the View

Alter view view name

As

Table JOIN statement

Go

(3) Delete a view

Drop View name

2. Trigger

A trigger is a special stored procedure that is automatically raised by adding or removing changes to a database table.

(1) Create a trigger

Create trigger Trigger name

On table name

For insert

As

Begin

Stored Procedures

End

Go

(2) modifying triggers

ALTER TRIGGER Trigger name

On table name

For insert

As

Begin

Stored Procedures

End

Go

(3) Delete trigger

Drop trigger Trigger name

(4) Additional deletions

Insert New Data

Delete Deletes data

Update Change Data

(5) after

For or after means ... Trigger later

Instead said that in ... Before triggering

(6) temporary table

Deleted

All data to be deleted in lieu of a trigger is temporarily deposited into the deleted table.

Inserted

All data to be added in lieu of a trigger is temporarily deposited into the deleted table.

views, triggers

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.