Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

View vs Table???

Status
Not open for further replies.

WilsonM

Programmer
Feb 5, 2001
22
CA
Hi,

Can anyone just refresh my memory.

What is the diff. between a View and a Table?

Thanks in advance,

Wilson
 
The difference between a table and a view is simple. A table is the underlying structure that contains the fields, data types and data for the database. A view is normally a subset of the underlying table in which you restrict the fields and records displayed to the user. The way to filter these records is usually done by a query or stored procedure based on a table. Views are an excellent way of keeping the end user from having direct access to the table. One of the basic rules of database design is that users NEVER have direct access to the underlying data because they can corrupt data! Views are also a way to implement security. If you don't want certain users to see certain fields, like a salary field in an employee table, you can restrict them from seeing that information.
 
Hi Wilson.

The difference between a View and a Table is very simple. View is an imaginary table which has only a definition and moreover it points to the table only.

Views can be created for a few sets of reasons like

1) Security-> Assume there is a table which has seven fields, whereas you want to enduser to access only three fields then you can create a view to handle this.

Eg : create view <viewname> <Field Names, Field Names,...>
as Select <required fields> from <Table Name>

this also takes care of even hiding the tablename from the user.

User can be able to update the table only if the other fields which are not part of the view can accept null values.

2) Ease of Use-> Assume a query requires data from more than one table with lots of conditions. Instead of giving a long select statement, you can create a view to make your life very simple.

View is not going to store any data, it carries only the definiton and points to the base table.

Conditions apply to insert, update or delete a record through a view.

Hope this helps you


Parthi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top