Views, triggers, authorization (popular operation)

** view: a view that is a virtual table, ie temporary lookup table. **
Here Insert Picture Description
manipulation of view: Create view:
the CREATE VIEW view name (View Properties - optional)
AS
subquery
to delete the view
query view

Principle - View Digestion : a view of an equivalent query into a query for any action on the basic table view eventually conversion action of the pair of base tables (CRUD)
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
view of the role:
1. There are too many attributes, several properties will become a group
2. There are defined for students view a property (results), for there are several teachers (grades, class results ...), for administrators ...
so that different users see different data
3. view much like a function, you will be able to achieve some complex encapsulate the functionality of SQL statements, you can directly call the direct execution time with.

Enterprises in different data needs of different sectors - different views.

View provides security protection for confidential data
to define different views for different users, so that each user can only see the data he has the right to see

GRANT (authorized) - REVOKE (withdraw rights)
for different users - students can only query performance, teachers can query the class results and so on. The administrator can authorize different users different operating authority

Security and authorization database:
data objects: can Which table operation
type of operation: - What can (CRUD) operations
Here Insert Picture Description
Here Insert Picture Description
: a special operation
GRANT ALL PRIVILIGES authorize all operations
the ON the VIEW the STU
the TO PUBILC granted to all users
WITH GRANT OPTION allows Sublicense

Circulation is not allowed to delegate:
Here Insert Picture Description
withdraw permission:
CASCADE-- all user permissions
RESTRICT-- limited recovery

Trigger
trigger (Trigger): server-side flip-flop
triggers defined on the base table, pattern, event
data dictionary

Published 54 original articles · won praise 1 · views 2752

Guess you like

Origin blog.csdn.net/weixin_44682507/article/details/103296546