Which four Transact-SQL statements should you use?

DRAG DROP
You develop a database application for a university. You need to create a view that will be indexed
that meets the following requirements:
Displays the details of only students from Canada.
Allows insertion of details of only students from Canada.
Which four Transact-SQL statements should you use? (To answer, move the appropriate SQL
statements from the list of statements to the answer area and arrange them in the correct order.)

DRAG DROP
You develop a database application for a university. You need to create a view that will be indexed
that meets the following requirements:
Displays the details of only students from Canada.
Allows insertion of details of only students from Canada.
Which four Transact-SQL statements should you use? (To answer, move the appropriate SQL
statements from the list of statements to the answer area and arrange them in the correct order.)

Answer:

Explanation:

http://msdn.microsoft.com/en-us/library/ms187956.aspx



Leave a Reply 9

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


Mr Meat

Mr Meat

I would agree with answer provided. The view was not created with schema binding.

(See answer from question 97 to see how view was created.)

abc

abc

CREATE VIEW…
AS SELECT …
WITH CHECK OPTION;

I wouldn’t use with schemabinding, as there is no such pre requisite… (though the question refers to 4 statements…

Manuel

Manuel

Right, but as the question asks for 4 statements, I think the least ‘damaging’ one is schemabinding….

Peter

Peter

If view will be indexed than is has to go with ‘with schemabinding’.
Check this out: “https://www.simple-talk.com/sql/learn-sql-server/sql-server-indexed-views-the-basics/”;

create view dbo.CanadianStudents
with schemabinding
as
select…
with check option;

With check option is not required and it makes sure, that you cannot select from this view using ‘top’ {I checked it some time ago, and on my sql 2008 this option does not work}.

Peter

Peter

1) create nonclustered index findx_specialOfferID
2) on dbo.OrderDetails(SalesOrderID)
3) where
4) special offer id is not null

Peter

Peter

1) alter table dbo.Book add BookGuid UniqueIdentifier null
2) constraint DF_BookGuid default
3) newid()
4) with values

* with values sets the defaults {in this case using newid() function} for all existing rows;

Michael

Michael

But why does the text talk about four statements, although the answer contains only 3?

IG

IG

I am also wondering why

Michael

Michael

Whitespaces should be removed from ‘special offer id’, as the column name is [SpecialOfferID]