I have this question, is there any performance issue with creating SQL view by joining two or more tables?
Is it good practice or one should create another table with joins and create view on top of it?
A view creates a logical table and that table can be the result of any SQL statement.
When you create a view, you remember these things:-
- Limiting the visibility of columns (via select) or rows (via where)
to just those pertinent to a task
- Combining rows (via union) and or columns (via join) from multiple
tables into one logical table.
- Aggregating rows (via Group BY and Having) into a more distinct
presentation pulled from a table with finer detail.
Views have the following benefits: (Refer by - What is a good reason to use SQL views?)
- Security - Views can be made accessible to users while the underlying
tables are not directly accessible. This allows the DBA to give users only the data
they need while protecting other data in the same table.
- Simplicity - Views can be used to hide and reuse complex queries.
- Column Name Simplication or Clarification - Views can be used to
provide aliases on column names to make them more memorable or
meaningful.
Thanks!!!