| Author: sangeetha 11 May 2009 | Member Level: Gold Points : 2 |
A view ia a logical representation of another table or combination of tables. A view derives its data from the tables on which it is based. These tables are called base tables. Base tables might in turn be actual tables or might be views themselves.
All operations performed on a view actually affect the base table of the view. You can use views in almost the same way as tables.You can query, update,insert into and delete from views, just as you can standard tables.
Views can provide a different representation of the data that resides within other tables and views. Views are very powerful because they allow you to tailor the presentation of data to different types of users.
> A view is a database object > It is a virtual table whose contents are taken from other tables through the execution of a query.The changes in the table are automitacally reflected in the view. > A view is created witha the CREATE VIEW command > A view is queried just like querying a table. > A user cannot distinguish between a table and a view > Any updation of rows in tha table will automatically reflected in the view > As a VIEW does not store any data the redundancyproblem does not araise. > Critical data in the base table is safeguarded as access to such data can be controlled using VIEW
EX. CREATE VIEW dbo.emp_view as SELECT ename,empno,deptno from emp
|
| Author: hitesh 12 May 2009 | Member Level: Gold Points : 1 |
Please correct the Point 5:
You CAN use the 'Order by' clause inside your view SELECT statement. It's allowed. You must use 'TOP (100) PERCENT' with it
Here is how you can use it.
SELECT TOP (100) PERCENT [columns you want to select] FROM [your view name] ORDER BY [column names]
|