Hello guys, In this blog, I am going to explain you about a view and how
to create a view inside the database.
View-
A VIEW in SQL Server is like a virtual
table that contains data from one or multiple tables. It does not hold any data
and does not exist physically in the database. Similar to a SQL table, the view
name should be unique in a database. It contains a set of predefined SQL
queries to fetch data from the database.
Uses of view-
· Views are generally used to focus, simplify and customize the
perception each user has of the database.
· Views can be used as security mechanisms by letting users
access data through the view, without granting the users permissions to
directly access the underlying base tables of the view.
· Views doesn’t store data in a physical location.
· View can be used to hide some of the columns from the table.
· Views can provide access restriction, since data insertion,
update and deletion is not possible on the view.
Disadvantages of view-
· When a table is dropped, associated view become irrelevant.
· Since view are created when a query requesting data from view
is triggered, its bit slow.
· When views are created for large tables, it occupies more
memory.
How to implement view inside the
database-
Step
1- First you have to select a database and
inside the database you have to create a table.
Step 2- Inside the table you have to create view.
Step 3 -After that you have to select a column which you have to show to other user with the help of view from the database.
Step
4- After that create the user for the view in
SQL and select the default database name also.
· Step 5- When you created a user after that you have to grant a permission for the user.
· Step 6- Once you done with permission and open a new query window and login with user and write the new syntax-
Select * from view name
No comments:
Post a Comment
If you have any doubt or question, please contact us.