What are the uses of view in SQL server ?

What are the uses of view in SQL server ?

Last updated:9/11/2019 12:46:27 AM

1 Answers

Sanat Shukla
Sanat Shukla

The role of views in SQL server is kind of virtual tables. The view also has rows and columns as they are in a real table in the database. You can create a view by selecting fields from one or more tables present in the database. The view can either have all the rows of a table or specific rows based on certain condition. The VIEW in SQL is a logical subset of data from one or more tables. The view is used to restrict data access.

  • A Views can represent a subset of the data contained in a table; with the result that a view can limit the degree of exposure of the underlying tables to the outer world:
  • The given user may have permission to query the view, while denied access to the rest of the base table.
  • The views can join and simplify multiple tables into a single virtual table.
  • The views can act as aggregated tables, where the database engine aggregates data (sum, average, etc.) and presents the calculated results as part of the data
  • The views can hide the complexity of data; for example, the view could appear as Sales1001 or Sales2001, transparently partitioning the actual underlying table
  • The views take very little space to store; the database contains only the definition of a view, not a copy of all the data which it presents.
  • Views may provide additional security, depending on the SQL engine used.
The syntax for creating a View


CREATE or REPLACE VIEW view_name
    AS
    SELECT column_name(s)
    FROM table_name
    WHERE condition

Answer