I am new to SQL Server, I need to know what're the main differences between Table and Views and when should I use views instead of tables?
below is a new table I have created in my database and I want to know when and why I should query view instead of the table?
View is a virtual table whose contents are defined by a query. Like a table, a view consists of a set of named columns and rows of data. The rows and columns of data come from tables referenced in the query defining the view and are produced dynamically when the view is referenced.
Here is the Example to create a view using SQL
Create View VW_ProductPrice_Less15
Select * from Product
Where Price < 15
To select data from view
Select * from VW_ProductPrice_Less15
Most popular tags