MS SQL 2008笔记之万事开头难(3)

上一节介绍了基本的数据类型,这一节介绍 View in SQL

———————————————–

View is a set of pre-defined SQL statements. It provides the interface between the user and database so that the user only has limited accessiblity to certain columns and a view can combine different columns from different tables and the user doesn’t need to know the underline structure of these tables.

1. create / drop a view, (alias, filter, Order by and top(100) percent etc.)

create view xxx

as

[statements]

drop view xxx

2. create index on a view (PK (primary key) is an index by default)

3. view encryption: hide the definition of a view (remember to backup your original definition other wise you can’t modify the view after encryption).

create view xxx with encryption

4. schema binding: you will get an warning if you are trying to change the underline table structure (it just gives out waring but not halts the process).

create view xxx with schema binding

5. update a view, if the base table is only one single table. [with check option], with this option, the insertion which doesn’t match view’s filter (like where) will not be executed.

create view xxx

as …

with check option

6. grant permission on views

grant select on xxx to guest

revoke select on xxx from guest

Advertisement
Explore posts in the same categories: Computer Science

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.