434 views
2 votes
2 votes
What is the difference between a View and a Table?

If I create a Table, it will be stored in the database. I mean on the storage space.

If I create a View, it will not be stored onto the storage space?

Please correct me if I am wrong?

1 Answer

0 votes
0 votes
Yes,you are right.A table contains data, a view is just a SELECT statement which has been saved in the database (more or less, depending on your database).

The advantage of a view is that it can join data from several tables thus creating a new view of it. Say you have a database with salaries and you need to do some complex statistical queries on it.

Instead of sending the complex query to the database all the time, you can save the query as a view and then SELECT * FROM view

views can have a clustered index assigned and, when they do, they'll store temporary results that can speed up resulting queries.You lose information about relations (primary keys, foreign keys) in views but not in table.
edited by

Related questions

0 votes
0 votes
1 answer
1
aditya kuppa 1 asked Dec 5, 2017
1,091 views
How many minimum tables are required for this er diagram consisting of a many - many relation and total participation of one of the entities.? Can't i merge relation R an...
4 votes
4 votes
0 answers
2
Shubhanshu asked May 3, 2017
2,568 views
Plz explain what is the no of tables required in self referential relation( without multivalued attribute) and How:- and also (with multivalued attribute) ????
0 votes
0 votes
2 answers
4
im.raj asked Jun 16, 2016
701 views
Views are useful for _____ unwanted information, and for collecting together information from more than one relation into a single view.A. HidingB. DeletingC. Hi...