faqts : Computers : Databases

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

175 of 188 people (93%) answered Yes
Recently 8 of 10 people (80%) answered Yes


what is a view,difference between view& base relation,what happens a user access a db through a view?

Jul 21st, 2008 09:09
Taksh Verdhan, dman, Deepak Bansal, Rachit Bagda, Milan KM, http://sturly.com

View: A relation that is not a part of the physical database, (e.g. A 
Virtual Relation) is made available to the users, is called a view.
Difference between a view and a base relation: -
1. This is one type of relation which is not a part of the physical 
2. It has no direct or physical relation with the database.
3. Views can be used to provide security mechanism.
4. Modification through a view (e.g. insert, update, delete) generally 
not permitted
Base Relation:
1. A base relation is a relation that is not a derived relation.
2. While it can manipulate the conceptual or physical relations stored 
in the data.
3. It does not provide security.
4. Modification may be done with a base relation.
What happens a user access a db through a view?
We can assign the view, a name & relate it the query expression as
	Create View <View Name> as <Query Expression>
Let EMPLOYEE be the relation. We create the table EMPLOYEE as follows:-
Create table EMPLOYEE
	(Emp_No	integer of null,
	 Name		char (20),
	 Skill		chars (20),
	 Sal_Rate	decimal (10, 2),
	 DOB		date,
	 Address	char (100),)
For a very personal or confidential matter, every user is not 
permitted to see the Sal_Rate of an EMPLOYEE. For such users, DBA can 
create a view, for example, EMP_VIEW defined as:-
Create view EMP_VIEW as
	(Select Emp_No, Name, Skill, DOB, Address 
         From EMPLOYEE)