What are the advantages and disadvantages of the views of the base tables or base table? Describe these in detail.

What are the advantages and disadvantages of the views of the base tables or base table? Describe these in detail.

Default featured image

What are the advantages and disadvantages of the views of the base tables or base table? Describe these in detail.
In the database views are defined as the “Virtual table (s)” and also known as the stored queries. 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 used for the various purposes. Here are the advantages and disadvantages of the creating views in the Transact-SQL. Let’s talk about these in detail.
Advantages
1) We can use the views for hiding the complexity of the data. We can create a view and we can give this view to the new learner for understating the concept of the T-SQL JOINs instead of the giving the complex statements to new user. This will create the extra load on the server.
2) We can also protect our data from the users; those don’t need some of the sensitive data. Let’s say if there is a table containing the sensitive data in the columns. We don’t want them to see the sensitive data.
3) We can grant permission to some of the users for views, without allowing them to run the query against the base tables. We can have the secure data in our database.
4) We can create some of the business rules to apply within the company or organization like we can have the detail regarding the promotion of the employees in the last year, in this year and next year.
5) We can customize the data representation in the meaningful way to show to the external user and user within the organization who don’t have the access to the database.

Here are some examples of Views usability:-
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.

Disadvantages:- Here is the disadvantage of the views

Views are really great tools to secure the data and customized the data. But it could also reduce the speed of execution of the queries in the T-SQL. Indeed these are not the faster than the queries defining then it. But we have the tool called indexed views to support this kind of problem in the database to faster the query. This process is also known as Materialized Views as well.
There is one recommendation on the views always create the views against the base table. It is the best practice not to create the views against another view. It will slow down the query in the T-SQL.

Thanks,
Sandeep Rajmail

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post