A view is a virtual table based on the result-set of an SQL statement. A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database.
dbForge Studio for SQL Server allows you to create, modify, and drop views, retrieve and alter data in underlying tables.
In order to start creating a view, you should have the following privileges:
In Database Explorer, right-click the Views node and select New View.
CREATE VIEW HumanResources.vEmployeeDepartment
AS
SELECT
e.[BusinessEntityID]
,p.[Title]
,p.[FirstName]
,p.[MiddleName]
,p.[LastName]
,p.[Suffix]
,e.[JobTitle]
,d.[Name] AS [Department]
,d.[GroupName]
,edh.[StartDate]
FROM [HumanResources].[Employee] e
INNER JOIN [Person].[Person] p
ON p.[BusinessEntityID] = e.[BusinessEntityID]
INNER JOIN [HumanResources].[EmployeeDepartmentHistory] edh
ON e.[BusinessEntityID] = edh.[BusinessEntityID]
INNER JOIN [HumanResources].[Department] d
ON edh.[DepartmentID] = d.[DepartmentID]
WHERE edh.EndDate IS NULL
Note
A view always shows up-to-date data! The database engine recreates the data, using the view’s SQL statement, every time a user queries a view.
Edit a view by selecting Edit View from the Database Explorer node shortcut menu. In the opened document, you can alter the query text. Once a view is created, you can not modify its name or owner. Save the document to apply changes you’ve made to the query text.
Drop a view by selecting Delete from the Database Explorer node shortcut menu.
To retrieve view data, right-click a view in Database Explorer, and then click Retrieve Data on the shortcut menu. The data is rendered in grid-based editor. You can browse and edit view data in the same way as you browse and edit table data.
Note
Some views can be non-updatable. You can not edit their data.
Download dbForge Studio for SQL Server and try it absolutely free for 30 days!