Which statement should you use to create the view?

You are a database developer on an instance of SQL Server 2008. Your database contains the Employee table defined using the following Transact-SQL statement:
CREATE TABLE dbo.Employee(
EmpID int PRIMARY KEY,
LastName varchar(35) NOT NULL,
FirstName varchar(35) NOT NULL,
HireDate datetime DEFAULT (GETDATE()),
Status varchar(8) CHECK (Status IN (‘Active’, ‘Inactive’)),
SSN char(9) NOT NULL,
Salary money NOT NULL CHECK (Salary > 0),
Commission money DEFAULT 0);
You want to create a view that meets the following requirements:
• Users must not be able to query data for inactive employees.
• Users must not be able to query the SSN, Salary, or Commission column for any employees.
In addition, developers must not be able to modify the structure of the Employee table such that the view becomes unusable.
Which statement should you use to create the view?
A. CREATE VIEW EmpView
WITH SCHEMABINDING AS
SELECT *
FROM dbo.Employee WHERE Status <> ‘Inactive’;
B. CREATE VIEW EmpView
AS
SELECT EmpID, LastName, FirstName, HireDate, Status
FROM dbo.Employee WHERE Status <> ‘Inactive’;
C. CREATE VIEW EmpView
WITH SCHEMABINDING AS
SELECT EmpID, LastName, FirstName, HireDate, Status
FROM dbo.Employee;
D. CREATE VIEW EmpView
WITH SCHEMABINDING AS
SELECT EmpID, LastName, FirstName, HireDate, Status
FROM dbo.Employee WHERE Status <> ‘Inactive’;

microsoft-exams

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.