First, the view (view)
Views are derived from one or several base table (or view) table. It is a virtual table. Only the database stored definition of the view, and a view corresponding to the original data is still in the base table. So, once the data base table changes, check out the data from the view has changed along with it. View, once defined, it can be queried and the same basic table is deleted. You may then define a new view on the view, but the view update (add, delete, change) operations, there are certain limitations.
1. Define Views
⑴, the establishment of view
create view <view name> [(<column name> [column name] ...)]
as <subquery>
[with check option];
⑵, Delete View
drop view <View> [cascade]
2, Query View
create view <view name> (<column name> [column name] ...)
from 表
where conditions;
3, update view
Update the view refers to the view through the insert (insert), delete (Delete) and modifications (Update) data.
Since knowledge FIG virtual table is not actually stored data, thus updating the view ultimately to convert the base table updates. To prevent the user view of the data by increasing, deleting, modifying, intentionally or unintentionally, the basic data table is not within the range of view of operation, together with check option may be in view is defined words.
In general, the ranks of the subset of the view is updated, in addition to the ranks of a subset of the view that some view is theoretically updatable, but further study. Some theoretical view is not updatable.
Action 4, the view
⑴, trying to simplify user operations
⑵, allowing users to look at the same data in multiple angles
⑶, to reconstruct the database to mention work a certain degree of independence logic
⑷, view provides security protection for confidential data
⑸, appropriate use of view more clearly express queries
Second, the index (index)
Create create
Delete drop
Modify alter
Third, the stored procedure
Some sql statement compiled in advance and stored in the database collection, application developers can simplify a lot of work to reduce the transmission of data in the database and application server, to improve the efficiency of data processing. The stored procedure does not return a value.
Fourth, the flip-flop
mysql database can define a trigger event to trigger the same one and the same time table. An alias to refer to new and old recorded content changes trigger.