Is using \"view\" in db design right method or we should handle it code side? What are the advantages or disadvantages?
Some database systems do not support embedding a SELECT statement inside a FROM clause. If you are using a system that does not support this feature, you can often save the inner SELECT statement as a view, and use the view name in place of the select statement.
So it provides behavior that can be missing in some db implementations.
Two typical scenarios for views in our case are:
Hope this helps.
I see a couple of reasons to use views :
Depends. I use them sometmies, but not that often. They are VERY usefull to expsoe decoded views on the data for use by end user (tools), like reporting applications, though. This way you can provide an end user with a simplified version of often requested information hiding some technical details.