as I know, stored procedure can do the same select statement. And stored procedure can do more things view can not.

I mean, if view has no more ability, why it still exists? If I want to select some info from two different tables, is it better to do so via a view? Or stored procedure is exactly the same? If view is better, could anyone explain to me the reason? I heard that view can not save the result, but I also heard that if you add an index on a view, it can save the result so later we can read it faster. But I did not find any post prove the above opinion yet.

stored procedure is a precompiled batch of code which can be made parametrized if require , can do DML (insert/update/delete) etc. view on the other hand is a virtual table which may include data from more than one table. It cant perform any other operation other than just return a resultset which forms virtual table. Also it has to follow a lot of additional conditions if we need to update data in base tables through it. If we add an index on view, it will be physically stored and referred to as indexed view.views are mostly used to merge data from tables from one or more dbs or to create an abstraction to expose only some of fields of table to set of users,

Another thing to consider is that you can join a view to other tables or views, apply where clauses, grouping etc. (i.e., all the things you can do to a table), but with a stored procedure, even when the stored procedure returns exactly similar result set as a view, it cannot be joined to other tables/views (without some acrobatic SQL maneuvers).

Another thing to consider is that you can join a view to other tables or views, apply where clauses, grouping etc. (i.e., all the things you can do to a table), but with a stored procedure, even when the stored procedure returns exactly similar result set as a view, it cannot be joined to other tables/views (without some acrobatic SQL maneuvers).