Views in SQL Server

Total: 1 Average: 5

Introduction

A view in SQL Server is a virtual table-like structure based on the result-set of an SQL statement. On the surface, a view is similar to a table with the signature structure of rows and columns. However, these rows and columns come from tables referenced in the query, which defines the View.

We use Views to focus on the concrete columns for the purposes they are created for. Views may also serve for security reasons. They filter out columns in the underlying tables which one does not want to make visible to certain users. Views filter columns like a WHERE clause filters rows.

Read More

Create Indexed Views in SQL Server

Total: 6 Average: 4.3

Introduction

You would have already heard about views in databases. We create views for a number of reasons. One of the main reasons for using views is simplicity. Instead of writing complex queries again and again, you can just write a reusable view which fetches data from the underlying base tables. Another important reason for using views is security. If you don’t want to grant user privileges for the entire table, you can create a view instead which simplifies the process by letting you grant access directly to this view instead of the table. That said, views have certain limitations. The queries used in views have to fetch data from the underlying base tables which is not optimal when dealing with a huge number of rows. There is a strong likelihood of unnecessary I\O which would lead to poor database performance. Read More