Views are virtual tables that are compiled at run time. The data associated with views are not physically stored in the view, but it is stored in the base tables of the view. A view can be made over one or more database tables.
Ex:
create view myview
as
select count(empid) as total from employees
Types of Views
System Defined Views
System defined Views are predefined Views that already exist in the Master database of Sql Server. These are also used as template Views for all newly created databases.
Information Schema View
SELECT * FROM INFORMATIONSCHEMA.COLUMNS
where TABLENAME='Employee'
Catalog View
select * from sys.tables
Dynamic Management View
--To see all SQL Server connections
SELECT connectionid,sessionid,clientnetaddress,authscheme
FROM sys.dmexecconnections
User Defined View
create VIEW EmployeeDetails
AS
Select EmpID ,EmpName ,EmpDesignation
From Employee
0 Comment(s)