17.07.2015 Views

Download eBook (PDF) - Red Gate Software

Download eBook (PDF) - Red Gate Software

Download eBook (PDF) - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3 – Schema Architecture StrategiesUsing ViewsViews are objects within SQL Server that provide a layer of abstractionbetween the end users and the underlying schema. Rather than directly accessthe base table, the users query a 'virtualized table' that holds only the data thatis specific to their needs.Users can execute SELECT statements against a view in the same way that theywould if they were querying the underlying tables. If the query that is used tocreate the view is an updateable query, in other words, one that references asingle base table and does not present aggregated data, then UPDATE, INSERTand DELETE statements can also be executed against the view. It is worthnoting that executing an INSERT statement against a view that does not containall of the underlying table's columns will result in an error if the columns thatare not included in the view do not allow nulls and do not have a default value.This abstraction of the database schema, using views, means that data can berepresented in a more friendly way to the end user. The query that defines theview can perform any required aggregation of the data, thus saving the userfrom having to perform complex joins, summing, grouping and filtering toreturn the required data. Views are often used to report sales and to identifytrends to which management needs to respond.Views also have an important security function. As well as providing a usefulreporting mechanism for end users, they provide a mechanism by which toprevent those end users viewing any data that their role does not haveauthorization to access. If a user had direct access to a table, say ourCredit_Report table, which contained a mix of low and high sensitivitycolumns then it would be difficult to prevent the user from viewing the highsensitivityitems. Instead, we can create a view that exposes only the lowsensitivitycolumns and give the role permission to query that view, rather thanthe underlying table, as illustrated in Figure 3-9.Therefore, through a view, the security administrator can allow users access tothe aggregated data they need for reporting, while obscuring the structure of theschema and reducing the risk of accidental or intentional disclosure of sensitivedata.73

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!