sql - Why is a good practice "provide an abstracting layer preventing direct access to the tables" (Views) -
i work in dwh. big part of job move data oltp database dwh.
one practice is:
-create new table need.
create table mytable (column1 date, column2 varchar(8));-create view new table (exactly same)
create view myview select * dummy alter view myview ( column1 ,column2 ) select column1 column2 mytable-read view
here come 1 procedure use myview , not mytable. why?
i understand of course functionality of views reducing complexity in save querys or protect parts of table final users.
but can not see why practice read view , not direct table.
i mean of course case view same table.
thanks answers , enrique
this question dangerously close asking opinion.
but, views recommended such system because isolate users underlying data structure. in other words, can maintain data , not have change queries in user applications.
in addition, views convenient way add in computed columns. computed columns contain business rules. having logic in single place prevents proliferation of business logic -- , errors , inconsistencies can arise on time.
Comments
Post a Comment