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.