---
title: "What is View in SQL server? Give an example to create a View in SQL."  
description: "What is View in SQL server? Give an example to create a View in SQL."  
author: "Revati S Misra"  
published: 2023-03-24  
updated: 2023-03-24  
canonical: https://www.mindstick.com/forum/157566/what-is-view-in-sql-server-give-an-example-to-create-a-view-in-sql  
category: "mssql server"  
tags: ["database", "mysql", "sql server", "sql"]  
reading_time: 2 minutes  

---

# What is View in SQL server? Give an example to create a View in SQL.

What is [View in SQL](https://www.mindstick.com/forum/95354/what-are-the-uses-of-view-in-sql-server) server? Give an example to create a View in [SQL server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server).

## Replies

### Reply by Krishnapriya Rajeev

In [SQL](https://www.mindstick.com/articles/13115/types-of-keys-in-sql-or-oracle-database) [Server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over), a [View](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view) is a *virtual table* that is the result set of an SQL query. Views simplify queries and they also hide the complexity of joins and other operations. The values in a view table can only be obtained from the based table. We *cannot modify* the contents of a View.

They are also used to restrict access to certain columns or rows of a table and implements security mechanism. Its name must be unique.

Syntax:

![What is View in SQL server? Give an example to create a View in SQL.](https://www.mindstick.com/mindstickforums/6f92004a-037a-4790-82c0-292e5f8afae5/images/a04e80fb-06b1-4ca4-a385-a6044fdacc4d.png)

Example to create a View in SQL Server:

![What is View in SQL server? Give an example to create a View in SQL.](https://www.mindstick.com/mindstickforums/6f92004a-037a-4790-82c0-292e5f8afae5/images/3f60f803-7f9d-4710-b71d-ca33b52d0c68.png)

In this example, we're creating a view called Emp that shows the Name and Empid of an employee. The view is based on the Employee table but only shows the Empid column and the Name column. Once the view is created, it can be used just like a regular table in SQL queries:

```plaintext
SELECT * FROM [Emp] WHERE Empid = 'E01';
```

This query will return the the Empid and Name of employee whose Empid equals '"E01" Note that views are read-only, so you cannot modify the data in the view directly. If you want to modify the underlying data, you'll need to modify the source table(s) instead.


---

Original Source: https://www.mindstick.com/forum/157566/what-is-view-in-sql-server-give-an-example-to-create-a-view-in-sql

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
