What is the importance of the View in the SQL Server? What are the advantages and disadvantages of the Views in SQL Server?
View is defined as the “Virtual table”. These tables are not the real tables in the database, but these are like the virtual tables which contain the columns and data like the other real tables. These views are created from one or more than one tables to store the columns and data in it. These tables not contain any kind of data in it, but views are generally created with the set of queries to store the data in it like the other real table as the object stored in the database. After creating the views from the other tables, views always refer these tables all the time for representing the data which is mentioned in the query at the time of execution.
Views are created for the security purposes for the database. It is always helpful for us to restrict the people from the outside to see the information like columns and data in the columns for the sake of the security of the data access. Views will only return the data which is created or mentioned at the time of the writing the query. There is another use of the view is that we can use this for abstraction of the data in the table which is not known by the end user. Views can also be defined as the stored query and virtual table. The data accessible through these stored queries is not stored anywhere in the database as a distinct object. We just store the SELECT statement for the combination of the tables. The results from these queries of the SELECT statement create a virtual table by using the name of the view in the Transact-SQL statements similar to tables.
View is used for the following tasks:-
1) View is used to restrict the user from accessing the specific rows in the table (s). Let have a simple example of an employee to see only the records of him/her related to work hours in the time tracking table.
2) These are also used for restricting the access to specific column (s) to anyone in the team. For example allow employees who are working in the company, they can see the name, work phone, department and designation in the employee table. But we don’t allow them to see the personal information like SSN, Salary and Date of Birth D.O.B. in the same employee table.
3) Views are also helpful for us to get the aggregate information like Total of the Columns, Difference of the Columns, Average and Percentage (%) etc.
Views are created by writing the SELECT statements, which are written in Transact- SQL to representing the data required in the view. The tables we are using to creating the views are called the base tables. If we don’t want let others to look into these tables directly then we will just give them the view (S) of the required information for them to look.
It just the overview of the definition of the view and its usability in the Transact-SQL for the more security and check on the direct access to the information which is not related to user. We can give some access to the user for looking into the required data or information. This is the best way to save the time and save the space on the memory of the server. We don’t need to create the query every single time. We can save some time to create the queries to get the information through the SELECT statements.
To be continuing ………
Thanks,
Sandeep Rajmail


Leave a Reply