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