Your SlideShare is downloading. ×
MS SQLSERVER:Creating Views
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

MS SQLSERVER:Creating Views

484
views

Published on

MS SQLSERVER:Creating Views

MS SQLSERVER:Creating Views

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
484
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 13
    SQL SERVER: CREATING VIEWS
  • 2. What is a View
    A View is a query which is stored in a server in the form of an object. The Power of a view lies in the fact that it can be referenced as a table. It provides an abstraction of the underlying data.
    The Main use of using a view is the security that it offers. A Third-Person may be restricted to view only a portion of a database, while hiding the rest of sensitive data
    The Illustration is made in the next slide.
  • 3. What is a View
    Remember that the view exists as query and not as a table
  • 4. SQL Views
    Points to remember about SQL Views:
    • View is inherently a query.
    • 5. Changes made in the view will not alter a table. An explicit update must be
    made to effect a change.
    • All changes can be made in the view except DDL commands
    • 6. Views are used to provide additional security over data
    • 7. It also prevents unwanted tampering of sensitive data
    • 8. Views provide performance benefits
  • Creating Views
    The SQL syntax for creating a view is as follows:
    Create view <viewName>
    As
    …QUERY that results in a table/data…
    GO
    Example:
    Consider a student table:
    Create view NameList
    As
    Select regno,name from student
    go
    View
  • 9. Using Views
    After creating a view, it can used as if it is a table. It can queried like a normal table:
    Select * from nameList
    The above query on the view will return:
    Thus, a view provides a good level of abstraction over the database.
  • 10. Modifying Views
    An existing view is modified like using the alter view statement.
    The Syntax
    Alter view <viewName>
    As
    …QUERY that results in a table/data…
    GO
    Similar to the alter procedure statement, the alter table command redefines the existing view defenition.
  • 11. Deleting Views
    The Syntax:
    Drop view <viewName>
    Example:
    Drop view nameList
  • 12. Summary
    13. Creating Views
  • Visit more self help tutorials
    Pick a tutorial of your choice and browse through it at your own pace.
    The tutorials section is free, self-guiding and will not involve any additional support.
    Visit us at www.dataminingtools.net